commit: 8395b865b2a92e994e1fca8295b492c42333d363
parent a9d2fa56a7396a1492eccd5c181229489cc4502b
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Thu,  1 Aug 2024 09:25:20 +0200
test-cmd/base64.sh: Skip noperm when run as uid0
Diffstat:
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/test-cmd/base64.sh b/test-cmd/base64.sh
@@ -40,12 +40,17 @@ t_file oneliner_encode "-w0 $WD/inputs/all_bytes" "$WD/outputs/base64/all_bytes_
 
 t_file oneliner_decode "-d -w0 $WD/outputs/base64/all_bytes_w0" "$WD/inputs/all_bytes"
 
-touch "$WD/inputs/chmod_000"
-chmod 0000 "$WD/inputs/chmod_000"
-t --exit=1 'noperm' "$WD/inputs/chmod_000" "base64: Error opening ‘$WD/inputs/chmod_000’: Permission denied
+if [ "$(id -u)" = 0 ]
+then
+	skip noperm 'needs to be run unprivileged'
+else
+	touch "$WD/inputs/chmod_000"
+	chmod 0000 "$WD/inputs/chmod_000"
+	t --exit=1 'noperm' "$WD/inputs/chmod_000" "base64: Error opening ‘$WD/inputs/chmod_000’: Permission denied
 "
-chmod 0600 "$WD/inputs/chmod_000"
-rm "$WD/inputs/chmod_000"
+	chmod 0600 "$WD/inputs/chmod_000"
+	rm "$WD/inputs/chmod_000"
+fi
 
 #atf_test_case devfull
 #devfull_body() {