[LTP] [PATCH v2] Add test case to cover the setting resource limit64 for process

Petr Vorel pvorel@suse.cz
Wed Feb 19 17:50:06 CET 2025


Hi 
> +	if (!pid) {
> +		TEST(setrlimit_u64(RLIMIT_CPU, rlim));
> +		if (TST_RET == -1) {
> +			tst_res(TFAIL | TTERRNO,
> +				"setrlimit_u64(RLIMIT_CPU) failed");
> +			exit(1);
> +		}
> +
> +		alarm(20);
> +
> +		while (1)

FYI we have TST_CHECKPOINT_WAKE() and others, please see
"1.9 Fork() and Parent-child synchronization" in doc/old/C-Test-API.asciidoc
or online
https://github.com/linux-test-project/ltp/blob/master/doc/old/C-Test-API.asciidoc#19-fork-and-parent-child-synchronization

(still not yet converted docs to sphinx)

Also worth to read if you have time (because people would put at least some usleep() instead of plain while(1);
https://people.kernel.org/metan/why-sleep-is-almost-never-acceptable-in-tests

Kind regards,
Petr

> +			;
> +	}
> +


More information about the ltp mailing list