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

Petr Vorel pvorel@suse.cz
Tue Nov 29 14:36:42 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.

+1.

WDYT about .test_variants? In that case it'd be tested also on musl
or any platform where it's implemented.

Kind regards,
Petr


More information about the ltp mailing list