MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / run_all_tests

Function run_all_tests

bsp/phytium/libraries/drivers_example/auto_test.c:33–67  ·  view source on GitHub ↗

运行所有测试

Source from the content-addressed store, hash-verified

31
32// 运行所有测试
33void 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
69int auto_test() {
70

Callers 1

auto_testFunction · 0.85

Calls 2

rt_kprintfFunction · 0.85
funcMethod · 0.80

Tested by

no test coverage detected