Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portion of zephyr/tests/lib tests #8

Open
wants to merge 42 commits into
base: ztest
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
e4dae09
Update ztest with more powerful testing APIs
yperess Oct 20, 2021
7414e29
tests: app_dev: gen_inc_file: Update tests to use new ztest APIs
yperess Nov 10, 2021
cb9f83b
tests: dlist_perf: Update to use new ztest APIs
yperess Nov 10, 2021
48a97c3
tests: rbtree_perf: Update to use new ztest APIs
yperess Nov 10, 2021
135e8e8
tests: msgq_api: Update to use new ztest APIs
yperess Nov 10, 2021
2f589ba
test: msgq_usage: Update to new ztest APIs
yperess Nov 10, 2021
762f1e1
test: mutex_api: Update to use new ztest APIs
yperess Nov 10, 2021
08054ab
tests: sys_mutex: Update to use new ztest APIs
yperess Nov 10, 2021
60923f5
tests: pipe: Update to use new ztest APIs
yperess Nov 10, 2021
7b63b4e
tests: pipe: Update to use new ztest APIs
yperess Nov 10, 2021
2cb7376
tests: pipe_api: Update to new ztest APIs
yperess Nov 10, 2021
53ec3d0
tests: fifo_usage: Update to new ztest APIs
yperess Nov 10, 2021
c1f193b
tests: fifo_timeout: Update to new ztest APIs
yperess Nov 10, 2021
815fd66
tests: fifo_api: Update to new ztest APIs
yperess Nov 10, 2021
aa78678
tests: arm_hardfault_validation: ztest refactor
aaronemassey Nov 10, 2021
fd15fd1
tests: arm_interrupt: Refactor to new ztest API
aaronemassey Nov 10, 2021
a16b33e
test: arm_irq_advanced_features: update to new api
aaronemassey Nov 10, 2021
1e7f076
tests: arm_irq_vector_table: refactor to new api
aaronemassey Nov 10, 2021
c62d431
tests: arm_mem_protect: Update to new ZTEST api
aaronemassey Nov 10, 2021
8bef102
tests: arm_ramfunc: Update to new ztest api
aaronemassey Nov 10, 2021
0a79be2
tests: arm_runtime_nmi: update to new ztest api
aaronemassey Nov 11, 2021
bef8209
tests: arm_sw_vector_relay: update ztest apie use
aaronemassey Nov 11, 2021
7a76928
tests: arm_thread_swap_tz: update to new ztest api
aaronemassey Nov 11, 2021
6b3897b
tests: arm_thread_swap: update use of ztest API
aaronemassey Nov 11, 2021
1f328f0
tests: arm_tz_wrap_func: update to new ztest API
aaronemassey Nov 11, 2021
17f8a5c
tests: basicmath: update to new ZTEST APIs
aaronemassey Nov 11, 2021
859818f
tests: arm64_gicv3_its: update to new ztest API
aaronemassey Nov 11, 2021
eb47a08
tests: cpu_scrubs_regs: update to new ztest apis
aaronemassey Nov 11, 2021
6795e21
tests: nmi: update to use new ZTEST APIs
aaronemassey Nov 11, 2021
897713f
tests: pagetables: update to use new ZTEST APIs
aaronemassey Nov 11, 2021
070b2aa
tests: static_idt: update to use new ZTEST APIs
aaronemassey Nov 11, 2021
7aa4807
tests: mbedtls: update to new ZTEST APIs
aaronemassey Nov 12, 2021
d17471c
tests: rand32: update to new ZTEST APIs
aaronemassey Nov 12, 2021
48ff23c
tests: tinycrypt_hmac_prng: update ZTEST APIs
aaronemassey Nov 12, 2021
bd120f7
tests: tinycrypt: update to new ZTEST APIs
aaronemassey Nov 12, 2021
037eba4
tests/lib/c_lib
tristan-google Nov 15, 2021
60ca235
zephyr/tests/lib/cbprintf_package
tristan-google Nov 15, 2021
4247751
zephyr/tests/lib/cmsis_dsp/basicmath
tristan-google Nov 17, 2021
dd8c061
zephyr/tests/lib/cmsis_dsp/bayes
tristan-google Nov 17, 2021
3c2e011
zephyr/tests/lib/cmsis_dsp/complexmath
tristan-google Nov 17, 2021
bde0ab7
zephyr/tests/lib/cmsis_dsp/distance
tristan-google Nov 17, 2021
92bbebe
zephyr/tests/lib/cmsis_dsp/fastmath
tristan-google Nov 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/linker/common-ram.ld
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,6 @@

#if defined(CONFIG_ZTEST)
ITERABLE_SECTION_RAM(ztest_suite_node, 4)
ITERABLE_SECTION_RAM(ztest_unit_test, 4)
ITERABLE_SECTION_RAM(ztest_test_rule, 4)
#endif /* CONFIG_ZTEST */
14 changes: 4 additions & 10 deletions samples/subsys/testsuite/integration/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@

#include <ztest.h>


ZTEST_SUITE(framework_tests, NULL, NULL, NULL, NULL, NULL);

/**
* @brief Test Asserts
*
* This test verifies various assert macros provided by ztest.
*
*/
static void test_assert(void)
ZTEST(framework_tests, test_assert)
{
zassert_true(1, "1 was false");
zassert_false(0, "0 was true");
Expand All @@ -21,12 +24,3 @@ static void test_assert(void)
zassert_equal(1, 1, "1 was not equal to 1");
zassert_equal_ptr(NULL, NULL, "NULL was not equal to NULL");
}

void test_main(void)
{
ztest_test_suite(framework_tests,
ztest_unit_test(test_assert)
);

ztest_run_test_suite(framework_tests);
}
14 changes: 4 additions & 10 deletions samples/subsys/testsuite/pytest/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,10 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include <ztest.h>
void test_pytest(void)
{
TC_PRINT("Hello world\n");
}

void test_main(void)
{
ztest_test_suite(test_pytest,
ztest_unit_test(test_pytest)
);
ZTEST_SUITE(test_pytest, NULL, NULL, NULL, NULL, NULL);

ztest_run_test_suite(test_pytest);
ZTEST(test_pytest, test_pytest)
{
TC_PRINT("Hello world\n");
}
12 changes: 12 additions & 0 deletions subsys/testsuite/include/ztest.ld
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,17 @@ SECTIONS
KEEP(*(SORT_BY_NAME(._ztest_suite_node.static.*)))
_ztest_suite_node_list_end = .;
}
.data.ztest_unit_test_area : ALIGN(4)
{
_ztest_unit_test_list_start = .;
KEEP(*(SORT_BY_NAME(._ztest_unit_test.static.*)))
_ztest_unit_test_list_end = .;
}
.data.ztest_test_rule_area : ALIGN(4)
{
_ztest_test_rule_list_start = .;
KEEP(*(SORT_BY_NAME(._ztest_test_rule.static.*)))
_ztest_test_rule_list_end = .;
}
}
INSERT AFTER .data;
1 change: 1 addition & 0 deletions subsys/testsuite/ztest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ zephyr_include_directories(
zephyr_library()
zephyr_library_sources( src/ztest.c)
zephyr_library_sources( src/ztest_error_hook.c)
zephyr_library_sources( src/ztest_rules.c)
zephyr_library_sources_ifdef(CONFIG_ZTEST_MOCKING src/ztest_mock.c)
10 changes: 10 additions & 0 deletions subsys/testsuite/ztest/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ config ZTEST_ASSERT_HOOK
error test case. Remember to add ignore_fault tag in yaml file when
using twister to run testing.

menu "ztest provided rules"

config ZTEST_RULE_1CPU
bool "Run all the tests on a single CPU"
help
This rule will call z_test_1cpu_start before each unit test and
ztest_1cpu_stop after each test.

endmenu

endif # ZTEST

config ZTEST_MOCKING
Expand Down
Loading