Page MenuHomeFreeBSD

Fix test of ses(4) when there is no SES device exists
ClosedPublic

Authored by lwhsu on Jan 26 2022, 10:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 5, 9:57 PM
Unknown Object (File)
Oct 4 2024, 5:49 PM
Unknown Object (File)
Oct 3 2024, 3:22 PM
Unknown Object (File)
Sep 27 2024, 9:10 AM
Unknown Object (File)
Sep 24 2024, 3:19 AM
Unknown Object (File)
Sep 23 2024, 4:55 AM
Unknown Object (File)
Sep 12 2024, 7:03 PM
Unknown Object (File)
Sep 7 2024, 10:35 PM
Subscribers

Details

Summary

https://ci.freebsd.org/job/FreeBSD-main-amd64-test/20427/testReport/junit/sys.ses/destructive/setelmstat/
/usr/src/tests/sys/ses/destructive.c:57: r != 0

https://ci.freebsd.org/job/FreeBSD-main-amd64-test/20427/testReport/junit/sys.ses/destructive/setencstat/
/usr/src/tests/sys/ses/common.h:44: r != 0

glob(3) returns GLOB_NOMATCH if GLOB_NOCHECK or GLOB_NOMAGIC flag is not passed
so ATF_REQUIRE_EQ(r, 0) will cause a precondition check failure if no /dev/ses*
exists.

Remove calling of atf_tc_skip() in ATF_TC_CLEANUP() because it would let
the clean up procedure unfinish.

This patch calls glob(3) twice in each test case which is not optimal,
but I'd like to fix this first in CI. Maybe later we can change it to keep the
glob(3) result and then use in the rest of the test body.

Test Plan

cd /usr/tests/sys/ses && kyua test

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tests/sys/ses/destructive.c
87

The original git commit message was modified by phabricator, this and the following change is to fix a set-but-not-used warning while I'm here.

Thanks @lwhsu ! I was actually working on this myself at this very moment. But I see that you're ahead of me.

tests/sys/ses/destructive.c
56

Should you change the flags here, too?

tests/sys/ses/destructive.c
56

This one is only called after if (!has_ses()) check failed so /dev/ses* should exist, but changing this is no harm and unify the style so I think it's fine. Do you want me also change this?

lwhsu marked an inline comment as not done.Jan 26 2022, 10:54 PM
lwhsu added inline comments.
tests/sys/ses/destructive.c
56

hmm, if that's the case, then the following if (g.gl_matchc == 0) check is irrelevant, I think it's better to do defensive programming so I'll change the flag anyway.

tests/sys/ses/destructive.c
56

I would, just for consistency and defensiveness.

lwhsu marked an inline comment as not done.

Make call to glob(3) consistency and do defensive programming

This revision is now accepted and ready to land.Jan 26 2022, 11:06 PM