brk is disabled in purecap so in normal operation the test would be skipped by LTP. If that is not the case, guarantee the test will fail.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com --- testcases/kernel/syscalls/brk/brk01.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/testcases/kernel/syscalls/brk/brk01.c b/testcases/kernel/syscalls/brk/brk01.c index c16b46eaa..5157a5605 100644 --- a/testcases/kernel/syscalls/brk/brk01.c +++ b/testcases/kernel/syscalls/brk/brk01.c @@ -9,7 +9,19 @@ #include <errno.h>
#include "tst_test.h" +#include "lapi/syscalls.h"
+#ifdef __CHERI_PURE_CAPABILITY__ +void verify_brk(void) +{ + /* + * tst_syscall skips the test if the syscall returns -ENOSYS, + * which is the expected behavior in purecap. + */ + tst_syscall(__NR_brk, 0); + tst_res(TFAIL, "brk should not be implemented in purecap"); +} +#else void verify_brk(void) { uintptr_t cur_brk, new_brk; @@ -65,6 +77,7 @@ void verify_brk(void)
tst_res(TPASS, "brk() works fine"); } +#endif /* __CHERI_PURE_CAPABILITY__ */
static struct tst_test test = { .test_all = verify_brk,