void main(void) #endif { int ret, ret_code; driver_init(); ret = bt_enable(NULL); if (ret == EXPECTED_ERROR) { ret_code = TC_PASS; } else { ret_code = TC_FAIL; } TC_END(ret_code, "%s - %s.\n", ret_code == TC_PASS ? PASS : FAIL, __func__); TC_END_REPORT(ret_code); }
void main(void) { int rv; /* return value from tests */ volatile int error; /* used to create a divide by zero error */ TC_START("Starting static IDT tests"); TC_PRINT("Testing to see if IDT has address of test stubs()\n"); rv = idt_stub_test(); if (rv != TC_PASS) { goto done_tests; } TC_PRINT("Testing to see interrupt handler executes properly\n"); _trigger_isr_handler(); if (int_handler_executed == 0) { TC_ERROR("Interrupt handler did not execute\n"); rv = TC_FAIL; goto done_tests; } else if (int_handler_executed != 1) { TC_ERROR("Interrupt handler executed more than once! (%d)\n", int_handler_executed); rv = TC_FAIL; goto done_tests; } TC_PRINT("Testing to see exception handler executes properly\n"); /* * Use exc_handler_executed instead of 0 to prevent the compiler issuing a * 'divide by zero' warning. */ error = 32; /* avoid static checker uninitialized warnings */ error = error / exc_handler_executed; if (exc_handler_executed == 0) { TC_ERROR("Exception handler did not execute\n"); rv = TC_FAIL; goto done_tests; } else if (exc_handler_executed != 1) { TC_ERROR("Exception handler executed more than once! (%d)\n", exc_handler_executed); rv = TC_FAIL; goto done_tests; } /* * Start task to trigger the spurious interrupt handler */ TC_PRINT("Testing to see spurious handler executes properly\n"); k_thread_spawn(my_stack_area, MY_STACK_SIZE, idt_spur_task, NULL, NULL, NULL, MY_PRIORITY, 0, K_NO_WAIT); /* * The fiber/task should not run past where the spurious interrupt is * generated. Therefore spur_handler_aborted_thread should remain at 1. */ if (spur_handler_aborted_thread == 0) { TC_ERROR("Spurious handler did not execute as expected\n"); rv = TC_FAIL; goto done_tests; } done_tests: TC_END(rv, "%s - %s.\n", rv == TC_PASS ? PASS : FAIL, __func__); TC_END_REPORT(rv); }