diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/dm/cache.c | 20 | ||||
-rw-r--r-- | test/env/Kconfig | 1 | ||||
-rw-r--r-- | test/lib/hexdump.c | 9 | ||||
-rw-r--r-- | test/print_ut.c | 20 | ||||
-rw-r--r-- | test/py/README.md | 1 | ||||
-rw-r--r-- | test/py/conftest.py | 14 | ||||
-rw-r--r-- | test/py/tests/test_avb.py | 16 | ||||
-rw-r--r-- | test/py/tests/test_efi_selftest.py | 3 |
8 files changed, 66 insertions, 18 deletions
diff --git a/test/dm/cache.c b/test/dm/cache.c new file mode 100644 index 0000000000..d4144aab76 --- /dev/null +++ b/test/dm/cache.c @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2019 Intel Corporation <www.intel.com> + */ + +#include <common.h> +#include <dm.h> +#include <dm/test.h> + +static int dm_test_reset(struct unit_test_state *uts) +{ + struct udevice *dev_cache; + struct cache_info; + + ut_assertok(uclass_get_device(UCLASS_CACHE, 0, &dev_cache)); + ut_assertok(cache_get_info(dev, &info)); + + return 0; +} +DM_TEST(dm_test_reset, DM_TESTF_SCAN_FDT); diff --git a/test/env/Kconfig b/test/env/Kconfig index ff164132e9..6cb82337b3 100644 --- a/test/env/Kconfig +++ b/test/env/Kconfig @@ -1,6 +1,7 @@ config UT_ENV bool "Enable env unit tests" depends on UNIT_TEST + default y help This enables the 'ut env' command which runs a series of unit tests on the env code. diff --git a/test/lib/hexdump.c b/test/lib/hexdump.c index 567b57686a..5dccf43886 100644 --- a/test/lib/hexdump.c +++ b/test/lib/hexdump.c @@ -6,7 +6,8 @@ #include <common.h> #include <hexdump.h> -#include <dm/test.h> +#include <test/lib.h> +#include <test/test.h> #include <test/ut.h> static int lib_test_hex_to_bin(struct unit_test_state *uts) @@ -32,7 +33,7 @@ static int lib_test_hex_to_bin(struct unit_test_state *uts) return 0; } -DM_TEST(lib_test_hex_to_bin, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +LIB_TEST(lib_test_hex_to_bin, 0); static int lib_test_hex2bin(struct unit_test_state *uts) { @@ -62,7 +63,7 @@ static int lib_test_hex2bin(struct unit_test_state *uts) return 0; } -DM_TEST(lib_test_hex2bin, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +LIB_TEST(lib_test_hex2bin, 0); static int lib_test_bin2hex(struct unit_test_state *uts) { @@ -92,4 +93,4 @@ static int lib_test_bin2hex(struct unit_test_state *uts) return 0; } -DM_TEST(lib_test_bin2hex, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +LIB_TEST(lib_test_bin2hex, 0); diff --git a/test/print_ut.c b/test/print_ut.c index f0f1d6010a..0bc548dca8 100644 --- a/test/print_ut.c +++ b/test/print_ut.c @@ -79,14 +79,18 @@ static int do_ut_print(cmd_tbl_t *cmdtp, int flag, int argc, assert(s == str); assert(!strcmp("\n\nU-Boo\n\n", s)); - s = display_options_get_banner(true, str, 1); - assert(s == str); - assert(!strcmp("", s)); - - s = display_options_get_banner(true, str, 2); - assert(s == str); - assert(!strcmp("\n", s)); - + /* Assert that we do not overwrite memory before the buffer */ + str[0] = '`'; + s = display_options_get_banner(true, str + 1, 1); + assert(s == str + 1); + assert(!strcmp("`", str)); + + str[0] = '~'; + s = display_options_get_banner(true, str + 1, 2); + assert(s == str + 1); + assert(!strcmp("~\n", str)); + + /* The last two characters are set to \n\n for all buffer sizes > 2 */ s = display_options_get_banner(false, str, sizeof(str)); assert(s == str); assert(!strcmp("U-Boot \n\n", s)); diff --git a/test/py/README.md b/test/py/README.md index 4d9d2b81d1..2156661d6c 100644 --- a/test/py/README.md +++ b/test/py/README.md @@ -310,6 +310,7 @@ instances of: - `buildconfig.get(...` - `@pytest.mark.buildconfigspec(...` +- `@pytest.mark.notbuildconfigspec(...` ### Complete invocation example diff --git a/test/py/conftest.py b/test/py/conftest.py index e40cbf0ba1..00d8ef8ba9 100644 --- a/test/py/conftest.py +++ b/test/py/conftest.py @@ -460,11 +460,15 @@ def setup_buildconfigspec(item): """ mark = item.get_marker('buildconfigspec') - if not mark: - return - for option in mark.args: - if not ubconfig.buildconfig.get('config_' + option.lower(), None): - pytest.skip('.config feature "%s" not enabled' % option.lower()) + if mark: + for option in mark.args: + if not ubconfig.buildconfig.get('config_' + option.lower(), None): + pytest.skip('.config feature "%s" not enabled' % option.lower()) + notmark = item.get_marker('notbuildconfigspec') + if notmark: + for option in notmark.args: + if ubconfig.buildconfig.get('config_' + option.lower(), None): + pytest.skip('.config feature "%s" enabled' % option.lower()) def tool_is_in_path(tool): for path in os.environ["PATH"].split(os.pathsep): diff --git a/test/py/tests/test_avb.py b/test/py/tests/test_avb.py index e70a010c9a..2bb75ed6e2 100644 --- a/test/py/tests/test_avb.py +++ b/test/py/tests/test_avb.py @@ -116,3 +116,19 @@ def test_avb_mmc_read(u_boot_console): response = u_boot_console.run_command('cmp 0x%x 0x%x 40' % (temp_addr, temp_addr2)) assert response.find('64 word') + + +@pytest.mark.buildconfigspec('cmd_avb') +@pytest.mark.buildconfigspec('optee_ta_avb') +def test_avb_persistent_values(u_boot_console): + """Test reading/writing persistent storage to avb + """ + + response = u_boot_console.run_command('avb init %s' % str(mmc_dev)) + assert response == '' + + response = u_boot_console.run_command('avb write_pvalue test value_value') + assert response == 'Wrote 12 bytes' + + response = u_boot_console.run_command('avb read_pvalue test 12') + assert response == 'Read 12 bytes, value = value_value' diff --git a/test/py/tests/test_efi_selftest.py b/test/py/tests/test_efi_selftest.py index bc226a8e63..07e4db0452 100644 --- a/test/py/tests/test_efi_selftest.py +++ b/test/py/tests/test_efi_selftest.py @@ -15,7 +15,7 @@ def test_efi_selftest(u_boot_console): This function executes all selftests that are not marked as on request. """ u_boot_console.run_command(cmd='setenv efi_selftest') - u_boot_console.run_command(cmd='bootefi selftest ${fdtcontroladdr}', wait_for_prompt=False) + u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False) m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key']) if m != 0: raise Exception('Failures occurred during the EFI selftest') @@ -27,6 +27,7 @@ def test_efi_selftest(u_boot_console): @pytest.mark.buildconfigspec('cmd_bootefi_selftest') @pytest.mark.buildconfigspec('of_control') +@pytest.mark.notbuildconfigspec('generate_acpi_table') def test_efi_selftest_device_tree(u_boot_console): u_boot_console.run_command(cmd='setenv efi_selftest list') output = u_boot_console.run_command('bootefi selftest') |