diff options
author | Luca BRUNO <luca.bruno@coreos.com> | 2021-08-23 09:46:22 +0000 |
---|---|---|
committer | Luca BRUNO <luca.bruno@coreos.com> | 2021-08-24 07:56:48 +0000 |
commit | 00660eae7972a04ef9a0784e504545f43376c517 (patch) | |
tree | 1d365c5b4f26a62fc40ff97c0fadcc6ff1ef8d37 | |
parent | 3e2360e3bba6c215acccc77373d01a5674c770e6 (diff) | |
download | ostree-00660eae7972a04ef9a0784e504545f43376c517.tar.gz |
tests: update several bare-user-only checks
-rw-r--r-- | tests/basic-test.sh | 19 | ||||
-rwxr-xr-x | tests/test-basic-user-only.sh | 25 |
2 files changed, 18 insertions, 26 deletions
diff --git a/tests/basic-test.sh b/tests/basic-test.sh index 7946ffa3..935544d9 100644 --- a/tests/basic-test.sh +++ b/tests/basic-test.sh @@ -29,10 +29,8 @@ COMMIT_ARGS="" DIFF_ARGS="" if is_bare_user_only_repo repo; then # In bare-user-only repos we can only represent files with uid/gid 0, no - # xattrs and canonical permissions, so we need to commit them as such, or - # we end up with repos that don't pass fsck - COMMIT_ARGS="--no-xattrs" - DIFF_ARGS="--owner-uid=0 --owner-gid=0 --no-xattrs" + # xattrs and canonical permissions. + DIFF_ARGS="--owner-uid=0 --owner-gid=0" # Also, since we can't check out uid=0 files we need to check out in user mode CHECKOUT_U_ARG="-U" CHECKOUT_H_ARGS="-U -H" @@ -314,7 +312,7 @@ echo "ok diff revisions" cd ${test_tmpdir}/checkout-test2-4 echo afile > oh-look-a-file -$OSTREE diff test2 ./ > ${test_tmpdir}/diff-test2-2 +$OSTREE diff ${DIFF_ARGS} test2 ./ > ${test_tmpdir}/diff-test2-2 rm oh-look-a-file cd ${test_tmpdir} assert_file_has_content diff-test2-2 'A *oh-look-a-file$' @@ -787,11 +785,14 @@ cd ${test_tmpdir} rm files -rf && mkdir files mkdir files/worldwritable-dir chmod a+w files/worldwritable-dir -$CMD_PREFIX ostree --repo=repo commit -b content-with-dir-world-writable --tree=dir=files +$OSTREE commit ${COMMIT_ARGS} -b content-with-dir-world-writable --tree=dir=files +$OSTREE fsck rm dir-co -rf -$CMD_PREFIX ostree --repo=repo checkout -U -H -M content-with-dir-world-writable dir-co -assert_file_has_mode dir-co/worldwritable-dir 775 -if ! is_bare_user_only_repo repo; then +$OSTREE checkout -U -H -M content-with-dir-world-writable dir-co +if is_bare_user_only_repo repo; then + assert_file_has_mode dir-co/worldwritable-dir 755 +else + assert_file_has_mode dir-co/worldwritable-dir 775 rm dir-co -rf $CMD_PREFIX ostree --repo=repo checkout -U -H content-with-dir-world-writable dir-co assert_file_has_mode dir-co/worldwritable-dir 777 diff --git a/tests/test-basic-user-only.sh b/tests/test-basic-user-only.sh index 7ef153c3..568f9e95 100755 --- a/tests/test-basic-user-only.sh +++ b/tests/test-basic-user-only.sh @@ -25,7 +25,7 @@ set -euo pipefail mode="bare-user-only" setup_test_repository "$mode" -extra_basic_tests=7 +extra_basic_tests=6 . $(dirname $0)/basic-test.sh $CMD_PREFIX ostree --version > version.yaml @@ -63,8 +63,8 @@ rm files -rf && mkdir files echo "a group writable file" > files/some-group-writable chmod 0664 files/some-group-writable $CMD_PREFIX ostree --repo=repo-input commit -b content-with-group-writable --tree=dir=files -$CMD_PREFIX ostree pull-local --repo=repo repo-input -$CMD_PREFIX ostree --repo=repo checkout -U -H content-with-group-writable groupwritable-co +$OSTREE pull-local repo-input +$OSTREE checkout -U -H content-with-group-writable groupwritable-co assert_file_has_mode groupwritable-co/some-group-writable 664 echo "ok supported group writable" @@ -75,8 +75,8 @@ rm files -rf && mkdir files mkdir files/worldwritable-dir chmod a+w files/worldwritable-dir $CMD_PREFIX ostree --repo=repo-input commit -b content-with-dir-world-writable --tree=dir=files -$CMD_PREFIX ostree pull-local --repo=repo repo-input -$CMD_PREFIX ostree --repo=repo checkout -U -H content-with-dir-world-writable dir-co +$OSTREE pull-local repo-input +$OSTREE checkout -U -H content-with-dir-world-writable dir-co assert_file_has_mode dir-co/worldwritable-dir 775 echo "ok didn't make world-writable dir" @@ -106,21 +106,12 @@ rm repo -rf ostree_repo_init repo init --mode=bare-user-only rm files -rf && mkdir files echo afile > files/afile +chmod 0777 files/afile $OSTREE commit ${COMMIT_ARGS} -b perms files -rm out -rf -$OSTREE checkout --force-copy perms out -$OSTREE checkout ${CHECKOUT_H_ARGS} --union-identical perms out $OSTREE fsck -echo "ok checkout checksum with canonical perms" - -cd ${test_tmpdir} -rm repo -rf -ostree_repo_init repo init --mode=bare-user-only -rm files -rf && mkdir files -echo afile > files/afile -$OSTREE commit ${COMMIT_ARGS} -b perms files rm out -rf $OSTREE checkout --force-copy perms out +assert_file_has_mode out/afile 755 $OSTREE checkout ${CHECKOUT_H_ARGS} --union-identical perms out -$OSTREE fsck +assert_file_has_mode out/afile 755 echo "ok automatic canonical perms for bare-user-only" |