scripts/gzip_tests.sh: when root, skip test that requires non-root

This commit is contained in:
Eric Biggers 2020-11-21 12:42:09 -08:00
parent 9f257c0123
commit 7be9d514f8

View File

@ -363,19 +363,21 @@ assert_skipped gunzip 1.gz 2.gz
cmp 2 file cmp 2 file
begin_test 'Multiple files, continue on error' if (( $(id -u) != 0 )); then
cp file 1 begin_test 'Multiple files, continue on error'
cp file 2 cp file 1
chmod a-r 1 cp file 2
assert_error 'Permission denied' gzip 1 2 chmod a-r 1
[ ! -e 1.gz ] assert_error 'Permission denied' gzip 1 2
cmp file <(gunzip -c 2.gz) [ ! -e 1.gz ]
rm -f 1 cmp file <(gunzip -c 2.gz)
cp 2.gz 1.gz rm -f 1
chmod a-r 1.gz cp 2.gz 1.gz
assert_error 'Permission denied' gunzip 1.gz 2.gz chmod a-r 1.gz
[ ! -e 1 ] assert_error 'Permission denied' gunzip 1.gz 2.gz
cmp 2 file [ ! -e 1 ]
cmp 2 file
fi
begin_test 'Compressing empty file' begin_test 'Compressing empty file'