summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/tutorial/part3.md2
-rw-r--r--tests/Makefile.inc3
-rw-r--r--tests/acpi/acpigen-test.c2
-rw-r--r--tests/commonlib/bsd/helpers-test.c2
-rw-r--r--tests/commonlib/region-test.c2
-rw-r--r--tests/console/routing-test.c2
-rw-r--r--tests/device/ddr4-test.c2
-rw-r--r--tests/device/i2c-test.c2
-rw-r--r--tests/include/tests/test.h7
-rw-r--r--tests/lib/b64_decode-test.c2
-rw-r--r--tests/lib/bootmem-test.c2
-rw-r--r--tests/lib/cbmem_console-test.c8
-rw-r--r--tests/lib/cbmem_stage_cache-test.c2
-rw-r--r--tests/lib/compute_ip_checksum-test.c2
-rw-r--r--tests/lib/coreboot_table-test.c2
-rw-r--r--tests/lib/crc_byte-test.c2
-rw-r--r--tests/lib/dimm_info_util-test.c2
-rw-r--r--tests/lib/edid-test.c2
-rw-r--r--tests/lib/fmap-test.c2
-rw-r--r--tests/lib/hexstrtobin-test.c2
-rw-r--r--tests/lib/imd-test.c2
-rw-r--r--tests/lib/imd_cbmem-test.c2
-rw-r--r--tests/lib/libgcc-test.c2
-rw-r--r--tests/lib/list-test.c2
-rw-r--r--tests/lib/malloc-test.c2
-rw-r--r--tests/lib/memchr-test.c2
-rw-r--r--tests/lib/memcmp-test.c2
-rw-r--r--tests/lib/memcpy-test.c2
-rw-r--r--tests/lib/memmove-test.c2
-rw-r--r--tests/lib/memrange-test.c6
-rw-r--r--tests/lib/memset-test.c2
-rw-r--r--tests/lib/region_file-test.c5
-rw-r--r--tests/lib/rtc-test.c2
-rw-r--r--tests/lib/spd_cache-test.c2
-rw-r--r--tests/lib/stack-test.c2
-rw-r--r--tests/lib/string-test.c2
-rw-r--r--tests/lib/timestamp-test.c2
-rw-r--r--tests/lib/uuid-test.c2
38 files changed, 48 insertions, 47 deletions
diff --git a/Documentation/tutorial/part3.md b/Documentation/tutorial/part3.md
index 7cdf7d9f21..dc487182c1 100644
--- a/Documentation/tutorial/part3.md
+++ b/Documentation/tutorial/part3.md
@@ -381,6 +381,6 @@ invoking Cmocka test are described
cmocka_unit_test(i2c_read_field_test),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
```
diff --git a/tests/Makefile.inc b/tests/Makefile.inc
index 2f73cb3f75..fa5faab973 100644
--- a/tests/Makefile.inc
+++ b/tests/Makefile.inc
@@ -136,7 +136,8 @@ $$($(1)-config-file): $(TEST_KCONFIG_AUTOHEADER)
printf '#endif\n' >> $$@;
$($(1)-objs): TEST_CFLAGS += -I$$(dir $$($(1)-config-file)) \
- -D__$$(shell echo $$($(1)-stage) | tr '[:lower:]' '[:upper:]')__
+ -D__$$(shell echo $$($(1)-stage) | tr '[:lower:]' '[:upper:]')__ \
+ -D__TEST_NAME__=\"$(1)\"
# Give us a way to distinguish between coreboot source files and test files in code.
$($(1)-srcobjs): TEST_CFLAGS += -D__TEST_SRCOBJ__
diff --git a/tests/acpi/acpigen-test.c b/tests/acpi/acpigen-test.c
index 369ff29001..6bd1d02689 100644
--- a/tests/acpi/acpigen-test.c
+++ b/tests/acpi/acpigen-test.c
@@ -213,5 +213,5 @@ int main(void)
setup_acpigen, teardown_acpigen),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/commonlib/bsd/helpers-test.c b/tests/commonlib/bsd/helpers-test.c
index 324c901b12..6fae331fd7 100644
--- a/tests/commonlib/bsd/helpers-test.c
+++ b/tests/commonlib/bsd/helpers-test.c
@@ -51,5 +51,5 @@ int main(void)
cmocka_unit_test(test_retry),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/commonlib/region-test.c b/tests/commonlib/region-test.c
index fab5961173..59f272a7d9 100644
--- a/tests/commonlib/region-test.c
+++ b/tests/commonlib/region-test.c
@@ -404,5 +404,5 @@ int main(void)
cmocka_unit_test(test_mem_rdev),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/console/routing-test.c b/tests/console/routing-test.c
index ea90342999..153ca77c19 100644
--- a/tests/console/routing-test.c
+++ b/tests/console/routing-test.c
@@ -66,5 +66,5 @@ int main(void)
teardown_console_log_level),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/device/ddr4-test.c b/tests/device/ddr4-test.c
index 0a9831da75..3ee1e79f1d 100644
--- a/tests/device/ddr4-test.c
+++ b/tests/device/ddr4-test.c
@@ -37,5 +37,5 @@ int main(void)
cmocka_unit_test(ddr4_speed_mhz_to_mts_test)
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/device/i2c-test.c b/tests/device/i2c-test.c
index 2c9423052e..010b8688f9 100644
--- a/tests/device/i2c-test.c
+++ b/tests/device/i2c-test.c
@@ -164,5 +164,5 @@ int main(void)
cmocka_unit_test(i2c_write_field_test)
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/include/tests/test.h b/tests/include/tests/test.h
index 14dc7c781a..523f8fafe9 100644
--- a/tests/include/tests/test.h
+++ b/tests/include/tests/test.h
@@ -36,4 +36,11 @@
TEST_SYMBOL(_e##region, _##region + size); \
TEST_SYMBOL(_##region##_size, size)
+/* Wrapper for running cmocka test groups using name provided by build system in __TEST_NAME__
+ This should be used instead of cmocka_run_group_tests(). If there is a need to use custom
+ group name, then please use cmocka_run_group_tests_name(). */
+#define cb_run_group_tests(group_tests, group_setup, group_teardown) \
+ cmocka_run_group_tests_name((__TEST_NAME__ "(" #group_tests ")"), group_tests, \
+ group_setup, group_teardown)
+
#endif /* _TESTS_TEST_H */
diff --git a/tests/lib/b64_decode-test.c b/tests/lib/b64_decode-test.c
index e6bbca50ee..631dc15f7d 100644
--- a/tests/lib/b64_decode-test.c
+++ b/tests/lib/b64_decode-test.c
@@ -57,5 +57,5 @@ int main(void)
cmocka_unit_test(test_b64_decode),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/bootmem-test.c b/tests/lib/bootmem-test.c
index b571ccbb51..60598336a0 100644
--- a/tests/lib/bootmem-test.c
+++ b/tests/lib/bootmem-test.c
@@ -411,5 +411,5 @@ int main(void)
cmocka_unit_test(test_bootmem_region_targets_type)
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/cbmem_console-test.c b/tests/lib/cbmem_console-test.c
index 604ca7a77b..fca84a7bd4 100644
--- a/tests/lib/cbmem_console-test.c
+++ b/tests/lib/cbmem_console-test.c
@@ -118,12 +118,6 @@ void test_cbmemc_tx_byte_overflow(void **state)
int main(void)
{
-#if ENV_ROMSTAGE_OR_BEFORE
- const char *test_name = "cbmem_console-test-romstage";
-#else
- const char *test_name = "cbmem_console-test-ramstage";
-#endif
-
const struct CMUnitTest tests[] = {
cmocka_unit_test_teardown(test_cbmemc_init, teardown_cbmemc),
cmocka_unit_test_setup_teardown(test_cbmemc_tx_byte,
@@ -132,5 +126,5 @@ int main(void)
setup_cbmemc, teardown_cbmemc),
};
- return cmocka_run_group_tests_name(test_name, tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/cbmem_stage_cache-test.c b/tests/lib/cbmem_stage_cache-test.c
index 24ba095420..8a07e6fabe 100644
--- a/tests/lib/cbmem_stage_cache-test.c
+++ b/tests/lib/cbmem_stage_cache-test.c
@@ -190,5 +190,5 @@ int main(void)
setup_test, teardown_test),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/compute_ip_checksum-test.c b/tests/lib/compute_ip_checksum-test.c
index fb6743945c..18e7ff0f84 100644
--- a/tests/lib/compute_ip_checksum-test.c
+++ b/tests/lib/compute_ip_checksum-test.c
@@ -98,5 +98,5 @@ int main(void)
cmocka_unit_test(test_add_ip_checksums),
};
- return cmocka_run_group_tests(tests, setup_test_group, NULL);
+ return cb_run_group_tests(tests, setup_test_group, NULL);
}
diff --git a/tests/lib/coreboot_table-test.c b/tests/lib/coreboot_table-test.c
index ba3e63d84b..7668941243 100644
--- a/tests/lib/coreboot_table-test.c
+++ b/tests/lib/coreboot_table-test.c
@@ -493,5 +493,5 @@ int main(void)
teardown_write_tables_test),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/crc_byte-test.c b/tests/lib/crc_byte-test.c
index 12934bcfcf..86249420c8 100644
--- a/tests/lib/crc_byte-test.c
+++ b/tests/lib/crc_byte-test.c
@@ -296,5 +296,5 @@ int main(void)
cmocka_unit_test(test_crc32_byte_static_data),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/dimm_info_util-test.c b/tests/lib/dimm_info_util-test.c
index a698fc51c2..4b3f979d2b 100644
--- a/tests/lib/dimm_info_util-test.c
+++ b/tests/lib/dimm_info_util-test.c
@@ -108,5 +108,5 @@ int main(void)
cmocka_unit_test(test_smbios_form_factor_to_spd_mod_type),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/edid-test.c b/tests/lib/edid-test.c
index 0da7c61853..73ce4ecaf7 100644
--- a/tests/lib/edid-test.c
+++ b/tests/lib/edid-test.c
@@ -1267,6 +1267,6 @@ int main(void)
teardown_edid_test),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/fmap-test.c b/tests/lib/fmap-test.c
index 444af5a705..044c3121a9 100644
--- a/tests/lib/fmap-test.c
+++ b/tests/lib/fmap-test.c
@@ -302,5 +302,5 @@ int main(void)
setup_fmap, teardown_fmap),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/hexstrtobin-test.c b/tests/lib/hexstrtobin-test.c
index 46ad3dffe1..f096b9b9e7 100644
--- a/tests/lib/hexstrtobin-test.c
+++ b/tests/lib/hexstrtobin-test.c
@@ -44,5 +44,5 @@ int main(void)
cmocka_unit_test(test_hexstrtobin),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/imd-test.c b/tests/lib/imd-test.c
index c2bcf0cd2d..6da1ac926c 100644
--- a/tests/lib/imd-test.c
+++ b/tests/lib/imd-test.c
@@ -759,6 +759,6 @@ int main(void)
cmocka_unit_test(test_imd_cursor_next),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/imd_cbmem-test.c b/tests/lib/imd_cbmem-test.c
index f857579960..1a1756c9d3 100644
--- a/tests/lib/imd_cbmem-test.c
+++ b/tests/lib/imd_cbmem-test.c
@@ -626,5 +626,5 @@ int main(void)
setup_teardown_test_imd_cbmem),
};
- return cmocka_run_group_tests(tests, setup_group_imd_cbmem, teardown_group_imd_cbmem);
+ return cb_run_group_tests(tests, setup_group_imd_cbmem, teardown_group_imd_cbmem);
}
diff --git a/tests/lib/libgcc-test.c b/tests/lib/libgcc-test.c
index 3bdd145134..d089f646b9 100644
--- a/tests/lib/libgcc-test.c
+++ b/tests/lib/libgcc-test.c
@@ -128,5 +128,5 @@ int main(void)
cmocka_unit_test(test_clzsi2_with_data),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/list-test.c b/tests/lib/list-test.c
index 6688c4faeb..309346abec 100644
--- a/tests/lib/list-test.c
+++ b/tests/lib/list-test.c
@@ -125,5 +125,5 @@ int main(void)
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/malloc-test.c b/tests/lib/malloc-test.c
index b70de06ae1..452d74f888 100644
--- a/tests/lib/malloc-test.c
+++ b/tests/lib/malloc-test.c
@@ -164,5 +164,5 @@ int main(void)
cmocka_unit_test_setup(test_calloc_memory_is_zeroed, setup_calloc_test),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/memchr-test.c b/tests/lib/memchr-test.c
index 9762b9a7e4..eadabc7c9d 100644
--- a/tests/lib/memchr-test.c
+++ b/tests/lib/memchr-test.c
@@ -101,5 +101,5 @@ int main(void)
cmocka_unit_test(test_memchr_zero_size),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/memcmp-test.c b/tests/lib/memcmp-test.c
index f45b7f43ff..59ca86c0cb 100644
--- a/tests/lib/memcmp-test.c
+++ b/tests/lib/memcmp-test.c
@@ -69,5 +69,5 @@ int main(void)
cmocka_unit_test(test_memcmp_zero_size),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/memcpy-test.c b/tests/lib/memcpy-test.c
index 842a5f01e2..f4f6e185a6 100644
--- a/tests/lib/memcpy-test.c
+++ b/tests/lib/memcpy-test.c
@@ -192,5 +192,5 @@ int main(void)
setup_test, teardown_test),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/memmove-test.c b/tests/lib/memmove-test.c
index a1d33cf445..87cace9c6a 100644
--- a/tests/lib/memmove-test.c
+++ b/tests/lib/memmove-test.c
@@ -245,6 +245,6 @@ int main(void)
setup_test, teardown_test),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/memrange-test.c b/tests/lib/memrange-test.c
index f9e6056d35..1bdd62e028 100644
--- a/tests/lib/memrange-test.c
+++ b/tests/lib/memrange-test.c
@@ -629,10 +629,10 @@ int main(void)
cmocka_unit_test(test_memrange_add_resources_filter),
};
- return cmocka_run_group_tests_name("Boundary on 4GiB",
+ return cmocka_run_group_tests_name(__TEST_NAME__"(Boundary on 4GiB)",
tests, setup_test_1, NULL) +
- cmocka_run_group_tests_name("Boundaries 1 byte from 4GiB",
+ cmocka_run_group_tests_name(__TEST_NAME__"(Boundaries 1 byte from 4GiB)",
tests, setup_test_2, NULL) +
- cmocka_run_group_tests_name("Range over 4GiB boundary",
+ cmocka_run_group_tests_name(__TEST_NAME__"(Range over 4GiB boundary)",
tests, setup_test_3, NULL);
}
diff --git a/tests/lib/memset-test.c b/tests/lib/memset-test.c
index 7d888a68e1..bdc3cb3104 100644
--- a/tests/lib/memset-test.c
+++ b/tests/lib/memset-test.c
@@ -116,5 +116,5 @@ int main(void)
setup_test, teardown_test),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/region_file-test.c b/tests/lib/region_file-test.c
index aeeaa4efcb..98c4eb650b 100644
--- a/tests/lib/region_file-test.c
+++ b/tests/lib/region_file-test.c
@@ -325,7 +325,6 @@ int main(void)
setup_teardown_region_file_test),
};
- return cmocka_run_group_tests(tests,
- setup_region_file_test_group,
- teardown_region_file_test_group);
+ return cb_run_group_tests(tests, setup_region_file_test_group,
+ teardown_region_file_test_group);
}
diff --git a/tests/lib/rtc-test.c b/tests/lib/rtc-test.c
index d58011d128..e9415714a5 100644
--- a/tests/lib/rtc-test.c
+++ b/tests/lib/rtc-test.c
@@ -308,5 +308,5 @@ int main(void)
cmocka_unit_test(test_leap_day_secday),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/spd_cache-test.c b/tests/lib/spd_cache-test.c
index 4bc0a3dcfe..4f75690979 100644
--- a/tests/lib/spd_cache-test.c
+++ b/tests/lib/spd_cache-test.c
@@ -253,5 +253,5 @@ int main(void)
#endif
};
- return cmocka_run_group_tests(tests, setup_spd_cache, teardown_spd_cache);
+ return cb_run_group_tests(tests, setup_spd_cache, teardown_spd_cache);
}
diff --git a/tests/lib/stack-test.c b/tests/lib/stack-test.c
index bed59aaa76..1f671f39cb 100644
--- a/tests/lib/stack-test.c
+++ b/tests/lib/stack-test.c
@@ -129,5 +129,5 @@ int main(void)
cmocka_unit_test_setup(test_incorrectly_initialized_stack, setup_stack_test),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/string-test.c b/tests/lib/string-test.c
index 7718547c70..0f21747e11 100644
--- a/tests/lib/string-test.c
+++ b/tests/lib/string-test.c
@@ -267,5 +267,5 @@ int main(void)
cmocka_unit_test(test_atol),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}
diff --git a/tests/lib/timestamp-test.c b/tests/lib/timestamp-test.c
index 8dc103d203..ad33ed08c0 100644
--- a/tests/lib/timestamp-test.c
+++ b/tests/lib/timestamp-test.c
@@ -131,7 +131,7 @@ int main(void)
};
#if CONFIG(COLLECT_TIMESTAMPS)
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
#else
return 0;
#endif
diff --git a/tests/lib/uuid-test.c b/tests/lib/uuid-test.c
index c6e40f58b1..6b568426b7 100644
--- a/tests/lib/uuid-test.c
+++ b/tests/lib/uuid-test.c
@@ -91,5 +91,5 @@ int main(void)
cmocka_unit_test(test_guid),
};
- return cmocka_run_group_tests(tests, NULL, NULL);
+ return cb_run_group_tests(tests, NULL, NULL);
}