From: Colin Walters Date: Mon, 8 May 2017 15:20:32 +0000 (-0400) Subject: tests: For installed, s/test-/itest-/ to avoid in-tree name clashes X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~4^2~37^2~30 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2800d176bc300f864a1dc16ddfc63c78356c3061;p=ostree.git tests: For installed, s/test-/itest-/ to avoid in-tree name clashes I want to migrate `test-pull-many.sh` → `itest-pull.sh`, hence not conflicting with the unit test `test-pull.sh. Closes: #840 Approved by: jlebon --- diff --git a/tests/installed/itest-bare-root.sh b/tests/installed/itest-bare-root.sh new file mode 100755 index 00000000..0d384c2c --- /dev/null +++ b/tests/installed/itest-bare-root.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Tests of the "raw ostree" functionality using the host's ostree repo as uid 0. + +set -xeuo pipefail + +dn=$(dirname $0) +. ${dn}/libinsttest.sh + +echo "1..2" + +cd /ostree/repo/tmp +rm co -rf +rm co-testref -rf +ostree refs --delete testref +ostree checkout -H ${host_refspec} co +victim_symlink=/usr/bin/gtar # Seems likely to stick around +# Copy the link to avoid corrupting it +cp co/${victim_symlink}{,.tmp} +mv co/${victim_symlink}{.tmp,} +# Add another xattr to a symlink and a directory, since otherwise this is unusual +setfattr -n security.biometric -v iris co/${victim_symlink} +setfattr -n security.crunchy -v withketchup co/usr/bin +csum=$(ostree commit -b testref --link-checkout-speedup --tree=dir=co) +ostree fsck +ostree ls -X testref ${victim_symlink} > ls.txt +assert_file_has_content ls.txt 'security.biometric' +ostree ls -X ${host_refspec} ${victim_symlink} > ls.txt +assert_not_file_has_content ls.txt security.biometric +ostree ls -X testref usr/bin > ls.txt +assert_file_has_content ls.txt 'security.crunchy' + +ostree checkout -H testref co-testref +getfattr -n security.biometric co-testref/${victim_symlink} > xattr.txt +assert_file_has_content xattr.txt 'security.biometric="iris"' +getfattr -n security.crunchy co-testref/usr/bin > xattr.txt +assert_file_has_content xattr.txt 'security.crunchy="withketchup"' + +rm co -rf +rm co-testref -rf + +echo "ok xattrs" diff --git a/tests/installed/itest-deploy-selinux.sh b/tests/installed/itest-deploy-selinux.sh new file mode 100755 index 00000000..c4965f87 --- /dev/null +++ b/tests/installed/itest-deploy-selinux.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Verify our /etc merge works with selinux + +set -xeuo pipefail + +dn=$(dirname $0) +. ${dn}/libinsttest.sh + +# Create a new deployment +ostree admin deploy --karg-proc-cmdline ${host_refspec} +new_deployment_path=/ostree/deploy/${host_osname}/deploy/${host_commit}.1 + +# A set of files that have a variety of security contexts +for file in fstab passwd exports hostname sysctl.conf; do + current=$(cd /etc && ls -Z ${file}) + new=$(cd ${new_deployment_path}/etc && ls -Z ${file}) + assert_streq "${current}" "${new}" +done + +ostree admin undeploy 0 diff --git a/tests/installed/run.sh b/tests/installed/run.sh index 3c60a6e2..02e1a7f9 100755 --- a/tests/installed/run.sh +++ b/tests/installed/run.sh @@ -3,7 +3,7 @@ set -xeuo pipefail dn=$(dirname $0) -for tn in ${dn}/test-*.sh; do +for tn in ${dn}/itest-*.sh; do echo Executing: ${tn} ${tn} done diff --git a/tests/installed/test-bare-root.sh b/tests/installed/test-bare-root.sh deleted file mode 100755 index 0d384c2c..00000000 --- a/tests/installed/test-bare-root.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -# Tests of the "raw ostree" functionality using the host's ostree repo as uid 0. - -set -xeuo pipefail - -dn=$(dirname $0) -. ${dn}/libinsttest.sh - -echo "1..2" - -cd /ostree/repo/tmp -rm co -rf -rm co-testref -rf -ostree refs --delete testref -ostree checkout -H ${host_refspec} co -victim_symlink=/usr/bin/gtar # Seems likely to stick around -# Copy the link to avoid corrupting it -cp co/${victim_symlink}{,.tmp} -mv co/${victim_symlink}{.tmp,} -# Add another xattr to a symlink and a directory, since otherwise this is unusual -setfattr -n security.biometric -v iris co/${victim_symlink} -setfattr -n security.crunchy -v withketchup co/usr/bin -csum=$(ostree commit -b testref --link-checkout-speedup --tree=dir=co) -ostree fsck -ostree ls -X testref ${victim_symlink} > ls.txt -assert_file_has_content ls.txt 'security.biometric' -ostree ls -X ${host_refspec} ${victim_symlink} > ls.txt -assert_not_file_has_content ls.txt security.biometric -ostree ls -X testref usr/bin > ls.txt -assert_file_has_content ls.txt 'security.crunchy' - -ostree checkout -H testref co-testref -getfattr -n security.biometric co-testref/${victim_symlink} > xattr.txt -assert_file_has_content xattr.txt 'security.biometric="iris"' -getfattr -n security.crunchy co-testref/usr/bin > xattr.txt -assert_file_has_content xattr.txt 'security.crunchy="withketchup"' - -rm co -rf -rm co-testref -rf - -echo "ok xattrs" diff --git a/tests/installed/test-deploy-selinux.sh b/tests/installed/test-deploy-selinux.sh deleted file mode 100755 index c4965f87..00000000 --- a/tests/installed/test-deploy-selinux.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -# Verify our /etc merge works with selinux - -set -xeuo pipefail - -dn=$(dirname $0) -. ${dn}/libinsttest.sh - -# Create a new deployment -ostree admin deploy --karg-proc-cmdline ${host_refspec} -new_deployment_path=/ostree/deploy/${host_osname}/deploy/${host_commit}.1 - -# A set of files that have a variety of security contexts -for file in fstab passwd exports hostname sysctl.conf; do - current=$(cd /etc && ls -Z ${file}) - new=$(cd ${new_deployment_path}/etc && ls -Z ${file}) - assert_streq "${current}" "${new}" -done - -ostree admin undeploy 0