From: Jarkko Sakkinen <jarkko@kernel.org>
To: shuah@kernel.org
Cc: linux-kselftest@vger.kernel.org, linux-sgx@vger.kernel.org,
Reinette Chatre <reinette.chatre@intel.com>,
Jarkko Sakkinen <jarkko@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH v7 4/4] selftests/sgx: Add EXPECT_EEXIT() macro
Date: Wed, 26 May 2021 15:47:40 +0300 [thread overview]
Message-ID: <20210526124740.16783-4-jarkko@kernel.org> (raw)
In-Reply-To: <20210526124740.16783-1-jarkko@kernel.org>
Add EXPECT_EEXIT() macro, which will conditionally print the exception
information, in addition to
EXPECT_EQ(self->run.function, EEXIT);
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
---
tools/testing/selftests/sgx/main.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/sgx/main.c b/tools/testing/selftests/sgx/main.c
index d658882b5dd2..86d4283f9c61 100644
--- a/tools/testing/selftests/sgx/main.c
+++ b/tools/testing/selftests/sgx/main.c
@@ -207,6 +207,14 @@ static inline int encl_call(const void *in, void *out, struct sgx_enclave_run *r
return ret;
}
+#define EXPECT_EEXIT(run) \
+ do { \
+ EXPECT_EQ((run)->function, EEXIT); \
+ if ((run)->function != EEXIT) \
+ TH_LOG("0x%02x 0x%02x 0x%16llx", (run)->exception_vector, \
+ (run)->exception_error_code, (run)->exception_addr); \
+ } while (0)
+
TEST_F(enclave, unclobbered_vdso)
{
uint64_t result = 0;
@@ -214,7 +222,7 @@ TEST_F(enclave, unclobbered_vdso)
EXPECT_EQ(encl_call(&MAGIC, &result, &self->run, false), 0);
EXPECT_EQ(result, MAGIC);
- EXPECT_EQ(self->run.function, EEXIT);
+ EXPECT_EEXIT(&self->run);
EXPECT_EQ(self->run.user_data, 0);
}
@@ -225,7 +233,7 @@ TEST_F(enclave, clobbered_vdso)
EXPECT_EQ(encl_call(&MAGIC, &result, &self->run, true), 0);
EXPECT_EQ(result, MAGIC);
- EXPECT_EQ(self->run.function, EEXIT);
+ EXPECT_EEXIT(&self->run);
EXPECT_EQ(self->run.user_data, 0);
}
@@ -247,7 +255,7 @@ TEST_F(enclave, clobbered_vdso_and_user_function)
EXPECT_EQ(encl_call(&MAGIC, &result, &self->run, true), 0);
EXPECT_EQ(result, MAGIC);
- EXPECT_EQ(self->run.function, EEXIT);
+ EXPECT_EEXIT(&self->run);
EXPECT_EQ(self->run.user_data, 0);
}
--
2.31.1
next prev parent reply other threads:[~2021-05-26 12:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-26 12:47 [PATCH v7 1/4] selftests/sgx: Rename 'eenter' and 'sgx_call_vdso' Jarkko Sakkinen
2021-05-26 12:47 ` [PATCH v7 2/4] selftests/sgx: Migrate to kselftest harness Jarkko Sakkinen
2021-06-07 16:35 ` Reinette Chatre
2021-06-09 13:02 ` Jarkko Sakkinen
2021-05-26 12:47 ` [PATCH v7 3/4] selftests/sgx: Dump enclave memory map Jarkko Sakkinen
2021-05-26 12:47 ` Jarkko Sakkinen [this message]
2021-06-07 16:28 ` [PATCH v7 1/4] selftests/sgx: Rename 'eenter' and 'sgx_call_vdso' Reinette Chatre
2021-06-09 13:00 ` Jarkko Sakkinen
2021-06-09 21:02 ` Reinette Chatre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210526124740.16783-4-jarkko@kernel.org \
--to=jarkko@kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=reinette.chatre@intel.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).