bunpen: backfill a test for how /proc functions in the sandbox
This commit is contained in:
@@ -143,6 +143,26 @@ test_06_keep_10_net() {
|
||||
test -z "$(bunpen --bunpen-path / ip link show lo up)"
|
||||
}
|
||||
|
||||
test_06_keep_11_pid() {
|
||||
set -x
|
||||
local me=$$
|
||||
# /proc should be auto-mounted if not keeping PIDs; exterior PID is invisible
|
||||
bunpen --bunpen-path /nix/store "$test" -e /proc/self
|
||||
! bunpen --bunpen-path /nix/store "$test" -e /proc/$me
|
||||
|
||||
# /proc should *not* be auto-mounted if keeping PIDs
|
||||
! bunpen --bunpen-path /nix/store --bunpen-keep-pid "$test" -e /proc/self
|
||||
|
||||
# if keeping PIDs and explicitly mounting, exterior PID should be visible
|
||||
bunpen --bunpen-path /nix/store --bunpen-path /proc --bunpen-keep-pid "$test" -e /proc/self
|
||||
bunpen --bunpen-path /nix/store --bunpen-path /proc --bunpen-keep-pid "$test" -e /proc/$me
|
||||
|
||||
# if explicitly mounting /proc, but not keeping PIDs... TODO: consider changing this so exterior PIDs are visible.
|
||||
# this just documents the existing behavior as per 2024/12/25
|
||||
bunpen --bunpen-path /nix/store --bunpen-path /proc "$test" -e /proc/self
|
||||
! bunpen --bunpen-path /nix/store --bunpen-path /proc "$test" -e /proc/$me
|
||||
}
|
||||
|
||||
test_07_env_01_keep() {
|
||||
ORIG_ENV=orig bunpen --bunpen-path / bash -c '[[ "$ORIG_ENV" = orig && -z "$NOT_ENV" ]]'
|
||||
}
|
||||
|
Reference in New Issue
Block a user