Page MenuHomeFreeBSD

tests/sys/audit: Skip extattr tests if extattrs are not supported

Authored by arichardson on Jan 28 2021, 9:47 AM.



In the CheriBSD CI, we run the testsuite with /tmp as tmpfs. This causes
the extattr audit tests to fail since tmpfs does not (yet) support
extattrs. Skip those tests if the target path is on a file system that
does not support extended file attributes.

While touching these two files also convert the ATF_REQUIRE_EQ(-1, checks

Test Plan

extattr tests are no longer listed as failures in cheribsd CI

Diff Detail

R10 FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

asomers requested changes to this revision.Jan 28 2021, 3:21 PM
asomers added inline comments.

Hard-coding the list of unsupported file systems is hard to maintain. Better if we can determine at runtime whether the file system under test supports extattrs. Adding a pathconf variable would be one way. Another way would be to attempt the test unconditionally, but call atf_tc_skip if one of the extattr syscalls returns EOPNOTSUPP (I"m just guessing that's what will happen on tmpfs; I don't know).


A test case marked as an expected failure indicates a bug that ought to be fixed. Your problem is that your setup isn't capable of running this test. So you should call atf_tc_skip instead. See for example the cap_enter_success test.


Where is atf_tc_fail_requirement defined?

This revision now requires changes to proceed.Jan 28 2021, 3:21 PM

Yes, they return EOPNOTSUPP. Checking for that return value sounds good to me.

I could add a basic extattr query call here and skip the entire test if it returns EOPNOTSUPP. That would avoid starting and stopping auditd.


I assumed that lack of extattr support in tmpfs is a temporary problem that will be fixed eventually rather than a fundamental design conflict. In that case the tests will report XPASS once it's implemented and the condition can be updated. It might make it more likely than skip that someone goes ahead and fixes it.

skip would have the benefit that the auditd startup/stop can be omitted though so maybe that's better.


It's the function that the ATF_REQUIRE() macros end up calling, defined in contrib/atf/atf-c/tc.h

Use skip and check for EOPNOTSUP instead of hardcoding filesystems

arichardson retitled this revision from tests/sys/audit: XFAIL extattr tests on tmpfs mounts to tests/sys/audit: Skip extattr tests if extattrs are not supported.Feb 1 2021, 12:01 PM
arichardson edited the summary of this revision. (Show Details)
asomers added inline comments.

But the purpose of these tests isn't to exercise tmpfs, it's to exercise audit. A lack of extattr support in the file system doesn't indicate any kind of trouble with audit. So better to skip.

This revision is now accepted and ready to land.Feb 1 2021, 4:11 PM