-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework devino caching to support invalidation if metadata changes #1170
Closed
Closed
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7a76821
tests/libtest.sh: always nuke repo and files
jlebon e73f709
lib/commit: don't query devino cache for modified files
jlebon 87a2947
fixup! lib/commit: don't query devino cache for modified files
jlebon 37a2fad
tests: check for relabeling rather than overlay
jlebon 3433694
fixup! tests: check for relabeling rather than overlay
jlebon 5cc1dc7
fixup! tests: check for relabeling rather than overlay
jlebon d1fa17c
tests/installed: also run test-basic-c
jlebon 9410a8f
fixup! tests/installed: also run test-basic-c
jlebon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,16 +70,44 @@ chmod -R u+w "${test_tmpdir}" | |
export TEST_GPG_KEYHOME=${test_tmpdir}/gpghome | ||
export OSTREE_GPG_HOME=${test_tmpdir}/gpghome/trusted | ||
|
||
# See comment in ot-builtin-commit.c and https://github.com/ostreedev/ostree/issues/758 | ||
# Also keep this in sync with the bits in libostreetest.c | ||
echo evaluating for overlayfs... | ||
case $(stat -f --printf '%T' /) in | ||
overlayfs) | ||
echo "overlayfs found; enabling OSTREE_NO_XATTRS" | ||
export OSTREE_SYSROOT_DEBUG="${OSTREE_SYSROOT_DEBUG},no-xattrs" | ||
export OSTREE_NO_XATTRS=1 ;; | ||
*) ;; | ||
esac | ||
_have_selinux_relabel='' | ||
have_selinux_relabel() { | ||
assert_has_setfattr | ||
if test "${_have_selinux_relabel}" = ''; then | ||
pushd ${test_tmpdir} | ||
echo testlabel > testlabel.txt | ||
selinux_xattr=security.selinux | ||
if getfattr --encoding=base64 -n ${selinux_xattr} testlabel.txt >label.txt 2>err.txt; then | ||
label=$(grep -E -e "^${selinux_xattr}=" < label.txt |sed -e "s,${selinux_xattr}=,,") | ||
if setfattr -n ${selinux_xattr} -v ${label} testlabel.txt 2>err.txt; then | ||
echo "SELinux enabled in $(pwd), and have privileges to relabel" | ||
_have_selinux_relabel=yes | ||
else | ||
sed -e 's/^/# /' < err.txt >&2 | ||
echo "Found SELinux label, but unable to set (Unprivileged Docker?)" | ||
_have_selinux_relabel=no | ||
fi | ||
else | ||
sed -e 's/^/# /' < err.txt >&2 | ||
echo "Unable to retrieve SELinux label, assuming disabled" | ||
_have_selinux_relabel=no | ||
fi | ||
popd | ||
fi | ||
test ${_have_selinux_relabel} = yes | ||
} | ||
|
||
# just globally turn off xattrs if we can't manipulate security xattrs; this is | ||
# the case for overlayfs -- really, we should only enforce this for tests that | ||
# use bare repos; separate from other tests that should check for user xattrs | ||
# support | ||
# see https://github.com/ostreedev/ostree/issues/758 | ||
# and https://github.com/ostreedev/ostree/pull/1217 | ||
echo -n checking for xattrs... | ||
if ! have_selinux_relabel; then | ||
export OSTREE_SYSROOT_DEBUG="${OSTREE_SYSROOT_DEBUG},no-xattrs" | ||
export OSTREE_NO_XATTRS=1 | ||
fi | ||
echo done | ||
|
||
if test -n "${OT_TESTS_DEBUG:-}"; then | ||
|
@@ -516,12 +544,15 @@ os_repository_new_commit () | |
cd ${test_tmpdir} | ||
} | ||
|
||
# Usage: if ! skip_one_without_user_xattrs; then ... more tests ...; fi | ||
_have_user_xattrs='' | ||
have_user_xattrs() { | ||
assert_has_setfattr() { | ||
if ! which setfattr 2>/dev/null; then | ||
fatal "no setfattr available to determine xattr support" | ||
fi | ||
} | ||
|
||
_have_user_xattrs='' | ||
have_user_xattrs() { | ||
assert_has_setfattr | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor, but maybe move the assertion below the test so we don't call it every time? |
||
if test "${_have_user_xattrs}" = ''; then | ||
touch test-xattrs | ||
if setfattr -n user.testvalue -v somevalue test-xattrs 2>/dev/null; then | ||
|
@@ -533,6 +564,8 @@ have_user_xattrs() { | |
fi | ||
test ${_have_user_xattrs} = yes | ||
} | ||
|
||
# Usage: if ! skip_one_without_user_xattrs; then ... more tests ...; fi | ||
skip_one_without_user_xattrs () { | ||
if ! have_user_xattrs; then | ||
echo "ok # SKIP - this test requires xattr support" | ||
|
@@ -554,21 +587,8 @@ skip_without_user_xattrs () { | |
# https://github.com/ostreedev/ostree/pull/759 | ||
# https://github.com/ostreedev/ostree/pull/1217 | ||
skip_without_no_selinux_or_relabel () { | ||
cd ${test_tmpdir} | ||
echo testlabel > testlabel.txt | ||
selinux_xattr=security.selinux | ||
if getfattr --encoding=base64 -n ${selinux_xattr} testlabel.txt >label.txt 2>err.txt; then | ||
label=$(grep -E -e "^${selinux_xattr}=" < label.txt |sed -e "s,${selinux_xattr}=,,") | ||
if setfattr -n ${selinux_xattr} -v ${label} testlabel.txt 2>err.txt; then | ||
echo "SELinux enabled in $(pwd), and have privileges to relabel" | ||
return 0 | ||
else | ||
sed -e 's/^/# /' < err.txt >&2 | ||
skip "Found SELinux label, but unable to set (Unprivileged Docker?)" | ||
fi | ||
else | ||
sed -e 's/^/# /' < err.txt >&2 | ||
skip "Unable to retrieve SELinux label, assuming disabled" | ||
if ! have_selinux_relabel; then | ||
skip "this test requires xattr support" | ||
fi | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm...not explicitly. I think it likely mostly works today, but I'm certain that e.g.
glnx_null_throw_errno_prefix()
might invokemalloc()
which can definitely make system calls... if we want to make that guarantee I think we'll need something more like systemd's_PROTECT_ERRNO
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, I forgot we do save it.