diff options
author | Colin Walters <walters@verbum.org> | 2017-09-18 14:29:16 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-09-21 13:21:59 +0000 |
commit | 75150fe04a5dd830de87abfde99ce66ab9feb5a7 (patch) | |
tree | 58f49b016ad179330409b4fdd16b1e11864a375d /tests/libtest.sh | |
parent | 7a8511e0ca9c4e2441077ad0f2872c35a199eebe (diff) | |
download | ostree-75150fe04a5dd830de87abfde99ce66ab9feb5a7.tar.gz |
lib/repo: Don't syncfs or fsync() dirs if fsync opt is disabled
There are use cases for not syncing at all; think build cache repos, etc. Let's
be consistent here and make sure if fsync is disabled we do no sync at all.
I chose this opportunity to add tests using the shiny new strace fault
injection. I can forsee using this for a lot more things, so I made
the support for detecting things generic.
Related: https://github.com/ostreedev/ostree/issues/1184
Closes: #1186
Approved by: jlebon
Diffstat (limited to 'tests/libtest.sh')
-rwxr-xr-x | tests/libtest.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/libtest.sh b/tests/libtest.sh index 5017abea..2b30e654 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -543,6 +543,29 @@ skip_without_user_xattrs () { fi } +# https://brokenpi.pe/tools/strace-fault-injection +_have_strace_fault_injection='' +have_strace_fault_injection() { + if test "${_have_strace_fault_injection}" = ''; then + if strace -P ${test_srcdir}/libtest-core.sh -e inject=read:retval=0 cat ${test_srcdir}/libtest-core.sh >out.txt && + test '!' -s out.txt; then + _have_strace_fault_injection=yes + else + _have_strace_fault_injection=no + fi + rm -f out.txt + fi + test ${_have_strace_fault_injection} = yes +} + +skip_one_without_strace_fault_injection() { + if ! have_strace_fault_injection; then + echo "ok # SKIP this test requires strace fault injection" + return 0 + fi + return 1 +} + skip_without_fuse () { fusermount --version >/dev/null 2>&1 || skip "no fusermount" |