[LTP] [RFC PATCH 0/1] brk: use direct syscalls

Cyril Hrubis chrubis@suse.cz
Tue Nov 29 14:09:50 CET 2022


Hi!
> void verify_brk(void)
> {
> 	if (tst_variant) {
> 		tst_res(TINFO, "Testing sbrk()");
> 		cur_brk = (uintptr_t)sbrk(0);
> 	} else {
> 		tst_res(TINFO, "Testing __NR_brk");
> 		cur_brk = (void *)tst_syscall(__NR_brk, 0);
> 	}
> 
> }
> 
> struct tst_test test = {
> 	...
> #ifdef __GLIBC__
> 	.test_variants = 2,
> #else
> 	.test_variants = 1,
> #endif
> 	...
> 
> Not sure if it should be testeed also on android, i.e:
> #if defined(__GLIBC__) || defined(__ANDROID__)

Can we rather than ifdefing things out check the actual return values?

Should be as easy as doing:

	if (cur_brk == (void*)-1)
		tst_brk(TCONF, "sbrk() not implemented");

in the libc test variant.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list