[sw/testing] subfoldered chip-level test framework code

This partially addresses #7976, specifically the item that states:
"{test_coverage,test_status,test_main}.{c,h} should be relocated to
sw/device/lib/testing/test_framework."

Signed-off-by: Timothy Trippel <ttrippel@google.com>
diff --git a/hw/top_englishbreakfast/util/sw_sources.patch b/hw/top_englishbreakfast/util/sw_sources.patch
index 3b20d12..471d960 100644
--- a/hw/top_englishbreakfast/util/sw_sources.patch
+++ b/hw/top_englishbreakfast/util/sw_sources.patch
@@ -159,7 +159,7 @@
      IGNORE_RESULT(dif_clkmgr_gateable_clock_set_enabled(
          &clkmgr, CLKMGR_CLK_ENABLES_CLK_USB_PERI_EN_BIT,
 diff --git a/sw/device/tests/dif/dif_aes_smoketest.c b/sw/device/tests/dif/dif_aes_smoketest.c
-index 70c3baaf9..5d69301e2 100644
+index 5b995c27f..0ce27b2f1 100644
 --- a/sw/device/tests/dif/dif_aes_smoketest.c
 +++ b/sw/device/tests/dif/dif_aes_smoketest.c
 @@ -7,7 +7,6 @@
@@ -167,7 +167,7 @@
  #include "sw/device/lib/runtime/log.h"
  #include "sw/device/lib/testing/check.h"
 -#include "sw/device/lib/testing/entropy_testutils.h"
- #include "sw/device/lib/testing/test_main.h"
+ #include "sw/device/lib/testing/test_framework/test_main.h"
 
  #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 @@ -67,9 +66,6 @@ bool test_main(void) {
diff --git a/sw/device/benchmarks/coremark/top_earlgrey/core_portme.c b/sw/device/benchmarks/coremark/top_earlgrey/core_portme.c
index 39c2f93..cf7d4da 100644
--- a/sw/device/benchmarks/coremark/top_earlgrey/core_portme.c
+++ b/sw/device/benchmarks/coremark/top_earlgrey/core_portme.c
@@ -11,10 +11,10 @@
 #include "sw/device/lib/base/stdasm.h"
 #include "sw/device/lib/dif/dif_uart.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_status.h"
+#include "sw/device/lib/testing/test_framework/test_status.h"
 #include "sw/vendor/eembc_coremark/coremark.h"
 
-#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"  // Generated.
+#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
 #if VALIDATION_RUN
 volatile ee_s32 seed1_volatile = 0x3415;
diff --git a/sw/device/boot_rom/boot_rom.c b/sw/device/boot_rom/boot_rom.c
index 53d4eb6..a365b47 100644
--- a/sw/device/boot_rom/boot_rom.c
+++ b/sw/device/boot_rom/boot_rom.c
@@ -15,7 +15,7 @@
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/runtime/print.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_status.h"
+#include "sw/device/lib/testing/test_framework/test_status.h"
 
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"  // Generated.
 
diff --git a/sw/device/examples/hello_world/hello_world.c b/sw/device/examples/hello_world/hello_world.c
index 60d291d..bc13462 100644
--- a/sw/device/examples/hello_world/hello_world.c
+++ b/sw/device/examples/hello_world/hello_world.c
@@ -12,9 +12,9 @@
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/runtime/print.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_status.h"
+#include "sw/device/lib/testing/test_framework/test_status.h"
 
-#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"  // Generated.
+#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
 static dif_gpio_t gpio;
 static dif_spi_device_t spi;
diff --git a/sw/device/lib/testing/check.h b/sw/device/lib/testing/check.h
index 279d8d6..ffc1954 100644
--- a/sw/device/lib/testing/check.h
+++ b/sw/device/lib/testing/check.h
@@ -11,7 +11,7 @@
 #include "sw/device/lib/base/memory.h"
 #include "sw/device/lib/runtime/hart.h"
 #include "sw/device/lib/runtime/log.h"
-#include "sw/device/lib/testing/test_status.h"
+#include "sw/device/lib/testing/test_framework/test_status.h"
 
 /**
  * Runtime assertion macros with log.h integration.
diff --git a/sw/device/lib/testing/meson.build b/sw/device/lib/testing/meson.build
index f52b904..a87ec3d 100644
--- a/sw/device/lib/testing/meson.build
+++ b/sw/device/lib/testing/meson.build
@@ -2,18 +2,6 @@
 # Licensed under the Apache License, Version 2.0, see LICENSE for details.
 # SPDX-License-Identifier: Apache-2.0
 
-# Test status library.
-sw_lib_testing_test_status = declare_dependency(
-  link_with: static_library(
-    'test_status_ot',
-    sources: ['test_status.c'],
-    dependencies: [
-      sw_lib_mmio,
-      sw_lib_runtime_log,
-      sw_lib_runtime_hart,
-    ],
-  )
-)
 
 # hardware entropy complex (entropy_src, csrng, edn) test utilities.
 sw_lib_testing_entropy_testutils_lib = declare_dependency(
@@ -38,56 +26,7 @@
   link_with: static_library(
     'random_ot',
     sources: ['random.c'],
-    dependencies: [
-      sw_lib_testing_test_status,
-    ],
   )
 )
 
-# NOP coverage dependencies when coverage is not enabled.
-sw_lib_testing_test_coverage = declare_dependency(
-  link_with: static_library(
-    'test_coverage_none',
-    sources: [files('test_coverage_none.c')],
-  ),
-)
-collect_coverage = declare_dependency()
-
-if coverage
-  # Test coverage library that provides runtime functions for LLVM profiling.
-  sw_lib_testing_test_coverage = declare_dependency(
-    link_with: static_library(
-      'test_coverage_llvm',
-      include_directories: sw_vendor_llvm_clang_rt_inc_dir,
-      sources: [
-        sw_vendor_llvm_clang_rt_sources,
-        files('test_coverage_llvm.c'),
-      ],
-      dependencies: [
-        sw_lib_mem,
-        sw_lib_dif_uart,
-        sw_lib_runtime_log,
-      ],
-    ),
-  )
-
-  # Dependency for enabling coverage
-  collect_coverage = declare_dependency(
-    compile_args: ['-fprofile-instr-generate', '-fcoverage-mapping'],
-    dependencies: sw_lib_testing_test_coverage,
-  )
-endif
-
-sw_lib_testing_test_main = declare_dependency(
-  link_with: static_library(
-    'test_main_ot',
-    sources: ['test_main.c'],
-    dependencies: [
-      sw_lib_runtime_log,
-      sw_lib_runtime_print,
-      sw_lib_dif_uart,
-      sw_lib_testing_test_status,
-      sw_lib_testing_test_coverage,
-    ],
-  )
-)
+subdir('test_framework')
diff --git a/sw/device/lib/testing/test_framework/meson.build b/sw/device/lib/testing/test_framework/meson.build
new file mode 100644
index 0000000..78e3c3b
--- /dev/null
+++ b/sw/device/lib/testing/test_framework/meson.build
@@ -0,0 +1,64 @@
+# Copyright lowRISC contributors.
+# Licensed under the Apache License, Version 2.0, see LICENSE for details.
+# SPDX-License-Identifier: Apache-2.0
+
+# Test status library.
+sw_lib_testing_test_status = declare_dependency(
+  link_with: static_library(
+    'test_status_ot',
+    sources: ['test_status.c'],
+    dependencies: [
+      sw_lib_mmio,
+      sw_lib_runtime_log,
+      sw_lib_runtime_hart,
+    ],
+  )
+)
+
+# NOP coverage dependencies when coverage is not enabled.
+sw_lib_testing_test_coverage = declare_dependency(
+  link_with: static_library(
+    'test_coverage_none',
+    sources: [files('test_coverage_none.c')],
+  ),
+)
+collect_coverage = declare_dependency()
+
+if coverage
+  # Test coverage library that provides runtime functions for LLVM profiling.
+  sw_lib_testing_test_coverage = declare_dependency(
+    link_with: static_library(
+      'test_coverage_llvm',
+      include_directories: sw_vendor_llvm_clang_rt_inc_dir,
+      sources: [
+        sw_vendor_llvm_clang_rt_sources,
+        files('test_coverage_llvm.c'),
+      ],
+      dependencies: [
+        sw_lib_mem,
+        sw_lib_dif_uart,
+        sw_lib_runtime_log,
+      ],
+    ),
+  )
+
+  # Dependency for enabling coverage
+  collect_coverage = declare_dependency(
+    compile_args: ['-fprofile-instr-generate', '-fcoverage-mapping'],
+    dependencies: sw_lib_testing_test_coverage,
+  )
+endif
+
+sw_lib_testing_test_main = declare_dependency(
+  link_with: static_library(
+    'test_main_ot',
+    sources: ['test_main.c'],
+    dependencies: [
+      sw_lib_runtime_log,
+      sw_lib_runtime_print,
+      sw_lib_dif_uart,
+      sw_lib_testing_test_status,
+      sw_lib_testing_test_coverage,
+    ],
+  )
+)
diff --git a/sw/device/lib/testing/test_coverage.h b/sw/device/lib/testing/test_framework/test_coverage.h
similarity index 66%
rename from sw/device/lib/testing/test_coverage.h
rename to sw/device/lib/testing/test_framework/test_coverage.h
index 1352df7..773e06c 100644
--- a/sw/device/lib/testing/test_coverage.h
+++ b/sw/device/lib/testing/test_framework/test_coverage.h
@@ -2,8 +2,8 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 
-#ifndef OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_COVERAGE_H_
-#define OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_COVERAGE_H_
+#ifndef OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_FRAMEWORK_TEST_COVERAGE_H_
+#define OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_FRAMEWORK_TEST_COVERAGE_H_
 
 /**
  * Sends the LLVM profile buffer along with its length and CRC32.
@@ -14,4 +14,4 @@
  */
 void test_coverage_send_buffer(void);
 
-#endif  // OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_COVERAGE_H_
+#endif  // OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_FRAMEWORK_TEST_COVERAGE_H_
diff --git a/sw/device/lib/testing/test_coverage_llvm.c b/sw/device/lib/testing/test_framework/test_coverage_llvm.c
similarity index 97%
rename from sw/device/lib/testing/test_coverage_llvm.c
rename to sw/device/lib/testing/test_framework/test_coverage_llvm.c
index 96f6f92..6206120 100644
--- a/sw/device/lib/testing/test_coverage_llvm.c
+++ b/sw/device/lib/testing/test_framework/test_coverage_llvm.c
@@ -2,9 +2,10 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 
-#include "sw/device/lib/testing/test_coverage.h"
 #include <stdint.h>
+
 #include "sw/device/lib/runtime/log.h"
+#include "sw/device/lib/testing/test_framework/test_coverage.h"
 #include "sw/device/lib/uart.h"
 #include "sw/vendor/llvm_clang_rt_profile/compiler-rt/lib/profile/InstrProfiling.h"
 
diff --git a/sw/device/lib/testing/test_coverage_none.c b/sw/device/lib/testing/test_framework/test_coverage_none.c
similarity index 83%
rename from sw/device/lib/testing/test_coverage_none.c
rename to sw/device/lib/testing/test_framework/test_coverage_none.c
index 67af8f0..d8fb49d 100644
--- a/sw/device/lib/testing/test_coverage_none.c
+++ b/sw/device/lib/testing/test_framework/test_coverage_none.c
@@ -2,7 +2,7 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 
-#include "sw/device/lib/testing/test_coverage.h"
+#include "sw/device/lib/testing/test_framework/test_coverage.h"
 
 // This NOP function gets linked in when coverage is disabled. See
 // `test_coverage_llvm.c` for its actual definition when coverage is enabled.
diff --git a/sw/device/lib/testing/test_main.c b/sw/device/lib/testing/test_framework/test_main.c
similarity index 89%
rename from sw/device/lib/testing/test_main.c
rename to sw/device/lib/testing/test_framework/test_main.c
index 313e52f..7b87826 100644
--- a/sw/device/lib/testing/test_main.c
+++ b/sw/device/lib/testing/test_framework/test_main.c
@@ -2,15 +2,15 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
 #include "sw/device/lib/arch/device.h"
 #include "sw/device/lib/dif/dif_uart.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/runtime/print.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_coverage.h"
-#include "sw/device/lib/testing/test_status.h"
+#include "sw/device/lib/testing/test_framework/test_coverage.h"
+#include "sw/device/lib/testing/test_framework/test_status.h"
 
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"  // Generated.
 
diff --git a/sw/device/lib/testing/test_main.h b/sw/device/lib/testing/test_framework/test_main.h
similarity index 89%
rename from sw/device/lib/testing/test_main.h
rename to sw/device/lib/testing/test_framework/test_main.h
index dd86eb8..48fbe69 100644
--- a/sw/device/lib/testing/test_main.h
+++ b/sw/device/lib/testing/test_framework/test_main.h
@@ -2,8 +2,8 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 
-#ifndef OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_MAIN_H_
-#define OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_MAIN_H_
+#ifndef OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_FRAMEWORK_TEST_MAIN_H_
+#define OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_FRAMEWORK_TEST_MAIN_H_
 
 #include <stdbool.h>
 
@@ -58,4 +58,4 @@
  */
 extern bool test_main(void);
 
-#endif  // OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_MAIN_H_
+#endif  // OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_FRAMEWORK_TEST_MAIN_H_
diff --git a/sw/device/lib/testing/test_status.c b/sw/device/lib/testing/test_framework/test_status.c
similarity index 94%
rename from sw/device/lib/testing/test_status.c
rename to sw/device/lib/testing/test_framework/test_status.c
index 9f87753..ebd94f7 100644
--- a/sw/device/lib/testing/test_status.c
+++ b/sw/device/lib/testing/test_framework/test_status.c
@@ -2,7 +2,7 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 
-#include "sw/device/lib/testing/test_status.h"
+#include "sw/device/lib/testing/test_framework/test_status.h"
 
 #include "sw/device/lib/arch/device.h"
 #include "sw/device/lib/base/mmio.h"
diff --git a/sw/device/lib/testing/test_status.h b/sw/device/lib/testing/test_framework/test_status.h
similarity index 92%
rename from sw/device/lib/testing/test_status.h
rename to sw/device/lib/testing/test_framework/test_status.h
index 04723eb..099c8e4 100644
--- a/sw/device/lib/testing/test_status.h
+++ b/sw/device/lib/testing/test_framework/test_status.h
@@ -2,8 +2,8 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 
-#ifndef OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_STATUS_H_
-#define OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_STATUS_H_
+#ifndef OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_FRAMEWORK_TEST_STATUS_H_
+#define OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_FRAMEWORK_TEST_STATUS_H_
 
 /**
  * Indicates the status of the software running on the CPU, from a testing
@@ -76,4 +76,4 @@
  */
 void test_status_set(test_status_t test_status);
 
-#endif  // OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_STATUS_H_
+#endif  // OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_FRAMEWORK_TEST_STATUS_H_
diff --git a/sw/device/riscv_compliance_support/support.c b/sw/device/riscv_compliance_support/support.c
index 5db9593..a9d74d0 100644
--- a/sw/device/riscv_compliance_support/support.c
+++ b/sw/device/riscv_compliance_support/support.c
@@ -8,9 +8,9 @@
 #include "sw/device/lib/dif/dif_uart.h"
 #include "sw/device/lib/runtime/print.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_status.h"
+#include "sw/device/lib/testing/test_framework/test_status.h"
 
-#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"  // Generated.
+#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
 // These symbopls are provided by the riscv-compliance libraries.
 extern void run_rvc_test(void);
diff --git a/sw/device/silicon_creator/lib/test_main.h b/sw/device/silicon_creator/lib/test_main.h
index 61c38b0..efb7e48 100644
--- a/sw/device/silicon_creator/lib/test_main.h
+++ b/sw/device/silicon_creator/lib/test_main.h
@@ -4,8 +4,9 @@
 
 #ifndef OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_TEST_MAIN_H_
 #define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_TEST_MAIN_H_
+
 #include "sw/device/lib/runtime/log.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 #include "sw/device/silicon_creator/lib/error.h"
 
 /**
diff --git a/sw/device/silicon_creator/mask_rom/mask_rom_epmp_test.c b/sw/device/silicon_creator/mask_rom/mask_rom_epmp_test.c
index a70cbcd..46c358c 100644
--- a/sw/device/silicon_creator/mask_rom/mask_rom_epmp_test.c
+++ b/sw/device/silicon_creator/mask_rom/mask_rom_epmp_test.c
@@ -15,7 +15,7 @@
 #include "sw/device/lib/runtime/hart.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/runtime/print.h"
-#include "sw/device/lib/testing/test_status.h"
+#include "sw/device/lib/testing/test_framework/test_status.h"
 #include "sw/device/silicon_creator/lib/base/abs_mmio.h"
 #include "sw/device/silicon_creator/lib/drivers/uart.h"
 #include "sw/device/silicon_creator/lib/epmp_test_unlock.h"
diff --git a/sw/device/tests/coverage_test.c b/sw/device/tests/coverage_test.c
index b9d9ba9..dfdbd6f 100644
--- a/sw/device/tests/coverage_test.c
+++ b/sw/device/tests/coverage_test.c
@@ -9,8 +9,8 @@
 #include "sw/device/lib/runtime/hart.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/runtime/print.h"
-#include "sw/device/lib/testing/test_coverage.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_coverage.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
 static void spin_45(uint8_t state) {
   static const char kSpinnerChars[] = "|/-\\";
diff --git a/sw/device/tests/crt_test.c b/sw/device/tests/crt_test.c
index 60d6d81..384e36f 100644
--- a/sw/device/tests/crt_test.c
+++ b/sw/device/tests/crt_test.c
@@ -12,9 +12,9 @@
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/runtime/print.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_status.h"
+#include "sw/device/lib/testing/test_framework/test_status.h"
 
-#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"  // Generated.
+#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
 // Symbols defined in sw/device/exts/common/flash_link.ld, which we use to
 // check that the CRT did what it was supposed to.
diff --git a/sw/device/tests/dif/dif_aes_smoketest.c b/sw/device/tests/dif/dif_aes_smoketest.c
index 70c3baa..5b995c2 100644
--- a/sw/device/tests/dif/dif_aes_smoketest.c
+++ b/sw/device/tests/dif/dif_aes_smoketest.c
@@ -8,7 +8,7 @@
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
 #include "sw/device/lib/testing/entropy_testutils.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
diff --git a/sw/device/tests/dif/dif_aon_timer_smoketest.c b/sw/device/tests/dif/dif_aon_timer_smoketest.c
index 8312451..4dbaabd 100644
--- a/sw/device/tests/dif/dif_aon_timer_smoketest.c
+++ b/sw/device/tests/dif/dif_aon_timer_smoketest.c
@@ -8,7 +8,7 @@
 #include "sw/device/lib/runtime/hart.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
diff --git a/sw/device/tests/dif/dif_clkmgr_smoketest.c b/sw/device/tests/dif/dif_clkmgr_smoketest.c
index 088e0d2..c7ce522 100644
--- a/sw/device/tests/dif/dif_clkmgr_smoketest.c
+++ b/sw/device/tests/dif/dif_clkmgr_smoketest.c
@@ -5,9 +5,9 @@
 #include "sw/device/lib/base/memory.h"
 #include "sw/device/lib/dif/dif_clkmgr.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
-#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"  // Generated.
+#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
 const test_config_t kTestConfig;
 
diff --git a/sw/device/tests/dif/dif_csrng_smoketest.c b/sw/device/tests/dif/dif_csrng_smoketest.c
index a9642f8..53bf047 100644
--- a/sw/device/tests/dif/dif_csrng_smoketest.c
+++ b/sw/device/tests/dif/dif_csrng_smoketest.c
@@ -7,9 +7,9 @@
 #include "sw/device/lib/dif/dif_csrng.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
-#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"  // Generated.
+#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
 const test_config_t kTestConfig;
 
diff --git a/sw/device/tests/dif/dif_entropy_src_smoketest.c b/sw/device/tests/dif/dif_entropy_src_smoketest.c
index 09ab54b..b4d4d1a 100644
--- a/sw/device/tests/dif/dif_entropy_src_smoketest.c
+++ b/sw/device/tests/dif/dif_entropy_src_smoketest.c
@@ -7,9 +7,9 @@
 #include "sw/device/lib/dif/dif_entropy_src.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
-#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"  // Generated.
+#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
 const test_config_t kTestConfig;
 
diff --git a/sw/device/tests/dif/dif_gpio_smoketest.c b/sw/device/tests/dif/dif_gpio_smoketest.c
index 6f35acc..7c9e259 100644
--- a/sw/device/tests/dif/dif_gpio_smoketest.c
+++ b/sw/device/tests/dif/dif_gpio_smoketest.c
@@ -2,15 +2,14 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 
-#include "sw/device/lib/dif/dif_gpio.h"
-
 #include "sw/device/lib/base/memory.h"
 #include "sw/device/lib/base/mmio.h"
+#include "sw/device/lib/dif/dif_gpio.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
-#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"  // Generated.
+#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
 static dif_gpio_t gpio;
 const test_config_t kTestConfig;
diff --git a/sw/device/tests/dif/dif_hmac_smoketest.c b/sw/device/tests/dif/dif_hmac_smoketest.c
index 0e1ef72..efa986e 100644
--- a/sw/device/tests/dif/dif_hmac_smoketest.c
+++ b/sw/device/tests/dif/dif_hmac_smoketest.c
@@ -10,7 +10,7 @@
 #include "sw/device/lib/flash_ctrl.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
diff --git a/sw/device/tests/dif/dif_kmac_cshake_smoketest.c b/sw/device/tests/dif/dif_kmac_cshake_smoketest.c
index 2bc9100..65169e9 100644
--- a/sw/device/tests/dif/dif_kmac_cshake_smoketest.c
+++ b/sw/device/tests/dif/dif_kmac_cshake_smoketest.c
@@ -9,7 +9,7 @@
 #include "sw/device/lib/flash_ctrl.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
diff --git a/sw/device/tests/dif/dif_kmac_kmac_smoketest.c b/sw/device/tests/dif/dif_kmac_kmac_smoketest.c
index 4a7949e..ab755ea 100644
--- a/sw/device/tests/dif/dif_kmac_kmac_smoketest.c
+++ b/sw/device/tests/dif/dif_kmac_kmac_smoketest.c
@@ -9,7 +9,7 @@
 #include "sw/device/lib/flash_ctrl.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
diff --git a/sw/device/tests/dif/dif_kmac_smoketest.c b/sw/device/tests/dif/dif_kmac_smoketest.c
index 50f330a..3d7e56c 100644
--- a/sw/device/tests/dif/dif_kmac_smoketest.c
+++ b/sw/device/tests/dif/dif_kmac_smoketest.c
@@ -9,7 +9,7 @@
 #include "sw/device/lib/flash_ctrl.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
diff --git a/sw/device/tests/dif/dif_otbn_smoketest.c b/sw/device/tests/dif/dif_otbn_smoketest.c
index 112e6b4..ed49dbe 100644
--- a/sw/device/tests/dif/dif_otbn_smoketest.c
+++ b/sw/device/tests/dif/dif_otbn_smoketest.c
@@ -8,7 +8,7 @@
 #include "sw/device/lib/runtime/otbn.h"
 #include "sw/device/lib/testing/check.h"
 #include "sw/device/lib/testing/entropy_testutils.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
diff --git a/sw/device/tests/dif/dif_otp_ctrl_smoketest.c b/sw/device/tests/dif/dif_otp_ctrl_smoketest.c
index 2dd0eef..c83d25a 100644
--- a/sw/device/tests/dif/dif_otp_ctrl_smoketest.c
+++ b/sw/device/tests/dif/dif_otp_ctrl_smoketest.c
@@ -10,7 +10,7 @@
 #include "sw/device/lib/dif/dif_otp_ctrl.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
diff --git a/sw/device/tests/dif/dif_pwrmgr_smoketest.c b/sw/device/tests/dif/dif_pwrmgr_smoketest.c
index 290e02b..a317889 100644
--- a/sw/device/tests/dif/dif_pwrmgr_smoketest.c
+++ b/sw/device/tests/dif/dif_pwrmgr_smoketest.c
@@ -7,9 +7,9 @@
 #include "sw/device/lib/dif/dif_pwrmgr.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
-#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"  // Generated.
+#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
 static const dif_pwrmgr_wakeup_reason_t kWakeUpReasonTest = {
     .types = kDifPwrmgrWakeupTypeRequest,
diff --git a/sw/device/tests/dif/dif_rstmgr_smoketest.c b/sw/device/tests/dif/dif_rstmgr_smoketest.c
index 3f846b1..1811471 100644
--- a/sw/device/tests/dif/dif_rstmgr_smoketest.c
+++ b/sw/device/tests/dif/dif_rstmgr_smoketest.c
@@ -5,9 +5,9 @@
 #include "sw/device/lib/base/mmio.h"
 #include "sw/device/lib/dif/dif_rstmgr.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
-#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"  // Generated.
+#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
 static dif_rstmgr_t rstmgr;
 
diff --git a/sw/device/tests/dif/dif_rv_plic_smoketest.c b/sw/device/tests/dif/dif_rv_plic_smoketest.c
index c96a70b..87ed8d4 100644
--- a/sw/device/tests/dif/dif_rv_plic_smoketest.c
+++ b/sw/device/tests/dif/dif_rv_plic_smoketest.c
@@ -10,10 +10,10 @@
 #include "sw/device/lib/runtime/hart.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
-#include "sw/device/lib/testing/test_status.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_status.h"
 
-#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"  // Generated.
+#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
 static const uint32_t kPlicTarget = kTopEarlgreyPlicTargetIbex0;
 
diff --git a/sw/device/tests/dif/dif_rv_timer_smoketest.c b/sw/device/tests/dif/dif_rv_timer_smoketest.c
index f72abf8..b79fe34 100644
--- a/sw/device/tests/dif/dif_rv_timer_smoketest.c
+++ b/sw/device/tests/dif/dif_rv_timer_smoketest.c
@@ -3,14 +3,14 @@
 // SPDX-License-Identifier: Apache-2.0
 
 #include "sw/device/lib/dif/dif_rv_timer.h"
-
 #include "sw/device/lib/handler.h"
 #include "sw/device/lib/irq.h"
 #include "sw/device/lib/runtime/hart.h"
 #include "sw/device/lib/runtime/ibex.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
+
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
 static dif_rv_timer_t timer;
diff --git a/sw/device/tests/dif/dif_uart_smoketest.c b/sw/device/tests/dif/dif_uart_smoketest.c
index 93dd4dd..16d5704 100644
--- a/sw/device/tests/dif/dif_uart_smoketest.c
+++ b/sw/device/tests/dif/dif_uart_smoketest.c
@@ -2,15 +2,14 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 
-#include "sw/device/lib/dif/dif_uart.h"
-
 #include "sw/device/lib/arch/device.h"
 #include "sw/device/lib/base/mmio.h"
+#include "sw/device/lib/dif/dif_uart.h"
 #include "sw/device/lib/runtime/hart.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
-#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"  // Generated.
+#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
 static const uint8_t kSendData[] = "Smoke test!";
 
diff --git a/sw/device/tests/flash_ctrl_test.c b/sw/device/tests/flash_ctrl_test.c
index b4089d9..921db77 100644
--- a/sw/device/tests/flash_ctrl_test.c
+++ b/sw/device/tests/flash_ctrl_test.c
@@ -8,7 +8,7 @@
 #include "sw/device/lib/base/mmio.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
 #define CHECK_ARRAYS_EQ(xs, ys, len) \
   do {                               \
diff --git a/sw/device/tests/lc_ctrl_otp_hw_cfg_test.c b/sw/device/tests/lc_ctrl_otp_hw_cfg_test.c
index 3dc8771..b2ace4a 100644
--- a/sw/device/tests/lc_ctrl_otp_hw_cfg_test.c
+++ b/sw/device/tests/lc_ctrl_otp_hw_cfg_test.c
@@ -12,7 +12,7 @@
 #include "sw/device/lib/dif/dif_otp_ctrl.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
diff --git a/sw/device/tests/otbn/otbn_ecdsa_p256_test.c b/sw/device/tests/otbn/otbn_ecdsa_p256_test.c
index 663243f..1233809 100644
--- a/sw/device/tests/otbn/otbn_ecdsa_p256_test.c
+++ b/sw/device/tests/otbn/otbn_ecdsa_p256_test.c
@@ -8,7 +8,7 @@
 #include "sw/device/lib/runtime/otbn.h"
 #include "sw/device/lib/testing/check.h"
 #include "sw/device/lib/testing/entropy_testutils.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
diff --git a/sw/device/tests/otbn/otbn_randomness_test.c b/sw/device/tests/otbn/otbn_randomness_test.c
index 0734607..6af0d73 100644
--- a/sw/device/tests/otbn/otbn_randomness_test.c
+++ b/sw/device/tests/otbn/otbn_randomness_test.c
@@ -8,7 +8,7 @@
 #include "sw/device/lib/runtime/otbn.h"
 #include "sw/device/lib/testing/check.h"
 #include "sw/device/lib/testing/entropy_testutils.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
diff --git a/sw/device/tests/otbn/otbn_rsa_test.c b/sw/device/tests/otbn/otbn_rsa_test.c
index 0f4e7e9..ca4dab7 100644
--- a/sw/device/tests/otbn/otbn_rsa_test.c
+++ b/sw/device/tests/otbn/otbn_rsa_test.c
@@ -8,7 +8,7 @@
 #include "sw/device/lib/runtime/otbn.h"
 #include "sw/device/lib/testing/check.h"
 #include "sw/device/lib/testing/entropy_testutils.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
diff --git a/sw/device/tests/pmp_smoketest_napot.c b/sw/device/tests/pmp_smoketest_napot.c
index 98bb7e9..361f9a1 100644
--- a/sw/device/tests/pmp_smoketest_napot.c
+++ b/sw/device/tests/pmp_smoketest_napot.c
@@ -8,8 +8,8 @@
 #include "sw/device/lib/runtime/hart.h"
 #include "sw/device/lib/runtime/pmp.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
-#include "sw/device/lib/testing/test_status.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_status.h"
 
 #define PMP_LOAD_REGION_ID 0
 
diff --git a/sw/device/tests/pmp_smoketest_tor.c b/sw/device/tests/pmp_smoketest_tor.c
index 6e2a900..5bfc20e 100644
--- a/sw/device/tests/pmp_smoketest_tor.c
+++ b/sw/device/tests/pmp_smoketest_tor.c
@@ -8,8 +8,8 @@
 #include "sw/device/lib/runtime/hart.h"
 #include "sw/device/lib/runtime/pmp.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
-#include "sw/device/lib/testing/test_status.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_status.h"
 
 /**
  * PMP regions that are used for load/store and execution permission violation
diff --git a/sw/device/tests/sim_dv/gpio_test.c b/sw/device/tests/sim_dv/gpio_test.c
index 23b5562..5af444b 100644
--- a/sw/device/tests/sim_dv/gpio_test.c
+++ b/sw/device/tests/sim_dv/gpio_test.c
@@ -12,8 +12,8 @@
 #include "sw/device/lib/runtime/hart.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
-#include "sw/device/lib/testing/test_status.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_status.h"
 
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
diff --git a/sw/device/tests/sim_dv/lc_ctrl_transition_test.c b/sw/device/tests/sim_dv/lc_ctrl_transition_test.c
index b31e452..6ec9087 100644
--- a/sw/device/tests/sim_dv/lc_ctrl_transition_test.c
+++ b/sw/device/tests/sim_dv/lc_ctrl_transition_test.c
@@ -11,7 +11,7 @@
 #include "sw/device/lib/dif/dif_lc_ctrl.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
diff --git a/sw/device/tests/sim_dv/pwrmgr_usbdev_smoketest.c b/sw/device/tests/sim_dv/pwrmgr_usbdev_smoketest.c
index e2ba18a..112da6b 100644
--- a/sw/device/tests/sim_dv/pwrmgr_usbdev_smoketest.c
+++ b/sw/device/tests/sim_dv/pwrmgr_usbdev_smoketest.c
@@ -16,10 +16,10 @@
 #include "sw/device/lib/dif/dif_pwrmgr.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 #include "sw/device/lib/usbdev.h"
 
-#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"  // Generated.
+#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
 static dif_pwrmgr_t pwrmgr;
 
diff --git a/sw/device/tests/sim_dv/spi_tx_rx_test.c b/sw/device/tests/sim_dv/spi_tx_rx_test.c
index d6214f9..8ce51ce 100644
--- a/sw/device/tests/sim_dv/spi_tx_rx_test.c
+++ b/sw/device/tests/sim_dv/spi_tx_rx_test.c
@@ -11,8 +11,8 @@
 #include "sw/device/lib/runtime/hart.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
-#include "sw/device/lib/testing/test_status.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_status.h"
 
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
diff --git a/sw/device/tests/sim_dv/uart_tx_rx_test.c b/sw/device/tests/sim_dv/uart_tx_rx_test.c
index a3437d7..69cb51d 100644
--- a/sw/device/tests/sim_dv/uart_tx_rx_test.c
+++ b/sw/device/tests/sim_dv/uart_tx_rx_test.c
@@ -11,8 +11,8 @@
 #include "sw/device/lib/runtime/hart.h"
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
-#include "sw/device/lib/testing/test_status.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_status.h"
 
 #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
 
diff --git a/sw/device/tests/usbdev_test.c b/sw/device/tests/usbdev_test.c
index daf261b..96c7d57 100644
--- a/sw/device/tests/usbdev_test.c
+++ b/sw/device/tests/usbdev_test.c
@@ -22,7 +22,7 @@
 #include "sw/device/lib/runtime/log.h"
 #include "sw/device/lib/runtime/print.h"
 #include "sw/device/lib/testing/check.h"
-#include "sw/device/lib/testing/test_main.h"
+#include "sw/device/lib/testing/test_framework/test_main.h"
 #include "sw/device/lib/usb_controlep.h"
 #include "sw/device/lib/usb_simpleserial.h"
 
@@ -33,9 +33,12 @@
     USB_CFG_DSCR_HEAD(
         USB_CFG_DSCR_LEN + 2 * (USB_INTERFACE_DSCR_LEN + 2 * USB_EP_DSCR_LEN),
         2),
-    VEND_INTERFACE_DSCR(0, 2, 0x50, 1), USB_BULK_EP_DSCR(0, 1, 32, 0),
-    USB_BULK_EP_DSCR(1, 1, 32, 4), VEND_INTERFACE_DSCR(1, 2, 0x50, 1),
-    USB_BULK_EP_DSCR(0, 2, 32, 0), USB_BULK_EP_DSCR(1, 2, 32, 4),
+    VEND_INTERFACE_DSCR(0, 2, 0x50, 1),
+    USB_BULK_EP_DSCR(0, 1, 32, 0),
+    USB_BULK_EP_DSCR(1, 1, 32, 4),
+    VEND_INTERFACE_DSCR(1, 2, 0x50, 1),
+    USB_BULK_EP_DSCR(0, 2, 32, 0),
+    USB_BULK_EP_DSCR(1, 2, 32, 4),
 };
 
 /**