repo: Add OSTREE_BOOTID override envvar for debugging

It's useful for test cases to be able to influence this.

Conflicts:
	src/libostree/ostree-repo.c

Closes: #170
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Colin Walters (automation) committed 2016-05-02 18:44:44 +00:00
1 parent 15b3cab65e
commit e3ec83a934
3 files changed
+35 -8

No files matched your search

+15 -2
View File
@@ -400,11 +400,24 @@ echo "ok disable cache checkout"
cd ${test_tmpdir}
rm checkout-test2 -rf
$OSTREE checkout test2 checkout-test2
if env OSTREE_REPO_TEST_ERROR=pre-commit $OSTREE commit -b test2 -s '' $test_tmpdir/checkout-test2 2>err.txt; then
date > checkout-test2/date.txt
rm repo/tmp/* -rf
export TEST_BOOTID=3072029c-8b10-60d1-d31b-8422eeff9b42
if env OSTREE_REPO_TEST_ERROR=pre-commit OSTREE_BOOTID=${TEST_BOOTID} \
$OSTREE commit -b test2 -s '' $test_tmpdir/checkout-test2 2>err.txt; then
assert_not_reached "Should have hit OSTREE_REPO_TEST_ERROR_PRE_COMMIT"
fi
assert_file_has_content err.txt OSTREE_REPO_TEST_ERROR_PRE_COMMIT
echo "ok test error pre commit"
found_staging=0
for d in $(find repo/tmp/ -maxdepth 1 -type d); do
bn=$(basename $d)
if test ${bn##staging-} != ${bn}; then
assert_str_match "${bn}" "^staging-${TEST_BOOTID}-"
found_staging=1
fi
done
assert_streq "${found_staging}" 1
echo "ok test error pre commit/bootid"
# Whiteouts
cd ${test_tmpdir}
+6
View File
@@ -86,6 +86,12 @@ assert_streq () {
test "$1" = "$2" || (echo 1>&2 "$1 != $2"; exit 1)
}
assert_str_match () {
if ! echo "$1" | grep -E -q "$2"; then
(echo 1>&2 "$1 does not match regexp $2"; exit 1)
fi
}
assert_not_streq () {
(! test "$1" = "$2") || (echo 1>&2 "$1 == $2"; exit 1)
}