diff options
author | Simon McVittie <smcv@collabora.com> | 2022-11-21 13:41:13 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-21 13:41:13 +0000 |
commit | bb7ac1348f98ee48f1e2e38bdf93abca2e4f6d06 (patch) | |
tree | b6c053b787c3292568896dfd02b14474b810eb57 | |
parent | aa0fb696ab4b7482fa54a0422b8a19c87407350e (diff) | |
parent | 5080b233faead1b7e9b1321d2897c204bcbab3b3 (diff) | |
download | bubblewrap-bb7ac1348f98ee48f1e2e38bdf93abca2e4f6d06.tar.gz |
Merge pull request #539 from smcv/test-size
Fix test failures in 0.7.0 on unusual platforms
-rwxr-xr-x | tests/test-run.sh | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/tests/test-run.sh b/tests/test-run.sh index 3e5e9e6..a08998b 100755 --- a/tests/test-run.sh +++ b/tests/test-run.sh @@ -406,27 +406,39 @@ assert_file_has_content dir-permissions '^755$' echo "ok - tmpfs has expected permissions" # 1048576 = 1 MiB -$RUN \ - --size 1048576 --tmpfs "$(pwd -P)" \ - df --output=size --block-size=1K "$(pwd -P)" > dir-size -assert_file_has_content dir-size '^ *1024$' -$RUN \ - --size 1048576 --perms 01777 --tmpfs "$(pwd -P)" \ - stat -c '%a' "$(pwd -P)" > dir-permissions -assert_file_has_content dir-permissions '^1777$' -$RUN \ - --size 1048576 --perms 01777 --tmpfs "$(pwd -P)" \ - df --output=size --block-size=1K "$(pwd -P)" > dir-size -assert_file_has_content dir-size '^ *1024$' -$RUN \ - --perms 01777 --size 1048576 --tmpfs "$(pwd -P)" \ - stat -c '%a' "$(pwd -P)" > dir-permissions -assert_file_has_content dir-permissions '^1777$' -$RUN \ - --perms 01777 --size 1048576 --tmpfs "$(pwd -P)" \ - df --output=size --block-size=1K "$(pwd -P)" > dir-size -assert_file_has_content dir-size '^ *1024$' -echo "ok - tmpfs has expected size" +if test -n "${bwrap_is_suid:-}"; then + if $RUN --size 1048576 --tmpfs "$(pwd -P)" true; then + assert_not_reached "Should not allow --size --tmpfs when setuid" + fi + echo "ok - --size --tmpfs is not allowed when setuid" +elif df --output=size --block-size=1K "$(pwd -P)" >/dev/null 2>/dev/null; then + $RUN \ + --size 1048576 --tmpfs "$(pwd -P)" \ + df --output=size --block-size=1K "$(pwd -P)" > dir-size + assert_file_has_content dir-size '^ *1024$' + $RUN \ + --size 1048576 --perms 01777 --tmpfs "$(pwd -P)" \ + stat -c '%a' "$(pwd -P)" > dir-permissions + assert_file_has_content dir-permissions '^1777$' + $RUN \ + --size 1048576 --perms 01777 --tmpfs "$(pwd -P)" \ + df --output=size --block-size=1K "$(pwd -P)" > dir-size + assert_file_has_content dir-size '^ *1024$' + $RUN \ + --perms 01777 --size 1048576 --tmpfs "$(pwd -P)" \ + stat -c '%a' "$(pwd -P)" > dir-permissions + assert_file_has_content dir-permissions '^1777$' + $RUN \ + --perms 01777 --size 1048576 --tmpfs "$(pwd -P)" \ + df --output=size --block-size=1K "$(pwd -P)" > dir-size + assert_file_has_content dir-size '^ *1024$' + echo "ok - tmpfs has expected size" +else + $RUN --size 1048576 --tmpfs "$(pwd -P)" true + $RUN --perms 01777 --size 1048576 --tmpfs "$(pwd -P)" true + $RUN --size 1048576 --perms 01777 --tmpfs "$(pwd -P)" true + echo "ok # SKIP df is too old, cannot test --size --tmpfs fully" +fi $RUN \ --file 0 /tmp/file \ |