summaryrefslogtreecommitdiff
path: root/test/lightbar.c
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2019-04-16 13:43:03 -0600
committerchrome-bot <chrome-bot@chromium.org>2019-04-24 15:51:44 -0700
commitc6254cee9684a92c81863b4576312cf8db97cab6 (patch)
treefb6a77bc2396343a2bee98f80b001c192d3a060f /test/lightbar.c
parente08a71fd05bfc9e32dd64b7e15840e7232d72788 (diff)
downloadchrome-ec-c6254cee9684a92c81863b4576312cf8db97cab6.tar.gz
tests: make lighbar test easier to debug
This test was failing and it is easier to comment out tests that are passing to debug. I needed to add a precondition so each test would pass on its own. I also needed to remove the static modifier to allow each test to be comment out. BRANCH=none BUG=none TEST=builds and passes Change-Id: Ib2a7c0948aee363e1552835222a9700225993e46 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1570605 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'test/lightbar.c')
-rw-r--r--test/lightbar.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/test/lightbar.c b/test/lightbar.c
index 8a21c1fc62..d0952c92e8 100644
--- a/test/lightbar.c
+++ b/test/lightbar.c
@@ -11,7 +11,6 @@
#include "timer.h"
#include "util.h"
-
static int get_seq(void)
{
int rv;
@@ -53,7 +52,7 @@ static int set_seq(int s)
return EC_RES_SUCCESS;
}
-static int test_double_oneshots(void)
+test_static int test_double_oneshots(void)
{
/* Start in S0 */
TEST_ASSERT(set_seq(LIGHTBAR_S0) == EC_RES_SUCCESS);
@@ -125,7 +124,7 @@ static int test_double_oneshots(void)
return EC_SUCCESS;
}
-static int test_oneshots_norm_msg(void)
+test_static int test_oneshots_norm_msg(void)
{
/* Revert to the next state when interrupted with a normal message. */
enum lightbar_sequence seqs[] = {
@@ -154,7 +153,7 @@ static int test_oneshots_norm_msg(void)
return EC_SUCCESS;
}
-static int test_stop_timeout(void)
+test_static int test_stop_timeout(void)
{
int i;
@@ -188,7 +187,7 @@ static int test_stop_timeout(void)
return EC_SUCCESS;
}
-static int test_oneshots_timeout(void)
+test_static int test_oneshots_timeout(void)
{
/* These should revert to the previous state after running */
enum lightbar_sequence seqs[] = {
@@ -215,7 +214,7 @@ static int test_oneshots_timeout(void)
return EC_SUCCESS;
}
-static int test_transition_states(void)
+test_static int test_transition_states(void)
{
/* S5S3 */
TEST_ASSERT(set_seq(LIGHTBAR_S5S3) == EC_RES_SUCCESS);
@@ -240,7 +239,7 @@ static int test_transition_states(void)
return EC_SUCCESS;
}
-static int test_stable_states(void)
+test_static int test_stable_states(void)
{
int i;
@@ -301,7 +300,7 @@ int lid_is_open(void)
return 1;
}
-static int test_als_lightbar(void)
+test_static int test_als_lightbar(void)
{
int lux_data[] = { 500, 100, 35, 15, 30, 35, 55, 70, 55, 100 };
int exp_gcid[] = { 0, 0, 1, 2, 2, 2, 1, 0, 0, 0 };
@@ -322,6 +321,9 @@ static int test_als_lightbar(void)
void run_test(void)
{
+ /* Ensure tasks are started before running tests */
+ usleep(SECOND);
+
RUN_TEST(test_stable_states);
RUN_TEST(test_transition_states);
RUN_TEST(test_oneshots_timeout);