Create the test enclave inside each TEST_F(), instead of FIXTURE_SETUP(), so that the heap size can be defined per test. Signed-off-by: Jarkko Sakkinen <jarkko@xxxxxxxxxx> --- tools/testing/selftests/sgx/main.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/sgx/main.c b/tools/testing/selftests/sgx/main.c index 4fbe9856f775..f219768b4e9a 100644 --- a/tools/testing/selftests/sgx/main.c +++ b/tools/testing/selftests/sgx/main.c @@ -191,11 +191,6 @@ static bool setup_test_encl(unsigned long heap_size, struct encl *encl, FIXTURE_SETUP(enclave) { - if (!setup_test_encl(ENCL_HEAP_SIZE_DEFAULT, &self->encl, _metadata)) - ASSERT_TRUE(false); - - memset(&self->run, 0, sizeof(self->run)); - self->run.tcs = self->encl.encl_base; } FIXTURE_TEARDOWN(enclave) @@ -227,6 +222,12 @@ TEST_F(enclave, unclobbered_vdso) { struct encl_op op; + if (!setup_test_encl(ENCL_HEAP_SIZE_DEFAULT, &self->encl, _metadata)) + ASSERT_TRUE(false); + + memset(&self->run, 0, sizeof(self->run)); + self->run.tcs = self->encl.encl_base; + op.type = ENCL_OP_PUT; op.buffer = MAGIC; @@ -249,6 +250,12 @@ TEST_F(enclave, clobbered_vdso) { struct encl_op op; + if (!setup_test_encl(ENCL_HEAP_SIZE_DEFAULT, &self->encl, _metadata)) + ASSERT_TRUE(false); + + memset(&self->run, 0, sizeof(self->run)); + self->run.tcs = self->encl.encl_base; + op.type = ENCL_OP_PUT; op.buffer = MAGIC; @@ -279,6 +286,12 @@ TEST_F(enclave, clobbered_vdso_and_user_function) { struct encl_op op; + if (!setup_test_encl(ENCL_HEAP_SIZE_DEFAULT, &self->encl, _metadata)) + ASSERT_TRUE(false); + + memset(&self->run, 0, sizeof(self->run)); + self->run.tcs = self->encl.encl_base; + self->run.user_handler = (__u64)test_handler; self->run.user_data = 0xdeadbeef; -- 2.32.0