Page MenuHomeFreeBSD

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

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

Details

Summary

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
to use ATF_REQURIE_ERRNO().

Test Plan

extattr tests are no longer listed as failures in cheribsd CI

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
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.
tests/sys/audit/utils.c
217

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).

218

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.

tests/sys/audit/utils.h
46

Where is atf_tc_fail_requirement defined?

This revision now requires changes to proceed.Jan 28 2021, 3:21 PM
tests/sys/audit/utils.c
217

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.

218

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.

tests/sys/audit/utils.h
46

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.Mon, Feb 1, 12:01 PM
arichardson edited the summary of this revision. (Show Details)
asomers added inline comments.
tests/sys/audit/utils.c
218

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.Mon, Feb 1, 4:11 PM