Enable exception test cases under simulation mode
This commit is contained in:
parent
b5a52fbaa4
commit
0252f98d60
@ -107,13 +107,10 @@ int occlum_pal_init(const struct occlum_pal_attr *attr) {
|
||||
goto on_destroy_enclave;
|
||||
}
|
||||
|
||||
// FIXME
|
||||
#ifndef SGX_MODE_SIM
|
||||
if (pal_interrupt_thread_start() < 0) {
|
||||
PAL_ERROR("Failed to start the interrupt thread: %s", errno2str(errno));
|
||||
goto on_destroy_enclave;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pal_run_init_process() < 0) {
|
||||
PAL_ERROR("Failed to run the init process: %s", errno2str(errno));
|
||||
@ -230,13 +227,10 @@ int occlum_pal_destroy(void) {
|
||||
|
||||
int ret = 0;
|
||||
|
||||
// FIXME
|
||||
#ifndef SGX_MODE_SIM
|
||||
if (pal_interrupt_thread_stop() < 0) {
|
||||
ret = -1;
|
||||
PAL_WARN("Cannot stop the interrupt thread: %s", errno2str(errno));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pal_destroy_enclave() < 0) {
|
||||
ret = -1;
|
||||
|
@ -130,14 +130,8 @@ int pal_init_enclave(const char *instance_dir) {
|
||||
}
|
||||
|
||||
int pal_destroy_enclave(void) {
|
||||
// FIXME: Due to lack of support for enclave interrupt in simulation mode, some programs
|
||||
// come across the problem that it can't exit when running in simulation mode. We have to
|
||||
// fallback to the old way to exit brutely in simulation mode.
|
||||
#ifndef SGX_MODE_SIM
|
||||
sgx_destroy_enclave(global_eid);
|
||||
global_eid = SGX_INVALID_ENCLAVE_ID;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -7,13 +7,10 @@
|
||||
#define SIGRT_INTERRUPT 64
|
||||
|
||||
int pal_register_sig_handlers(void) {
|
||||
// FIXME: enable interruptable signal in SIM mode
|
||||
#ifndef SGX_MODE_SIM
|
||||
if (signal(SIGRT_INTERRUPT, SIG_IGN) == SIG_ERR) {
|
||||
PAL_ERROR("Failed to regiter the SIG64 handler");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
|
||||
PAL_ERROR("Failed to regiter the SIGPIPE handler");
|
||||
|
@ -38,11 +38,6 @@ static void *futex_wait_thread_func(void *_) {
|
||||
|
||||
// exit_group syscall should terminate all threads in a thread group.
|
||||
int test_exit_group_to_force_threads_terminate(void) {
|
||||
#ifdef SGX_MODE_SIM
|
||||
printf("WARNING: Skip this test case as we do not support "
|
||||
"enclave interruption in SGX simulation mode\n");
|
||||
return 0;
|
||||
#else
|
||||
// Create three types of threads that will not exit voluntarily
|
||||
pthread_t busyloop_thread;
|
||||
if (pthread_create(&busyloop_thread, NULL, busyloop_thread_func, NULL) < 0) {
|
||||
@ -59,7 +54,6 @@ int test_exit_group_to_force_threads_terminate(void) {
|
||||
printf("ERROR: pthread_create failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Sleep for a while to make sure all three threads are running
|
||||
useconds_t half_second = 500 * 1000; // in us
|
||||
usleep(half_second);
|
||||
@ -68,7 +62,6 @@ int test_exit_group_to_force_threads_terminate(void) {
|
||||
// main function returns. If Occlum can terminate normally, this means
|
||||
// exit_group syscall taking effect.
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
@ -236,11 +236,6 @@ int div_maybe_zero(int x, int y) {
|
||||
#define fxsave(addr) __asm __volatile("fxsave %0" : "=m" (*(addr)))
|
||||
|
||||
int test_handle_sigfpe() {
|
||||
#ifdef SGX_MODE_SIM
|
||||
printf("WARNING: Skip this test case as we do not support "
|
||||
"capturing hardware exception in SGX simulation mode\n");
|
||||
return 0;
|
||||
#else
|
||||
// Set up a signal handler that handles divide-by-zero exception
|
||||
struct sigaction new_action, old_action;
|
||||
memset(&new_action, 0, sizeof(struct sigaction));
|
||||
@ -276,7 +271,6 @@ int test_handle_sigfpe() {
|
||||
THROW_ERROR("restoring old signal handler failed");
|
||||
}
|
||||
return 0;
|
||||
#endif /* SGX_MODE_SIM */
|
||||
}
|
||||
|
||||
|
||||
@ -301,11 +295,6 @@ static void handle_sigsegv(int num, siginfo_t *info, void *_context) {
|
||||
|
||||
|
||||
int test_handle_sigsegv() {
|
||||
#ifdef SGX_MODE_SIM
|
||||
printf("WARNING: Skip this test case as we do not support "
|
||||
"capturing hardware exception in SGX simulation mode\n");
|
||||
return 0;
|
||||
#else
|
||||
// Set up a signal handler that handles divide-by-zero exception
|
||||
struct sigaction new_action, old_action;
|
||||
memset(&new_action, 0, sizeof(struct sigaction));
|
||||
@ -329,7 +318,6 @@ int test_handle_sigsegv() {
|
||||
THROW_ERROR("restoring old signal handler failed");
|
||||
}
|
||||
return 0;
|
||||
#endif /* SGX_MODE_SIM */
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user