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>
This commit is contained in:
parent
6308606962
commit
021321d122
|
@ -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 test_run_step(uint32_t state)
|
||||
{
|
||||
if (state & TEST_STATE_MASK(TEST_STATE_STEP_1))
|
||||
run_test_step1();
|
||||
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)
|
||||
{
|
||||
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)
|
||||
run_test_step1();
|
||||
else if (strncmp(argv[1], "2", 1) == 0)
|
||||
run_test_step2();
|
||||
msleep(30); /* Wait for TASK_ID_TEST to initialize */
|
||||
task_wake(TASK_ID_TEST);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue