summaryrefslogtreecommitdiff
path: root/test/system.c
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-11-04 12:11:58 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-05 04:22:34 +0000
commit252457d4b21f46889eebad61d4c0a65331919cec (patch)
tree01856c4d31d710b20e85a74c8d7b5836e35c3b98 /test/system.c
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-stabilize-14396.B-ish.tar.gz
In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'test/system.c')
-rw-r--r--test/system.c114
1 files changed, 0 insertions, 114 deletions
diff --git a/test/system.c b/test/system.c
deleted file mode 100644
index 79383b82d9..0000000000
--- a/test/system.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Copyright 2013 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- *
- * Test system_common.
- */
-
-#include "common.h"
-#include "console.h"
-#include "host_command.h"
-#include "system.h"
-#include "test_util.h"
-#include "timer.h"
-#include "util.h"
-
-#define TEST_STATE_STEP_2 (1 << 0)
-#define TEST_STATE_FAIL (1 << 1)
-
-static int test_reboot_on_shutdown(void)
-{
- struct ec_params_reboot_ec params;
-
- /* Fails if the system reboots unexpectedly */
- system_set_scratchpad(TEST_STATE_FAIL);
-
- test_chipset_on();
- msleep(30);
-
- params.cmd = EC_REBOOT_COLD;
- params.flags = EC_REBOOT_FLAG_ON_AP_SHUTDOWN;
-
- TEST_EQ(test_send_host_command(EC_CMD_REBOOT_EC, 0, &params,
- sizeof(params), NULL, 0),
- EC_SUCCESS, "%d");
-
- system_set_scratchpad(TEST_STATE_STEP_2);
- test_chipset_off();
- msleep(30);
-
- /* Shouldn't reach here */
- return EC_ERROR_UNKNOWN;
-}
-
-static int test_cancel_reboot(void)
-{
- struct ec_params_reboot_ec params;
-
- /* Fails if the system reboots unexpectedly */
- system_set_scratchpad(TEST_STATE_FAIL);
-
- test_chipset_on();
- msleep(30);
-
- params.cmd = EC_REBOOT_COLD;
- params.flags = EC_REBOOT_FLAG_ON_AP_SHUTDOWN;
-
- TEST_EQ(test_send_host_command(EC_CMD_REBOOT_EC, 0, &params,
- sizeof(params), NULL, 0),
- EC_SUCCESS, "%d");
-
- params.cmd = EC_REBOOT_CANCEL;
- params.flags = 0;
-
- TEST_EQ(test_send_host_command(EC_CMD_REBOOT_EC, 0, &params,
- sizeof(params), NULL, 0),
- EC_SUCCESS, "%d");
-
- test_chipset_off();
- msleep(30);
-
- return EC_SUCCESS;
-}
-
-static void run_test_step1(void)
-{
- if (test_reboot_on_shutdown() != EC_SUCCESS)
- test_fail();
-}
-
-static void run_test_step2(void)
-{
- if (test_cancel_reboot() != EC_SUCCESS)
- test_fail();
-
- system_set_scratchpad(0);
- test_pass();
-}
-
-static void fail_and_clean_up(void)
-{
- system_set_scratchpad(0);
- test_fail();
-}
-
-void run_test(int argc, char **argv)
-{
- uint32_t state = 0;
-
- /* The return value isn't checked here on purpose. The scratchpad file
- * may exist from a previous run or it may be in a clean state. A
- * previous run of this test should reset the scratchpad value to 0
- * regardless of the final result.
- */
- system_get_scratchpad(&state);
-
- test_reset();
-
- if (state == 0)
- run_test_step1();
- else if (state & TEST_STATE_STEP_2)
- run_test_step2();
- else if (state & TEST_STATE_FAIL)
- fail_and_clean_up();
-}