On Wed, Oct 19, 2022 at 12:45:27PM +0100, Teo Couprie Diaz wrote:
On 18/10/2022 17:09, Tudor Cretu wrote:
On 18-10-2022 09:46, Teo Couprie Diaz wrote:
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.
Add brk01 and brk02 to the morello_transitional_extended list.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com
runtest/morello_transitional_extended | 2 ++ testcases/kernel/syscalls/brk/brk01.c | 13 +++++++++++++ 2 files changed, 15 insertions(+)
diff --git a/runtest/morello_transitional_extended b/runtest/morello_transitional_extended index 067fe82da..8ddab7095 100644 --- a/runtest/morello_transitional_extended +++ b/runtest/morello_transitional_extended @@ -1,5 +1,7 @@ #DESCRIPTION: Morello transitional extended ABI system calls +brk01 brk02
epoll_create01 epoll_create01 epoll_create02 epoll_create02 epoll_create1_01 epoll_create1_01 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");
Maybe I am too back and forth on this topic, in which case I apologize! Just wanted to leave this here: an alternative would be to make the brk tests pass actively, something like:
TST_EXP_FAIL(syscall(__NR_brk, 0), ENOSYS, "brk is not implemented in purecap");
Again, up to you really.
I didn't really have any preference, but I just realised that tst_syscall's return is an int. It always worked while testing but it could very much not if the address is large enough. So I guess the best solution would be to use syscall directly anyway and bypass LTP's utility function, which would make it a PASS in purecap and not a SKIP.
That sounds very much sensible. Aside: having tst_syscall using int for the syscall return value might be problematic in either cases as well - might be worth to actually modify that one ? Anyways for this particular case it might be enough to simply use syscall directly without any wrappers, as suggested.
--- BR B.
Thanks, Tudor
Thanks, Téo
+} +#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,
linux-morello-ltp mailing list -- linux-morello-ltp@op-lists.linaro.org To unsubscribe send an email to linux-morello-ltp-leave@op-lists.linaro.org