summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/dm/regmap.c9
-rw-r--r--test/py/tests/test_stackprotector.py14
2 files changed, 19 insertions, 4 deletions
diff --git a/test/dm/regmap.c b/test/dm/regmap.c
index 22a293096c9..372a73ca0c3 100644
--- a/test/dm/regmap.c
+++ b/test/dm/regmap.c
@@ -286,7 +286,8 @@ U_BOOT_DRIVER(regmap_test) = {
static int dm_test_devm_regmap(struct unit_test_state *uts)
{
int i = 0;
- u32 val;
+ u16 val;
+ void *valp = &val;
u16 pattern[REGMAP_TEST_BUF_SZ];
u16 *buffer;
struct udevice *dev;
@@ -311,7 +312,7 @@ static int dm_test_devm_regmap(struct unit_test_state *uts)
ut_assertok(regmap_write(priv->cfg_regmap, i, pattern[i]));
}
for (i = 0; i < REGMAP_TEST_BUF_SZ; i++) {
- ut_assertok(regmap_read(priv->cfg_regmap, i, &val));
+ ut_assertok(regmap_read(priv->cfg_regmap, i, valp));
ut_asserteq(val, buffer[i]);
ut_asserteq(val, pattern[i]);
}
@@ -319,9 +320,9 @@ static int dm_test_devm_regmap(struct unit_test_state *uts)
ut_asserteq(-ERANGE, regmap_write(priv->cfg_regmap, REGMAP_TEST_BUF_SZ,
val));
ut_asserteq(-ERANGE, regmap_read(priv->cfg_regmap, REGMAP_TEST_BUF_SZ,
- &val));
+ valp));
ut_asserteq(-ERANGE, regmap_write(priv->cfg_regmap, -1, val));
- ut_asserteq(-ERANGE, regmap_read(priv->cfg_regmap, -1, &val));
+ ut_asserteq(-ERANGE, regmap_read(priv->cfg_regmap, -1, valp));
return 0;
}
diff --git a/test/py/tests/test_stackprotector.py b/test/py/tests/test_stackprotector.py
new file mode 100644
index 00000000000..b009437e5e0
--- /dev/null
+++ b/test/py/tests/test_stackprotector.py
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2021 Broadcom
+
+import pytest
+import signal
+
[email protected]('cmd_stackprotector_test')
+def test_stackprotector(u_boot_console):
+ """Test that the stackprotector function works."""
+
+ u_boot_console.run_command('stackprot_test',wait_for_prompt=False)
+ expected_response = 'Stack smashing detected'
+ u_boot_console.wait_for(expected_response)
+ u_boot_console.restart_uboot()