diff options
-rw-r--r-- | board/hatch_fp/build.mk | 1 | ||||
-rw-r--r-- | board/nocturne_fp/build.mk | 1 | ||||
-rw-r--r-- | board/nucleo-dartmonkey/build.mk | 1 | ||||
-rw-r--r-- | test/fpsensor.c | 15 | ||||
-rw-r--r-- | test/fpsensor.mocklist | 14 | ||||
-rw-r--r-- | test/fpsensor.tasklist | 8 | ||||
-rwxr-xr-x | test/run_device_tests.py | 2 |
7 files changed, 30 insertions, 12 deletions
diff --git a/board/hatch_fp/build.mk b/board/hatch_fp/build.mk index 2e40d585fc..8ebf3199a6 100644 --- a/board/hatch_fp/build.mk +++ b/board/hatch_fp/build.mk @@ -17,6 +17,7 @@ test-list-y=\ crc32 \ flash_physical \ flash_write_protect \ + fpsensor \ mpu \ mutex \ pingpong \ diff --git a/board/nocturne_fp/build.mk b/board/nocturne_fp/build.mk index fca1dc62e3..d850938af8 100644 --- a/board/nocturne_fp/build.mk +++ b/board/nocturne_fp/build.mk @@ -18,6 +18,7 @@ test-list-y=\ crc32 \ flash_physical \ flash_write_protect \ + fpsensor \ mpu \ mutex \ pingpong \ diff --git a/board/nucleo-dartmonkey/build.mk b/board/nucleo-dartmonkey/build.mk index 4d39121edc..10a696e49a 100644 --- a/board/nucleo-dartmonkey/build.mk +++ b/board/nucleo-dartmonkey/build.mk @@ -14,6 +14,7 @@ test-list-y=\ aes \ compile_time_macros \ crc32 \ + fpsensor \ mutex \ pingpong \ rsa \ diff --git a/test/fpsensor.c b/test/fpsensor.c index eddbda5110..11c08c7a23 100644 --- a/test/fpsensor.c +++ b/test/fpsensor.c @@ -27,8 +27,15 @@ test_static int test_validate_fp_buffer_offset_failure_overflow(void) void run_test(int argc, char **argv) { - RUN_TEST(test_validate_fp_buffer_offset_success); - RUN_TEST(test_validate_fp_buffer_offset_failure_no_overflow); - RUN_TEST(test_validate_fp_buffer_offset_failure_overflow); - test_print_result(); + if (IS_ENABLED(HAS_TASK_FPSENSOR)) { + /* TODO(b/171924356): The "emulator" build only builds RO and + * the functions used in the tests are only in RW, so these + * tests are not run on the emulator. + */ + RUN_TEST(test_validate_fp_buffer_offset_success); + RUN_TEST(test_validate_fp_buffer_offset_failure_no_overflow); + RUN_TEST(test_validate_fp_buffer_offset_failure_overflow); + test_print_result(); + return; + } } diff --git a/test/fpsensor.mocklist b/test/fpsensor.mocklist index 990dd92c45..7f1a89ef9a 100644 --- a/test/fpsensor.mocklist +++ b/test/fpsensor.mocklist @@ -3,10 +3,12 @@ * found in the LICENSE file. */ - #define CONFIG_TEST_MOCK_LIST \ - MOCK(FP_SENSOR) \ - MOCK(FPSENSOR_DETECT) \ - MOCK(FPSENSOR_STATE) \ - MOCK(MKBP_EVENTS) \ - MOCK(ROLLBACK) \ +#ifdef BOARD_HOST +#define CONFIG_TEST_MOCK_LIST \ + MOCK(FP_SENSOR) \ + MOCK(FPSENSOR_DETECT) \ + MOCK(FPSENSOR_STATE) \ + MOCK(MKBP_EVENTS) \ + MOCK(ROLLBACK) \ MOCK(TIMER) +#endif /* BOARD_HOST */ diff --git a/test/fpsensor.tasklist b/test/fpsensor.tasklist index bee999ff6b..ba137b7613 100644 --- a/test/fpsensor.tasklist +++ b/test/fpsensor.tasklist @@ -6,6 +6,10 @@ /** * See CONFIG_TASK_LIST in config.h for details. */ -#define CONFIG_TEST_TASK_LIST \ - TASK_TEST(FPSENSOR, fp_task_simulate, NULL, TASK_STACK_SIZE) +#define CONFIG_TEST_TASK_LIST +#ifdef BOARD_HOST +#undef CONFIG_TEST_TASK_LIST +#define CONFIG_TEST_TASK_LIST \ + TASK_TEST(FPSENSOR, fp_task_simulate, NULL, TASK_STACK_SIZE) +#endif diff --git a/test/run_device_tests.py b/test/run_device_tests.py index d8a5db5664..c236974af0 100755 --- a/test/run_device_tests.py +++ b/test/run_device_tests.py @@ -114,6 +114,8 @@ class AllTests: TestConfig(name='flash_write_protect', image_to_use=ImageType.RO, toggle_power=True, enable_hw_write_protect=True), + 'fpsensor': + TestConfig(name='fpsensor'), 'mpu_ro': TestConfig(name='mpu', image_to_use=ImageType.RO, |