diff options
author | Vic Yang <victoryang@chromium.org> | 2013-10-28 17:18:41 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-10-29 03:55:35 +0000 |
commit | e589e87b48d0a66bb818a648da9c29fc509896a2 (patch) | |
tree | 89867b3794f26ff0d50493bddbbe133b47fce0fc /test | |
parent | 718f4bb5e3a806f75b514295b9c9770a9a3b8e6a (diff) | |
download | chrome-ec-e589e87b48d0a66bb818a648da9c29fc509896a2.tar.gz |
Remove QEMU testsstabilize-4886.B
QEMU tests served us well, but it has been more and more difficult to
maintain as we now have more chips and use more functionality from each
EC chip. With emulator tests in place to test common code and hardware
test to test per-chip/per-board drivers, it's time to remove QEMU tests
to simplify our code base.
QEMU tests that are covered by other emulator tests are removed
completely; tests that are not covered are left alone for now to
preserve the test logic.
BUG=chrome-os-partner:18343
TEST=util/make_all.sh
BRANCH=None
Change-Id: I5a4dd2f5ac42f7f66f86fdce0b62dbd2c65bf66a
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174669
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/build.mk | 3 | ||||
-rw-r--r-- | test/charging.py | 81 | ||||
-rw-r--r-- | test/charging.tasklist | 17 | ||||
-rw-r--r-- | test/mutex.py | 25 | ||||
-rw-r--r-- | test/pingpong.py | 27 | ||||
-rw-r--r-- | test/scancode.py | 29 | ||||
-rw-r--r-- | test/scancode.tasklist | 17 | ||||
-rw-r--r-- | test/thermal_old.c | 426 | ||||
-rw-r--r-- | test/thermal_old.py | 104 | ||||
-rw-r--r-- | test/typematic.py | 63 | ||||
-rw-r--r-- | test/typematic.tasklist | 17 |
11 files changed, 0 insertions, 809 deletions
diff --git a/test/build.mk b/test/build.mk index 27a5447060..1c98d63bdd 100644 --- a/test/build.mk +++ b/test/build.mk @@ -9,9 +9,6 @@ test-list-y=pingpong timer_calib timer_dos timer_jump mutex utils #disable: powerdemo -# TODO(victoryang): Fix these tests: -# scancode typematic charging - test-list-$(BOARD_bds)+= test-list-$(BOARD_daisy)+=kb_scan stress test-list-$(BOARD_pit)+=kb_scan stress diff --git a/test/charging.py b/test/charging.py deleted file mode 100644 index 366d3faa3c..0000000000 --- a/test/charging.py +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright (c) 2011 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. -# -# Charging state machine unit test -# - -import time - -def consume_charge_state(helper): - try: - while True: - helper.wait_output("Charge state \S+ -> \S+", - use_re=True, - timeout=1) - except: - pass - -def wait_charge_state(helper, state): - helper.wait_output("Charge state \S+ -> %s" % state, use_re=True) - -def test(helper): - helper.wait_output("--- UART initialized") - - # Check charge when AC present - consume_charge_state(helper) - helper.ec_command("gpiomock AC_PRESENT 1") - wait_charge_state(helper, "charge") - - # Check discharge when AC not present - helper.ec_command("gpiomock AC_PRESENT 0") - wait_charge_state(helper, "discharge") - - # Check charge current - helper.ec_command("sbmock desire_current 2800") - helper.ec_command("gpiomock AC_PRESENT 1") - helper.wait_output("Charger set current: 2800") - - # Check charger voltage - helper.ec_command("gpiomock AC_PRESENT 0") - wait_charge_state(helper, "discharge") - helper.ec_command("sbmock desire_voltage 7500") - helper.ec_command("gpiomock AC_PRESENT 1") - helper.wait_output("Charger set voltage: 7500") - - # While powered on and discharging, over-temperature should trigger - # system shutdown - helper.ec_command("gpiomock AC_PRESENT 0") - wait_charge_state(helper, "discharge") - helper.ec_command("powermock on") - helper.ec_command("sbmock temperature 3700") - helper.wait_output("Force shutdown") - helper.ec_command("sbmock temperature 2981") - time.sleep(1) - - # While powered on and discharging, under-temperature should trigger - # system shutdown - helper.ec_command("powermock on") - helper.ec_command("sbmock temperature 2600") - helper.wait_output("Force shutdown") - helper.ec_command("sbmock temperature 2981") - - # While powered on and charging, over-temperature should stop battery - # from charging - consume_charge_state(helper) - helper.ec_command("gpiomock AC_PRESENT 1") - wait_charge_state(helper, "charge") - helper.ec_command("powermock on") - helper.ec_command("sbmock temperature 3700") - wait_charge_state(helper, "idle") - helper.ec_command("sbmock temperature 2981") - wait_charge_state(helper, "charge") - - # While powered on and charging, under-temperature should stop battery - # from charging - helper.ec_command("sbmock temperature 2600") - wait_charge_state(helper, "idle") - helper.ec_command("sbmock temperature 2981") - wait_charge_state(helper, "charge") - - return True # PASS ! diff --git a/test/charging.tasklist b/test/charging.tasklist deleted file mode 100644 index 26cfc53453..0000000000 --- a/test/charging.tasklist +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright (c) 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. - */ - -/** - * List of enabled tasks in the priority order - * - * The first one has the lowest priority. - * - * For each task, use the macro TASK_TEST(n, r, d, s) where : - * 'n' in the name of the task - * 'r' in the main routine of the task - * 'd' in an opaque parameter passed to the routine at startup - * 's' is the stack size in bytes; must be a multiple of 8 - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/mutex.py b/test/mutex.py deleted file mode 100644 index afd342938c..0000000000 --- a/test/mutex.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) 2011 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. -# -# Mutexes test -# - -def test(helper): - helper.wait_output("[Mutex main task") - - # 3 locking in a row without contention - helper.wait_output("No contention :done.") - - # serialization (simple contention) - helper.wait_output("Simple contention :") - helper.wait_output("MTX2: locking...done") - helper.wait_output("MTX1: blocking...") - helper.wait_output("MTX1: get lock") - - # multiple contention - helper.wait_output("Massive locking/unlocking :") - #TODO check sequence - helper.wait_output("Test done.") - - return True # PASS ! diff --git a/test/pingpong.py b/test/pingpong.py deleted file mode 100644 index df7d4b38c5..0000000000 --- a/test/pingpong.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2011 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. -# -# Task scheduling test -# - -import time - -# Test during 5s -DURATION=5 - -def test(helper): - helper.wait_output("[starting Task T]") - helper.wait_output("[starting Task C]") - helper.wait_output("[starting Task B]") - helper.wait_output("[starting Task A]") - deadline = time.time() + DURATION - count = [] - while time.time() < deadline: - sched = helper.wait_output("(?P<a>(?:ABC){3,200})T", use_re=True, - timeout=1)["a"] - count.append(len(sched) / 3) - - helper.trace("IRQ count %d, cycles count min %d max %d\n" % - (len(count), min(count), max(count))) - return True # PASS ! diff --git a/test/scancode.py b/test/scancode.py deleted file mode 100644 index 6437e24e59..0000000000 --- a/test/scancode.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) 2012 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. -# -# i8042 scancode test -# - -def test(helper): - # Wait for EC initialized - helper.wait_output("--- UART initialized") - - # Disable typematic - helper.ec_command("typematic 1000000 1000000") - - # Enable XLATE (Scan code set 1) - helper.ec_command("ctrlram 0 0x40") - helper.ec_command("mockmatrix 1 1 1") - helper.wait_output("i8042 SEND: 01") # make code - helper.ec_command("mockmatrix 1 1 0") - helper.wait_output("i8042 SEND: 81") # break code - - # Disable XLATE (Scan code set 2) - helper.ec_command("ctrlram 0 0x00") - helper.ec_command("mockmatrix 1 1 1") - helper.wait_output("i8042 SEND: 76") # make code - helper.ec_command("mockmatrix 1 1 0") - helper.wait_output("i8042 SEND: f0 76") # break code - - return True # PASS ! diff --git a/test/scancode.tasklist b/test/scancode.tasklist deleted file mode 100644 index 26cfc53453..0000000000 --- a/test/scancode.tasklist +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright (c) 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. - */ - -/** - * List of enabled tasks in the priority order - * - * The first one has the lowest priority. - * - * For each task, use the macro TASK_TEST(n, r, d, s) where : - * 'n' in the name of the task - * 'r' in the main routine of the task - * 'd' in an opaque parameter passed to the routine at startup - * 's' is the stack size in bytes; must be a multiple of 8 - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ diff --git a/test/thermal_old.c b/test/thermal_old.c deleted file mode 100644 index 485e19bfb5..0000000000 --- a/test/thermal_old.c +++ /dev/null @@ -1,426 +0,0 @@ -/* Copyright (c) 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 thermal engine. - */ - -#include "common.h" -#include "console.h" -#include "hooks.h" -#include "host_command.h" -#include "printf.h" -#include "temp_sensor.h" -#include "test_util.h" -#include "thermal.h" -#include "timer.h" -#include "util.h" - -static int mock_temp[TEMP_SENSOR_COUNT]; -static int fan_rpm; -static int fan_rpm_mode = 1; -static int cpu_throttled; -static int cpu_down; - -extern struct thermal_config_t thermal_config[TEMP_SENSOR_TYPE_COUNT]; -extern const int fan_speed[THERMAL_FAN_STEPS + 1]; - -/*****************************************************************************/ -/* Mock functions */ - -int temp_sensor_read(enum temp_sensor_id id, int *temp_ptr) -{ - if (mock_temp[id] >= 0) { - *temp_ptr = mock_temp[id]; - return EC_SUCCESS; - } else { - return -mock_temp[id]; - } -} - -void pwm_set_fan_rpm_mode(int rpm_mode) -{ - fan_rpm_mode = rpm_mode; -} - -void pwm_set_fan_target_rpm(int rpm) -{ - fan_rpm = rpm; -} - -void chipset_force_shutdown(void) -{ - cpu_down = 1; -} - -void chipset_throttle_cpu(int throttled) -{ - cpu_throttled = throttled; -} - -/*****************************************************************************/ -/* Test utilities */ - -/* Test shorthands */ -#define T_CPU TEMP_SENSOR_CPU -#define T_BOARD TEMP_SENSOR_BOARD -#define T_CASE TEMP_SENSOR_CASE -#define THRESHOLD(x, y) (thermal_config[x].thresholds[y]) -#define FAN_THRESHOLD(x, y) THRESHOLD(x, THRESHOLD_COUNT + (y)) - -static void reset_mock_temp(void) -{ - int i; - enum temp_sensor_type type; - for (i = 0; i < TEMP_SENSOR_COUNT; ++i) { - type = temp_sensors[i].type; - mock_temp[i] = FAN_THRESHOLD(type, 0) - 1; - } -} - -static int wait_fan_rpm(int rpm, int timeout_secs) -{ - do { - if (fan_rpm == rpm) - return 1; - usleep(SECOND); - } while (timeout_secs--); - - return 0; -} - -static int wait_value(int *v, int target, int timeout_secs) -{ - do { - if (*v == target) - return 1; - usleep(SECOND); - } while (timeout_secs--); - - return 0; -} - -static int wait_set(int *v, int timeout_secs) -{ - return wait_value(v, 1, timeout_secs); -} - -static int wait_clear(int *v, int timeout_secs) -{ - return wait_value(v, 0, timeout_secs); -} - -/*****************************************************************************/ -/* Tests */ - -static int test_init_val(void) -{ - /* Initial mock temperature values are all zero. */ - TEST_ASSERT(cpu_throttled == 0); - TEST_ASSERT(cpu_down == 0); - TEST_ASSERT(!(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_OVERLOAD))); - TEST_ASSERT(!(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_SHUTDOWN))); - - return EC_SUCCESS; -} - -static int test_cpu_fan(void) -{ - reset_mock_temp(); - - /* - * Increase CPU temperature to first fan step and check if - * the fan comes up. - */ - mock_temp[T_CPU] = FAN_THRESHOLD(T_CPU, 0); - TEST_ASSERT(wait_fan_rpm(fan_speed[1], 11)); - - /* Increase CPU temperature to second fan step */ - mock_temp[T_CPU] = FAN_THRESHOLD(T_CPU, 1); - TEST_ASSERT(wait_fan_rpm(fan_speed[2], 11)); - - /* Test threshold hysteresis */ - mock_temp[T_CPU]--; - usleep(15 * SECOND); - TEST_ASSERT(fan_rpm == fan_speed[2]); - - /* Test action delay */ - mock_temp[T_CPU] = FAN_THRESHOLD(T_CPU, 4); - usleep((temp_sensors[T_CPU].action_delay_sec - 1) * SECOND); - TEST_ASSERT(fan_rpm == fan_speed[2]); - mock_temp[T_CPU] = FAN_THRESHOLD(T_CPU, 0); - - return EC_SUCCESS; -} - -static int test_safety(void) -{ - reset_mock_temp(); - - /* Trigger CPU throttling */ - mock_temp[T_CPU] = THRESHOLD(T_CPU, THRESHOLD_WARNING); - TEST_ASSERT(wait_set(&cpu_throttled, 11)); - TEST_ASSERT(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_OVERLOAD)); - - /* Lower temperature. CPU not throttled anymore. */ - mock_temp[T_CPU] = THRESHOLD(T_CPU, THRESHOLD_WARNING) - 5; - TEST_ASSERT(wait_clear(&cpu_throttled, 2)); - - /* Thermal shutdown */ - mock_temp[T_CPU] = THRESHOLD(T_CPU, THRESHOLD_CPU_DOWN); - TEST_ASSERT(wait_set(&cpu_down, 11)); - TEST_ASSERT(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_SHUTDOWN)); - - mock_temp[T_CPU] = 0; - usleep(SECOND); - cpu_down = 0; - - mock_temp[T_CPU] = THRESHOLD(T_CPU, THRESHOLD_POWER_DOWN); - TEST_ASSERT(wait_set(&cpu_down, 11)); - TEST_ASSERT(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_SHUTDOWN)); - - mock_temp[T_CPU] = 0; - cpu_down = 0; - - return EC_SUCCESS; -} - -static int test_sensor_failure(void) -{ - reset_mock_temp(); - - /* Failure due to sensor not powered should be ignored */ - mock_temp[T_CPU] = -EC_ERROR_NOT_POWERED; - usleep(5 * SECOND); - TEST_ASSERT(!(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL))); - - /* Other failure should be pumped up to host */ - mock_temp[T_CPU] = -EC_ERROR_UNKNOWN; - usleep(5 * SECOND); - TEST_ASSERT(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL)); - - return EC_SUCCESS; -} - -static int test_sensor_info(void) -{ - struct ec_params_temp_sensor_get_info params; - struct ec_response_temp_sensor_get_info resp; - int i; - - for (i = 0; i < TEMP_SENSOR_COUNT; ++i) { - params.id = i; - TEST_ASSERT(test_send_host_command( - EC_CMD_TEMP_SENSOR_GET_INFO, - 0, ¶ms, sizeof(params), - &resp, sizeof(resp)) == EC_RES_SUCCESS); - TEST_ASSERT_ARRAY_EQ(resp.sensor_name, - temp_sensors[i].name, - strlen(resp.sensor_name)); - TEST_ASSERT(resp.sensor_type == temp_sensors[i].type); - } - - params.id = TEMP_SENSOR_COUNT; - TEST_ASSERT(test_send_host_command( - EC_CMD_TEMP_SENSOR_GET_INFO, - 0, ¶ms, sizeof(params), - &resp, sizeof(resp)) != EC_RES_SUCCESS); - - return EC_SUCCESS; -} - -static int set_threshold(int type, int threshold_id, int val) -{ - struct ec_params_thermal_set_threshold params; - - params.sensor_type = type; - params.threshold_id = threshold_id; - params.value = val; - - return test_send_host_command(EC_CMD_THERMAL_SET_THRESHOLD, 0, ¶ms, - sizeof(params), NULL, 0); -} - -static int get_threshold(int type, int threshold_id, int *val) -{ - struct ec_params_thermal_get_threshold params; - struct ec_response_thermal_get_threshold resp; - int rv; - - params.sensor_type = type; - params.threshold_id = threshold_id; - - rv = test_send_host_command(EC_CMD_THERMAL_GET_THRESHOLD, 0, ¶ms, - sizeof(params), &resp, sizeof(resp)); - if (rv != EC_RES_SUCCESS) - return rv; - - *val = resp.value; - return EC_RES_SUCCESS; -} - -static int verify_threshold(int type, int threshold_id, int val) -{ - int actual_val; - - if (get_threshold(type, threshold_id, &actual_val) != EC_RES_SUCCESS) - return 0; - return val == actual_val; -} - -static int test_threshold_hostcmd(void) -{ - reset_mock_temp(); - - /* Verify thresholds */ - TEST_ASSERT(verify_threshold(T_CPU, THRESHOLD_WARNING, - THRESHOLD(T_CPU, THRESHOLD_WARNING))); - TEST_ASSERT(verify_threshold(T_BOARD, THRESHOLD_WARNING, - THRESHOLD(T_BOARD, THRESHOLD_WARNING))); - TEST_ASSERT(verify_threshold(T_CPU, THRESHOLD_CPU_DOWN, - THRESHOLD(T_CPU, THRESHOLD_CPU_DOWN))); - - /* Lower CPU throttling threshold and trigger */ - TEST_ASSERT(set_threshold(T_CPU, THRESHOLD_WARNING, 350) == - EC_RES_SUCCESS); - mock_temp[T_CPU] = 355; - TEST_ASSERT(wait_set(&cpu_throttled, 11)); - TEST_ASSERT(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_OVERLOAD)); - - /* Lower thermal shutdown threshold */ - TEST_ASSERT(set_threshold(T_CPU, THRESHOLD_CPU_DOWN, 353) == - EC_RES_SUCCESS); - TEST_ASSERT(wait_set(&cpu_down, 11)); - TEST_ASSERT(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_SHUTDOWN)); - - /* Clear */ - mock_temp[T_CPU] = 0; - TEST_ASSERT(wait_clear(&cpu_throttled, 2)); - cpu_down = 0; - - return EC_SUCCESS; -} - -static int test_threshold_console_cmd(void) -{ - char buf[100]; - - reset_mock_temp(); - - /* Lower CPU threshold and trigger */ - snprintf(buf, 100, "thermalconf %d %d 330\n", T_CPU, THRESHOLD_WARNING); - UART_INJECT(buf); - msleep(100); - mock_temp[T_CPU] = 335; - TEST_ASSERT(wait_set(&cpu_throttled, 11)); - TEST_ASSERT(host_get_events() & - EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_OVERLOAD)); - - /* Set first fan step to 280 K */ - snprintf(buf, 100, "thermalfan %d 0 280\n", T_CPU); - UART_INJECT(buf); - msleep(100); - mock_temp[T_CPU] = 280; - TEST_ASSERT(wait_fan_rpm(fan_speed[1], 11)); - - return EC_SUCCESS; -} - -static int test_invalid_hostcmd(void) -{ - int dummy; - - TEST_ASSERT(set_threshold(TEMP_SENSOR_TYPE_COUNT, THRESHOLD_WARNING, - 100) != EC_RES_SUCCESS); - TEST_ASSERT(set_threshold(T_CPU, THRESHOLD_COUNT + THERMAL_FAN_STEPS, - 100) != EC_RES_SUCCESS); - TEST_ASSERT(get_threshold(TEMP_SENSOR_TYPE_COUNT, THRESHOLD_WARNING, - &dummy) != EC_RES_SUCCESS); - TEST_ASSERT(get_threshold(T_CPU, THRESHOLD_COUNT + THERMAL_FAN_STEPS, - &dummy) != EC_RES_SUCCESS); - - return EC_SUCCESS; -} - -static int test_auto_fan_ctrl(void) -{ - reset_mock_temp(); - - /* Disable fan control */ - pwm_set_fan_rpm_mode(0); - thermal_control_fan(0); - - /* - * Increase CPU temperature to first fan step and check the fan - * doesn't come up. - */ - mock_temp[T_CPU] = FAN_THRESHOLD(T_CPU, 0); - TEST_ASSERT(!wait_fan_rpm(fan_speed[1], 11)); - - /* Enable fan control */ - TEST_ASSERT(test_send_host_command(EC_CMD_THERMAL_AUTO_FAN_CTRL, 0, - NULL, 0, NULL, 0) == EC_RES_SUCCESS); - TEST_ASSERT(fan_rpm_mode == 1); - TEST_ASSERT(wait_fan_rpm(fan_speed[1], 11)); - - /* Disable fan control */ - pwm_set_fan_rpm_mode(0); - thermal_control_fan(0); - - /* Increase CPU temperature to second fan step */ - mock_temp[T_CPU] = FAN_THRESHOLD(T_CPU, 1); - TEST_ASSERT(!wait_fan_rpm(fan_speed[2], 11)); - - /* Enable fan control by console command */ - UART_INJECT("autofan\n"); - msleep(100); - TEST_ASSERT(fan_rpm_mode == 1); - TEST_ASSERT(wait_fan_rpm(fan_speed[2], 11)); - - - return EC_SUCCESS; -} - -static int check_assumption(void) -{ - TEST_ASSERT((int)TEMP_SENSOR_CPU == (int)TEMP_SENSOR_TYPE_CPU); - TEST_ASSERT((int)TEMP_SENSOR_BOARD == (int)TEMP_SENSOR_TYPE_BOARD); - TEST_ASSERT((int)TEMP_SENSOR_CASE == (int)TEMP_SENSOR_TYPE_CASE); - - TEST_ASSERT(temp_sensors[T_CPU].action_delay_sec != 0); - - TEST_ASSERT(thermal_config[T_CPU].config_flags & - THERMAL_CONFIG_WARNING_ON_FAIL); - - return EC_SUCCESS; -} - -void run_test(void) -{ - test_reset(); - - /* Test assumptions */ - RUN_TEST(check_assumption); - - RUN_TEST(test_init_val); - RUN_TEST(test_cpu_fan); - /* No tests for board and case temp sensors as they are ignored. */ - RUN_TEST(test_safety); - RUN_TEST(test_sensor_failure); - RUN_TEST(test_auto_fan_ctrl); - RUN_TEST(test_sensor_info); - RUN_TEST(test_threshold_hostcmd); - RUN_TEST(test_invalid_hostcmd); - RUN_TEST(test_threshold_console_cmd); - - test_print_result(); -} diff --git a/test/thermal_old.py b/test/thermal_old.py deleted file mode 100644 index 3a0453c3bb..0000000000 --- a/test/thermal_old.py +++ /dev/null @@ -1,104 +0,0 @@ -# Copyright (c) 2012 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. -# -# Thermal engine unit test -# - -CPU = 0 -BOARD = 1 -CASE = 2 - -def getWarningConfig(helper, sensor_type): - ret = dict() - helper.ec_command("thermalconf %d" % sensor_type) - ret['warning'] = int(helper.wait_output( - "Warning:\s*(?P<t>\d+) K", use_re=True)["t"]) - ret['cpudown'] = int(helper.wait_output( - "CPU Down:\s*(?P<t>\d+) K", use_re=True)["t"]) - ret['powerdown'] = int(helper.wait_output( - "Power Down:\s*(?P<t>\d+) K", use_re=True)["t"]) - return ret - -def getFanConfig(helper, sensor_type): - ret = list() - helper.ec_command("thermalfan %d" % sensor_type) - while True: - try: - match = helper.wait_output("(?P<t>\d+)\s*K:\s*(?P<r>-?\d+)\s", - use_re=True, timeout=1) - ret.append((int(match["t"]), int(match["r"]))) - except: - break - return ret - - -def test(helper): - helper.wait_output("Inits done") - - # Get thermal engine configuration - config = [getWarningConfig(helper, sensor_type) - for sensor_type in xrange(3)] - fan_config = [getFanConfig(helper, sensor_type) - for sensor_type in xrange(3)] - - # Set initial temperature values - helper.ec_command("setcputemp %d" % max(fan_config[CPU][0][0]-1, 0)) - helper.ec_command("setboardtemp %d" % max(fan_config[BOARD][0][0]-1, 0)) - helper.ec_command("setcasetemp %d" % max(fan_config[CASE][0][0]-1, 0)) - - # Increase CPU temperature to first fan step - # Check if fan comes up - helper.ec_command("setcputemp %d" % fan_config[CPU][0][0]) - helper.wait_output("Fan RPM: %d" % fan_config[CPU][0][1], timeout=11) - - # Increase CPU temperature to second fan step - helper.ec_command("setcputemp %d" % fan_config[CPU][1][0]) - helper.wait_output("Fan RPM: %d" % fan_config[CPU][1][1], timeout=11) - - # Lower CPU temperature to 1 degree below second fan step - # Check fan speed doesn't change - helper.ec_command("setcputemp %d" % (fan_config[CPU][1][0]-1)) - for i in xrange(12): - helper.wait_output("Fan RPM: %d" % fan_config[CPU][1][1], timeout=2) - - # Set CPU temperature to a high value for only one second - # Check fan speed doesn't change - helper.ec_command("setcputemp 400") - helper.wait_output("Fan RPM: %d" % fan_config[CPU][1][1]) - helper.ec_command("setcputemp %d" % fan_config[CPU][1][0]) - - # Set case temperature to first fan step - # Check fan is set to second step - helper.ec_command("setcasetemp %d" % fan_config[CASE][0][0]) - for i in xrange(12): - helper.wait_output("Fan RPM: %d" % fan_config[CASE][1][1], timeout=2) - - # Set case temperature to third fan step - # Check fan is set to third step - helper.ec_command("setcasetemp %d" % fan_config[CASE][2][0]) - helper.wait_output("Fan RPM: %d" % fan_config[CASE][2][1], timeout=11) - - # Set CPU temperature to trigger warning and throttle CPU - helper.ec_command("setcputemp %d" % config[CPU]['warning']) - helper.wait_output("Throttle CPU.", timeout=11) - host_event = helper.wait_output("Host event: (?P<h>\d+)", use_re=True, - timeout=2)["h"] - if (int(host_event, 16) & 0x200) == 0: - helper.trace("Fail to get thermal overload event") - return False - - # Lower CPU temperature and check CPU is not throttled - helper.ec_command("setcputemp %d" % (config[CPU]['warning']-5)) - helper.wait_output("No longer throttle CPU.", timeout=2) - - # Set CPU temperature to trigger CPU shutdown - helper.ec_command("setcputemp %d" % config[CPU]['cpudown']) - helper.wait_output("CPU overheated", timeout=11) - - # Set CPU temperature to trigger force shutdown - helper.ec_command("setcputemp %d" % config[CPU]['powerdown']) - helper.wait_output("Force shutdown", timeout=11) - - # Pass! - return True diff --git a/test/typematic.py b/test/typematic.py deleted file mode 100644 index f61f0ccd86..0000000000 --- a/test/typematic.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright (c) 2012 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. -# -# Keyboard typematic test -# - -import time - -KEY_PRESS_MSG = "i8042 SEND" - -def expect_keypress(helper, lower_bound, upper_bound): - for i in xrange(lower_bound + 1): # Plus 1 break code - helper.wait_output(KEY_PRESS_MSG) - for i in xrange(upper_bound - lower_bound): - if helper.check_no_output(KEY_PRESS_MSG): - return True - if not helper.check_no_output(KEY_PRESS_MSG): - return False - return True - -def test(helper): - # Wait for EC initialized - helper.wait_output("--- UART initialized") - - # Enable keyboard scanning - helper.ec_command("kbd enable") - time.sleep(0.1) # Workaround for crosbug/p/11015 - - # Set typematic rate to 1000ms/500ms and hold down a key for 500ms - # Expect 1 keypress. - helper.ec_command("typematic 1000 500") - helper.ec_command("mockmatrix 1 1 1") - time.sleep(0.5) - helper.ec_command("mockmatrix 1 1 0") - if not expect_keypress(helper, 1, 1): - return False - - # Hold down a key for 1200ms. Expect 2 keypress. - helper.ec_command("mockmatrix 1 1 1") - time.sleep(1.2) - helper.ec_command("mockmatrix 1 1 0") - if not expect_keypress(helper, 2, 2): - return False - - # Hold down a key for 1700ms. Expect 3 keypress. - helper.ec_command("mockmatrix 1 1 1") - time.sleep(1.7) - helper.ec_command("mockmatrix 1 1 0") - if not expect_keypress(helper, 3, 3): - return False - - # Hold down a key for 5400ms. Expect 9 or 10 keypress. - # Due to inevitable delay incurred by each keypress, we cannot be certain - # about the exact number of keypress. Therefore, mismatching by a small - # amount should be accepted. - helper.ec_command("mockmatrix 1 1 1") - time.sleep(5.4) - helper.ec_command("mockmatrix 1 1 0") - if not expect_keypress(helper, 9, 10): - return False - - return True # PASS ! diff --git a/test/typematic.tasklist b/test/typematic.tasklist deleted file mode 100644 index 26cfc53453..0000000000 --- a/test/typematic.tasklist +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright (c) 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. - */ - -/** - * List of enabled tasks in the priority order - * - * The first one has the lowest priority. - * - * For each task, use the macro TASK_TEST(n, r, d, s) where : - * 'n' in the name of the task - * 'r' in the main routine of the task - * 'd' in an opaque parameter passed to the routine at startup - * 's' is the stack size in bytes; must be a multiple of 8 - */ -#define CONFIG_TEST_TASK_LIST /* No test task */ |