diff options
author | Colin Walters <walters@verbum.org> | 2017-06-28 21:39:16 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-06-29 15:34:57 +0000 |
commit | 2013db0527dc2f85ab21cdc37047154a26fd161c (patch) | |
tree | fb778e7e2ce16b9024472b15911eb9d97b89608a /tests/libtest.sh | |
parent | ea15025c192978420b42f654d028ae74a4f7a3ce (diff) | |
download | ostree-2013db0527dc2f85ab21cdc37047154a26fd161c.tar.gz |
tests: Fix assert_files_hardlinked
It was always succeeding because we were trying to stat the inode number, and
failing, and thus getting the empty string for both, which compared as true.
Regression from:
<https://github.com/ostreedev/ostree/commit/74e3581e>
Noticed this while working on
<https://github.com/ostreedev/ostree/pull/974>
and looking at the test results.
Closes: #976
Approved by: jlebon
Diffstat (limited to 'tests/libtest.sh')
-rwxr-xr-x | tests/libtest.sh | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/libtest.sh b/tests/libtest.sh index ee3f4af8..6f33c5b5 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -117,15 +117,14 @@ else fi files_are_hardlinked() { - f1=$(stat -c %i $1) - f2=$(stat -c %i $2) - [ "$f1" == "$f2" ] + inode1=$(stat -c %i $1) + inode2=$(stat -c %i $2) + test -n "${inode1}" && test -n "${inode2}" + [ "${inode1}" == "${inode2}" ] } assert_files_hardlinked() { - f1=$(stat -c %i $1) - f2=$(stat -c %i $2) - if ! files_are_hardlinked "$f1" "$f2"; then + if ! files_are_hardlinked "$1" "$2"; then fatal "Files '$1' and '$2' are not hardlinked" fi } |