summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2020-06-04 17:19:54 -0700
committerCommit Bot <commit-bot@chromium.org>2020-06-18 02:47:41 +0000
commit021321d122a8908f7251156b916d86f00bf773b2 (patch)
treeb050c4a296942d377b33a06b8306bb5a0f12cacb
parent63086069629dcc5ccd34f91771b22e81f65a0017 (diff)
downloadchrome-ec-021321d122a8908f7251156b916d86f00bf773b2.tar.gz
test: Make flash_write_protect a multistep test
Now that the scratchpad works on the STM32F412, we can make flash_write_protect a multistep test, so that no manual steps are required to run the test. BRANCH=none BUG=b:157059753 TEST=With dragonclaw v0.2 connected to Segger J-Trace and servo micro: dut-control -n bloonchipper fw_wp_en:on ./test/run_device_tests.py -t flash_write_protect => PASS Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Iedb4ad8d89db805fa1c6e65d8a0bcc767993f5d1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2233198 Reviewed-by: Craig Hesling <hesling@chromium.org> Commit-Queue: Craig Hesling <hesling@chromium.org>
-rw-r--r--test/flash_write_protect.c38
-rw-r--r--test/flash_write_protect.tasklist3
2 files changed, 28 insertions, 13 deletions
diff --git a/test/flash_write_protect.c b/test/flash_write_protect.c
index a75188e1cb..5e34b1735b 100644
--- a/test/flash_write_protect.c
+++ b/test/flash_write_protect.c
@@ -7,6 +7,7 @@
#include "gpio.h"
#include "string.h"
#include "system.h"
+#include "task.h"
#include "test_util.h"
test_static int check_image_and_hardware_write_protect(void)
@@ -54,27 +55,40 @@ test_static void run_test_step1(void)
{
ccprintf("Step 1: Flash write protect test\n");
RUN_TEST(test_flash_write_protect_enable);
+
+ if (test_get_error_count())
+ test_reboot_to_next_step(TEST_STATE_FAILED);
+ else
+ test_reboot_to_next_step(TEST_STATE_STEP_2);
}
test_static void run_test_step2(void)
{
ccprintf("Step 2: Flash write protect test\n");
RUN_TEST(test_flash_write_protect_disable);
+
+ if (test_get_error_count())
+ test_reboot_to_next_step(TEST_STATE_FAILED);
+ else
+ test_reboot_to_next_step(TEST_STATE_PASSED);
}
-void run_test(int argc, char **argv)
+void test_run_step(uint32_t state)
{
- if (argc < 2) {
- ccprintf("usage: runtest <test_step_number>\n");
- return;
- }
-
- /*
- * TODO(157059753): replace with test_run_multistep when scratchpad
- * works.
- */
- if (strncmp(argv[1], "1", 1) == 0)
+ if (state & TEST_STATE_MASK(TEST_STATE_STEP_1))
run_test_step1();
- else if (strncmp(argv[1], "2", 1) == 0)
+ else if (state & TEST_STATE_MASK(TEST_STATE_STEP_2))
run_test_step2();
}
+
+int task_test(void *unused)
+{
+ test_run_multistep();
+ return EC_SUCCESS;
+}
+
+void run_test(int argc, char **argv)
+{
+ msleep(30); /* Wait for TASK_ID_TEST to initialize */
+ task_wake(TASK_ID_TEST);
+}
diff --git a/test/flash_write_protect.tasklist b/test/flash_write_protect.tasklist
index 51734f058d..21619decc3 100644
--- a/test/flash_write_protect.tasklist
+++ b/test/flash_write_protect.tasklist
@@ -6,4 +6,5 @@
/**
* See CONFIG_TASK_LIST in config.h for details.
*/
-#define CONFIG_TEST_TASK_LIST /* no tasks */
+#define CONFIG_TEST_TASK_LIST \
+ TASK_TEST(TEST, task_test, NULL, TASK_STACK_SIZE)