运行所有测试
| 31 | |
| 32 | // 运行所有测试 |
| 33 | void run_all_tests() { |
| 34 | int passed_count = 0; |
| 35 | |
| 36 | rt_kprintf("Run tests...\n"); |
| 37 | for (int i = 0; i < test_count; i++) { |
| 38 | rt_err_t result = test_cases[i].func(); |
| 39 | test_cases[i].passed = result; |
| 40 | if (result == RT_EOK) { |
| 41 | rt_kprintf("[PASS] %s\n", test_cases[i].name); |
| 42 | passed_count++; |
| 43 | } else { |
| 44 | rt_kprintf("[FAIL] %s %d\n", test_cases[i].name, result); |
| 45 | } |
| 46 | } |
| 47 | #if defined(TARGET_ARMV8_AARCH64) |
| 48 | rt_kprintf("\n%s aarch64 test results: \n", BOARD_NAME); |
| 49 | #else |
| 50 | rt_kprintf("\n%s aarch32 test results: \n", BOARD_NAME); |
| 51 | #endif |
| 52 | rt_kprintf("PASS: %d / %d\n", passed_count, test_count); |
| 53 | if (passed_count < test_count) |
| 54 | { |
| 55 | rt_kprintf("[test_failure] example:\n"); |
| 56 | for (int i = 0; i < test_count; i++) { |
| 57 | if (test_cases[i].passed != RT_EOK) { |
| 58 | rt_kprintf(" - %s\n", test_cases[i].name); |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | else |
| 63 | { |
| 64 | rt_kprintf("[test_success]\n"); |
| 65 | } |
| 66 | rt_kprintf("[rtthread_test_end]\n"); |
| 67 | } |
| 68 | |
| 69 | int auto_test() { |
| 70 |
no test coverage detected