summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca BRUNO <luca.bruno@coreos.com>2022-03-03 11:12:00 +0000
committerLuca BRUNO <luca.bruno@coreos.com>2022-03-03 11:11:59 +0000
commitaca5671eb19fdf5e43784ffb5223e7358e5a6537 (patch)
treea7072917889c4dfc28ebcf24a9db1c659ac7054a
parent7e79b82ff8b3c3aa7fbe5edfcfa237f9447e2f18 (diff)
downloadostree-aca5671eb19fdf5e43784ffb5223e7358e5a6537.tar.gz
tests/basic-bare-split-xattrs: add fixture, check read logic
-rw-r--r--Makefile-tests.am1
-rw-r--r--tests/fixtures/bare-split-xattrs/basic.tar.xzbin0 -> 2504 bytes
-rwxr-xr-xtests/test-basic-bare-split-xattrs.sh28
3 files changed, 29 insertions, 0 deletions
diff --git a/Makefile-tests.am b/Makefile-tests.am
index 5c97bd84..5d39ee5e 100644
--- a/Makefile-tests.am
+++ b/Makefile-tests.am
@@ -202,6 +202,7 @@ dist_installed_test_data = tests/archive-test.sh \
tests/ostree-path-traverse.tar.gz \
tests/pre-signed-pull-data.tar.gz \
tests/libtest-core.sh \
+ tests/fixtures/bare-split-xattrs/basic.tar.xz \
$(NULL)
EXTRA_DIST += tests/libtest.sh
diff --git a/tests/fixtures/bare-split-xattrs/basic.tar.xz b/tests/fixtures/bare-split-xattrs/basic.tar.xz
new file mode 100644
index 00000000..cec6717e
--- /dev/null
+++ b/tests/fixtures/bare-split-xattrs/basic.tar.xz
Binary files differ
diff --git a/tests/test-basic-bare-split-xattrs.sh b/tests/test-basic-bare-split-xattrs.sh
index 1eeb3039..ac8ebffd 100755
--- a/tests/test-basic-bare-split-xattrs.sh
+++ b/tests/test-basic-bare-split-xattrs.sh
@@ -9,6 +9,15 @@ set -euo pipefail
mode="bare-split-xattrs"
OSTREE="${CMD_PREFIX} ostree --repo=${test_tmpdir}/repo"
+SUDO="sudo --non-interactive"
+PRIVILEGED="false"
+if [ $(id -u) -eq 0 ]; then
+ PRIVILEGED="true"
+ SUDO=""
+elif $(${SUDO} -v); then
+ PRIVILEGED="true"
+fi
+
cd ${test_tmpdir}
${OSTREE} init --mode "${mode}"
${OSTREE} config get core.mode > mode.txt
@@ -44,4 +53,23 @@ fi
tap_ok "commit exp override"
rm -rf -- repo files
+if [ "${PRIVILEGED}" = "true" ]; then
+ COMMIT="d614c428015227259031b0f19b934dade908942fd71c49047e0daa70e7800a5d"
+ cd ${test_tmpdir}
+ ${SUDO} tar --same-permissions --same-owner -xaf ${test_srcdir}/fixtures/bare-split-xattrs/basic.tar.xz
+ ${SUDO} ${OSTREE} fsck --all
+ ${OSTREE} log ${COMMIT} > out.txt
+ assert_file_has_content_literal out.txt "fixtures: bare-split-xattrs repo"
+ ${OSTREE} ls ${COMMIT} -X /foo > out.txt
+ assert_file_has_content_literal out.txt "{ @a(ayay) [] } /foo"
+ ${OSTREE} ls ${COMMIT} -X /bar > out.txt
+ assert_file_has_content_literal out.txt "{ [(b'user.mykey', [byte 0x6d, 0x79, 0x76, 0x61, 0x6c, 0x75, 0x65])] } /bar"
+ ${OSTREE} ls ${COMMIT} /foolink > out.txt
+ assert_file_has_content_literal out.txt "/foolink -> foo"
+ tap_ok "reading simple fixture"
+ ${SUDO} rm -rf -- repo log.txt
+else
+ tap_ok "reading simple fixture # skip Unable to sudo"
+fi
+
tap_end