tests/basic: Fix race in timestamp test
%Z only uses seconds, so it's possible that we did the commit in the same second, which made this test racy. - Switch to full nanosecond precision using '%.Y' so it always differs - Fix the inverted `cmp` usage - Add a missing `ok`
This commit is contained in:
parent
fea786cb2d
commit
e2234e854d
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
echo "1..49"
|
echo "1..50"
|
||||||
|
|
||||||
$OSTREE checkout test2 checkout-test2
|
$OSTREE checkout test2 checkout-test2
|
||||||
echo "ok checkout"
|
echo "ok checkout"
|
||||||
|
|
@ -434,10 +434,12 @@ rm -rf test2-checkout
|
||||||
mkdir -p test2-checkout
|
mkdir -p test2-checkout
|
||||||
cd test2-checkout
|
cd test2-checkout
|
||||||
touch blah
|
touch blah
|
||||||
stat --printf="%Z\n" ${test_tmpdir}/repo > ${test_tmpdir}/timestamp-orig.txt
|
stat --printf="%.Y\n" ${test_tmpdir}/repo > ${test_tmpdir}/timestamp-orig.txt
|
||||||
$OSTREE commit -b test2 -s "Should bump the mtime"
|
$OSTREE commit -b test2 -s "Should bump the mtime"
|
||||||
stat --printf="%Z\n" ${test_tmpdir}/repo > ${test_tmpdir}/timestamp-new.txt
|
stat --printf="%.Y\n" ${test_tmpdir}/repo > ${test_tmpdir}/timestamp-new.txt
|
||||||
cd ..
|
cd ..
|
||||||
if ! cmp timestamp-{orig,new}.txt; then
|
if cmp timestamp-{orig,new}.txt; then
|
||||||
assert_not_reached "failed to update mtime on repo"
|
assert_not_reached "failed to update mtime on repo"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "ok mtime updated"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue