NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

misc/59357: t_semtimedop tests fail on kernels without SYSVSEM



>Number:         59357
>Category:       misc
>Synopsis:       t_semtimedop tests fail on kernels without SYSVSEM
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 26 12:15:00 +0000 2025
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The SemtimedopBSD Unimplementation
>Environment:
>Description:
kernel/t_semtimedop (103/985): 4 test cases
    semtimedop_basic: [4.947583s] Failed: Test program received signal 12 (core dumped)
    semtimedop_invalid: [3.325334s] Failed: Test program received signal 12 (core dumped)
    semtimedop_semundo: [0.030665s] Passed.
    semtimedop_timeout: [0.030409s] Failed: /usr/src/current/tests/kernel/t_semtimedop.c:151: WIFEXITED(status) not met
[8.349200s]
>How-To-Repeat:
cd /usr/tests/kernel
atf-run t_semtimedop | atf-report
>Fix:
Install a SIGSYS handler like t_sysv does to handle this case gracefully as atf_tc_skip rather than failure on signal.

    132 void
    133 sigsys_handler(int signo)
    134 {
    135 
    136 	did_sigsys = 1;
    137 }

https://nxr.netbsd.org/xref/src/tests/kernel/t_sysv.c?r=1.6#132

    413 	/*
    414 	 * Install a SIGSYS handler so that we can exit gracefully if
    415 	 * System V Semaphore support isn't in the kernel.
    416 	 */
    417 	did_sigsys = 0;
    418 	sa.sa_handler = sigsys_handler;
    419 	sigemptyset(&sa.sa_mask);
    420 	sa.sa_flags = 0;
    421 	ATF_REQUIRE_MSG(sigaction(SIGSYS, &sa, NULL) != -1,
    422 	    "sigaction SIGSYS: %d", errno);
    423 
    424 	semkey = get_ftok(4160);
    425 	ATF_REQUIRE_MSG(semkey != (key_t)-1, "get_ftok failed");
    426 
    427 	sender_semid = semget(semkey, 1, IPC_CREAT | 0640);
    428 	ATF_REQUIRE_MSG(sender_semid != -1, "semget: %d", errno);
    429 	write_int("sender_semid", sender_semid);
    430 
    431 	if (did_sigsys) {
    432 		atf_tc_skip("SYSV Semaphore not supported");
    433 		return;
    434 	}

https://nxr.netbsd.org/xref/src/tests/kernel/t_sysv.c?r=1.6#413

(There are probably other ways to do it like querying sysctl kern.ipc.sysvsem; this is just the mechanism that's already.)

And, while here, maybe just move the tests into t_sysv -- not sure why semtimedop is so different it requires being in a different test program from the semop tests; having them together strikes me as likely to be better for future maintenance to make it more obvious where all the applicable tests are.



Home | Main Index | Thread Index | Old Index