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
This commit is contained in:
parent
ea15025c19
commit
2013db0527
|
|
@ -117,15 +117,14 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
files_are_hardlinked() {
|
files_are_hardlinked() {
|
||||||
f1=$(stat -c %i $1)
|
inode1=$(stat -c %i $1)
|
||||||
f2=$(stat -c %i $2)
|
inode2=$(stat -c %i $2)
|
||||||
[ "$f1" == "$f2" ]
|
test -n "${inode1}" && test -n "${inode2}"
|
||||||
|
[ "${inode1}" == "${inode2}" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_files_hardlinked() {
|
assert_files_hardlinked() {
|
||||||
f1=$(stat -c %i $1)
|
if ! files_are_hardlinked "$1" "$2"; then
|
||||||
f2=$(stat -c %i $2)
|
|
||||||
if ! files_are_hardlinked "$f1" "$f2"; then
|
|
||||||
fatal "Files '$1' and '$2' are not hardlinked"
|
fatal "Files '$1' and '$2' are not hardlinked"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue