diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-15 03:30:51 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-15 04:00:55 +0900 |
| commit | 9ed3ba85eaba4bc4bd12b290dc4daf00ffe159dc (patch) | |
| tree | 03301910c40c59eb94029f1a93b1e74e21b5226a /test/sandbox | |
| parent | 4433c993fae86634b813ee212803a84aaeedd374 (diff) | |
hst/fs: implement overlay fstype
This finally exposes overlay mounts in the high level hakurei API.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'test/sandbox')
| -rw-r--r-- | test/sandbox/case/device.nix | 7 | ||||
| -rw-r--r-- | test/sandbox/case/mapuid.nix | 7 | ||||
| -rw-r--r-- | test/sandbox/case/tty.nix | 7 | ||||
| -rw-r--r-- | test/sandbox/configuration.nix | 18 | ||||
| -rw-r--r-- | test/sandbox/test.py | 1 |
5 files changed, 37 insertions, 3 deletions
diff --git a/test/sandbox/case/device.nix b/test/sandbox/case/device.nix index ded60aae..fb2a54f2 100644 --- a/test/sandbox/case/device.nix +++ b/test/sandbox/case/device.nix @@ -47,7 +47,10 @@ in ]; fs = fs "dead" { - ".hakurei" = fs "800001ed" { } null; + ".hakurei" = fs "800001ed" { + ".ro-store" = fs "801001fd" null null; + store = fs "800001ff" null null; + } null; bin = fs "800001ed" { sh = fs "80001ff" null null; } null; dev = fs "800001ed" null null; etc = fs "800001ed" { @@ -218,6 +221,8 @@ in (ent "/devices" "/sys/devices" "ro,nosuid,nodev,noexec,relatime" "sysfs" "sysfs" "rw") (ent "/dri" "/dev/dri" "rw,nosuid" "devtmpfs" "devtmpfs" ignore) (ent "/var/cache" "/var/cache" "rw,nosuid,nodev,relatime" "ext4" "/dev/disk/by-label/nixos" "rw") + (ent "/" "/.hakurei/.ro-store" "rw,relatime" "overlay" "overlay" "ro,lowerdir=/host/nix/.ro-store:/host/nix/.rw-store/upper,redirect_dir=nofollow,userxattr") + (ent "/" "/.hakurei/store" "rw,relatime" "overlay" "overlay" "rw,lowerdir=/host/nix/.ro-store:/host/nix/.rw-store/upper,upperdir=/host/tmp/.hakurei-store-rw/upper,workdir=/host/tmp/.hakurei-store-rw/work,redirect_dir=nofollow,userxattr") (ent "/etc" ignore "ro,nosuid,nodev,relatime" "ext4" "/dev/disk/by-label/nixos" "rw") (ent "/" "/run/user" "rw,nosuid,nodev,relatime" "tmpfs" "ephemeral" "rw,size=4k,mode=755,uid=1000004,gid=1000004") (ent "/tmp/hakurei.1000/runtime/4" "/run/user/65534" "rw,nosuid,nodev,relatime" "ext4" "/dev/disk/by-label/nixos" "rw") diff --git a/test/sandbox/case/mapuid.nix b/test/sandbox/case/mapuid.nix index fe5dad88..1069f9fa 100644 --- a/test/sandbox/case/mapuid.nix +++ b/test/sandbox/case/mapuid.nix @@ -56,7 +56,10 @@ in ]; fs = fs "dead" { - ".hakurei" = fs "800001ed" { } null; + ".hakurei" = fs "800001ed" { + ".ro-store" = fs "801001fd" null null; + store = fs "800001ff" null null; + } null; bin = fs "800001ed" { sh = fs "80001ff" null null; } null; dev = fs "800001ed" { core = fs "80001ff" null null; @@ -248,6 +251,8 @@ in (ent "/devices" "/sys/devices" "ro,nosuid,nodev,noexec,relatime" "sysfs" "sysfs" "rw") (ent "/dri" "/dev/dri" "rw,nosuid" "devtmpfs" "devtmpfs" ignore) (ent "/var/cache" "/var/cache" "rw,nosuid,nodev,relatime" "ext4" "/dev/disk/by-label/nixos" "rw") + (ent "/" "/.hakurei/.ro-store" "rw,relatime" "overlay" "overlay" "ro,lowerdir=/host/nix/.ro-store:/host/nix/.rw-store/upper,redirect_dir=nofollow,userxattr") + (ent "/" "/.hakurei/store" "rw,relatime" "overlay" "overlay" "rw,lowerdir=/host/nix/.ro-store:/host/nix/.rw-store/upper,upperdir=/host/tmp/.hakurei-store-rw/upper,workdir=/host/tmp/.hakurei-store-rw/work,redirect_dir=nofollow,userxattr") (ent "/etc" ignore "ro,nosuid,nodev,relatime" "ext4" "/dev/disk/by-label/nixos" "rw") (ent "/" "/run/user" "rw,nosuid,nodev,relatime" "tmpfs" "ephemeral" "rw,size=4k,mode=755,uid=1000003,gid=1000003") (ent "/tmp/hakurei.1000/runtime/3" "/run/user/1000" "rw,nosuid,nodev,relatime" "ext4" "/dev/disk/by-label/nixos" "rw") diff --git a/test/sandbox/case/tty.nix b/test/sandbox/case/tty.nix index af2bfe98..267ac661 100644 --- a/test/sandbox/case/tty.nix +++ b/test/sandbox/case/tty.nix @@ -56,7 +56,10 @@ in ]; fs = fs "dead" { - ".hakurei" = fs "800001ed" { } null; + ".hakurei" = fs "800001ed" { + ".ro-store" = fs "801001fd" null null; + store = fs "800001ff" null null; + } null; bin = fs "800001ed" { sh = fs "80001ff" null null; } null; dev = fs "800001ed" { console = fs "4200190" null null; @@ -250,6 +253,8 @@ in (ent "/devices" "/sys/devices" "ro,nosuid,nodev,noexec,relatime" "sysfs" "sysfs" "rw") (ent "/dri" "/dev/dri" "rw,nosuid" "devtmpfs" "devtmpfs" ignore) (ent "/var/cache" "/var/cache" "rw,nosuid,nodev,relatime" "ext4" "/dev/disk/by-label/nixos" "rw") + (ent "/" "/.hakurei/.ro-store" "rw,relatime" "overlay" "overlay" "ro,lowerdir=/host/nix/.ro-store:/host/nix/.rw-store/upper,redirect_dir=nofollow,userxattr") + (ent "/" "/.hakurei/store" "rw,relatime" "overlay" "overlay" "rw,lowerdir=/host/nix/.ro-store:/host/nix/.rw-store/upper,upperdir=/host/tmp/.hakurei-store-rw/upper,workdir=/host/tmp/.hakurei-store-rw/work,redirect_dir=nofollow,uuid=on,userxattr") (ent "/etc" ignore "ro,nosuid,nodev,relatime" "ext4" "/dev/disk/by-label/nixos" "rw") (ent "/" "/run/user" "rw,nosuid,nodev,relatime" "tmpfs" "ephemeral" "rw,size=4k,mode=755,uid=1000002,gid=1000002") (ent "/tmp/hakurei.1000/runtime/2" "/run/user/65534" "rw,nosuid,nodev,relatime" "ext4" "/dev/disk/by-label/nixos" "rw") diff --git a/test/sandbox/configuration.nix b/test/sandbox/configuration.nix index fae60ac2..977d8546 100644 --- a/test/sandbox/configuration.nix +++ b/test/sandbox/configuration.nix @@ -82,6 +82,24 @@ in src = "/var/cache"; write = true; } + { + type = "overlay"; + dst = "/.hakurei/.ro-store"; + lower = [ + "/nix/.ro-store" + "/nix/.rw-store/upper" + ]; + } + { + type = "overlay"; + dst = "/.hakurei/store"; + lower = [ + "/nix/.ro-store" + "/nix/.rw-store/upper" + ]; + upper = "/tmp/.hakurei-store-rw/upper"; + work = "/tmp/.hakurei-store-rw/work"; + } ]; inherit (testCases) apps; diff --git a/test/sandbox/test.py b/test/sandbox/test.py index 805d3081..3f8c7e30 100644 --- a/test/sandbox/test.py +++ b/test/sandbox/test.py @@ -55,6 +55,7 @@ print(machine.fail("sudo -u alice -i hakurei run capsh --has-p=CAP_SYS_ADMIN")) print(machine.fail("sudo -u alice -i hakurei run umount -R /dev")) # Check sandbox outcome: +machine.succeed("install -dm0777 /tmp/.hakurei-store-rw/{upper,work}") check_offset = 0 def check_sandbox(name): global check_offset |
