| 12 | } |
| 13 | |
| 14 | void execute() override |
| 15 | { |
| 16 | TEST_CASE("Heap") |
| 17 | { |
| 18 | REQUIRE_NEQ(system_get_free_heap_size(), 0); |
| 19 | } |
| 20 | |
| 21 | TEST_CASE("Identification") |
| 22 | { |
| 23 | REQUIRE_NEQ(String(system_get_sdk_version()), nullptr); |
| 24 | |
| 25 | auto chip_id = system_get_chip_id(); |
| 26 | REQUIRE_NEQ(chip_id, 0); |
| 27 | debug_i("chip_id = 0x%08x", chip_id); |
| 28 | } |
| 29 | |
| 30 | TEST_CASE("Clocks") |
| 31 | { |
| 32 | debug_i("CPU running at %u MHz", System.getCpuFrequency()); |
| 33 | } |
| 34 | |
| 35 | TEST_CASE("Watchdog functions available") |
| 36 | { |
| 37 | system_soft_wdt_stop(); |
| 38 | system_soft_wdt_restart(); |
| 39 | system_soft_wdt_feed(); |
| 40 | } |
| 41 | |
| 42 | #ifndef ARCH_HOST |
| 43 | TEST_CASE("System restart") |
| 44 | { |
| 45 | auto info = system_get_rst_info(); |
| 46 | REQUIRE_NEQ(uint32_t(info), 0); |
| 47 | debug_i("Reason 0x%08x", info->reason); |
| 48 | |
| 49 | switch(info->reason) { |
| 50 | case REASON_DEFAULT_RST: |
| 51 | debug_i("Hanging to check watchdog reboots system...\n\n"); |
| 52 | for(;;) { |
| 53 | } |
| 54 | break; |
| 55 | |
| 56 | case REASON_SOFT_WDT_RST: |
| 57 | debug_i("Reset by watchdog, rebooting...\n\n"); |
| 58 | System.restart(1000); |
| 59 | pending(); |
| 60 | break; |
| 61 | |
| 62 | case REASON_SOFT_RESTART: |
| 63 | debug_i("Reset by software. Continuing...\n\n"); |
| 64 | break; |
| 65 | |
| 66 | default: |
| 67 | // Could be exception, deep sleep, etc. |
| 68 | debug_i("Restarted for some other reason...\n\n"); |
| 69 | } |
| 70 | } |
| 71 | #endif |
nothing calls this directly
no test coverage detected