[igt-dev] [PATCH i-g-t] lib: Kill residual children at the end of a subtest

Petri Latvala petri.latvala at intel.com
Mon Feb 3 12:23:05 UTC 2020


On Mon, Feb 03, 2020 at 12:00:35PM +0000, Chris Wilson wrote:
> Quoting Petri Latvala (2020-02-03 11:50:07)
> > Care to beef up lib/tests/igt_fork.c to make sure this is all done
> > gracefully at subtest level, currently it only checks that the state
> > is sane at exit() time?
> 
> Something evil like:
> 
> pid_t *children = mmap(4096, SHARED);
> 
> igt_subtest() {
> 	igt_fork(child, 4096/sizeof(pid_t)) {
> 		children[child] = getpid();
> 	}
> 	/* leak the children */
> }
> 
> for (int i = 0; i < 4096/sizeof(pid_t); i++)
> 	assert(kill(children[i], 0) == -1);
> munmap(children, 4096);
> 
> Is that legal?

Do we need crazy? lib-tests get run on qemu'd mips and arm,
and anyway fork-bombing on gitlab is not very nice.

Otherwise looks exactly what we want to test.


-- 
Petri Latvala


More information about the igt-dev mailing list