From 608943d6850d0d66e9b20ddbb4b63a1e9c58f3bd Mon Sep 17 00:00:00 2001 From: BritishTeapot Date: Sun, 30 Mar 2025 19:07:32 +0200 Subject: [PATCH] Added new permanent permissions tests. --- test/mock/zenity | 2 +- test/test.bash | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/test/mock/zenity b/test/mock/zenity index be62934..769de25 100755 --- a/test/mock/zenity +++ b/test/mock/zenity @@ -20,4 +20,4 @@ else fi fi -exit -1 # TODO: call actual zenity here +exit 255 # TODO: call actual zenity here diff --git a/test/test.bash b/test/test.bash index 99bd9dc..7b98fe2 100755 --- a/test/test.bash +++ b/test/test.bash @@ -2,6 +2,7 @@ # clean what was left from previous tests +rm -f ./.pt.db rm -rf ./protected mkdir protected touch ./protected/do-not-remove ./protected/should-be-removed ./protected/truth ./protected/perm000 ./protected/perm777 ./protected/should-be-renamed ./protected/do-not-rename @@ -17,7 +18,7 @@ PATH="$(realpath ./mock/):$PATH" echo "Run $(date -u +%Y-%m-%dT%H:%M:%S) " valgrind -s ../build/icfs -o default_permissions ./protected & -sleep 1 +sleep 5 # create files @@ -89,6 +90,18 @@ chmod 000 ./protected/perm000 2>/dev/null && echo "[ICFS-TEST]: OK" || echo "[ICFS-TEST]: chmod cannot change permissions of protected/perm000 despite access being permitted!" # OK +# create files with permanent permissions + +zenity --set-fake-response yes +touch ./protected/friendly 2>/dev/null && + echo "[ICFS-TEST]: OK" || + echo "[ICFS-TEST]: touch cannot create protected/friendly despite access being permitted!" # OK + +zenity --set-fake-response no # this should be ignored +touch ./protected/friendly-again 2>/dev/null && + echo "[ICFS-TEST]: OK" || + echo "[ICFS-TEST]: touch cannot create protected/friendly-again despite access being permitted!" # OK + # unmount sleep 0.5