Page MenuHomeFreeBSD

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

Authored by arichardson on Jan 28 2021, 9:47 AM.
Tags
None
Referenced Files
F81672425: D28392.diff
Fri, Apr 19, 6:01 PM
Unknown Object (File)
Feb 22 2024, 4:50 AM
Unknown Object (File)
Feb 16 2024, 4:19 PM
Unknown Object (File)
Dec 23 2023, 6:12 AM
Unknown Object (File)
Dec 20 2023, 5:05 AM
Unknown Object (File)
Dec 12 2023, 9:39 AM
Unknown Object (File)
Dec 3 2023, 6:02 AM
Unknown Object (File)
Oct 12 2023, 3:51 PM
Subscribers

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
rG FreeBSD src repository
Lint
Lint Not Applicable
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
218

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

219

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
47

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
218

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.

219

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
47

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.
tests/sys/audit/utils.c
219

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