[PATCH v3 6/7] Implement testing framework for pidns
Dmitry V. Levin
ldv at altlinux.org
Sat Jul 25 22:17:55 UTC 2020
On Sat, Jul 25, 2020 at 01:12:42AM +0200, Ákos Uzonyi wrote:
> * tests/pidns.c: New file.
> * tests/pidns.h: New file.
> * tests/Makefile.am (libtests_a_SOURCES): Add pidns.c.
> * tests/init.sh (test_pidns, test_pidns_run_strace): New functions.
[...]
> + /* Create sleeping process to keep PID namespace alive */
> + pid_t pause_pid = fork();
> + if (!pause_pid) {
> + pause();
> + _exit(0);
> + }
Please check that fork hasn't failed here, too.
[...]
> + kill(pause_pid, SIGKILL);
> + while (wait(NULL) > 0);
> + if (errno != ECHILD)
> + perror_msg_and_fail("wait");
If you used a pipe for synchronization, there wouldn't be a need to kill
the process and wait for it - it would just read the EOF and die out
automatically.
> +/**
> + * Init pidns testing.
> + *
> + * Should be called at the beginning of the test's main function
> + *
> + * This function returns from a of child process that is in a new PID namespace.
> + */
> +void pidns_test_init(void);
Sorry, I've failed to understand where does this function returns from.
--
ldv
More information about the Strace-devel
mailing list