summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2015-05-29 13:51:49 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-05 19:35:06 +0000
commitbdc680d8ed7ea24cdfb1b5498f73a1008c71ad37 (patch)
tree476e29e4edc29049843b19c3d2344ca6a2d435c0 /test
parente856db125850bfc38e341b7df055efea5ae59026 (diff)
downloadchrome-ec-bdc680d8ed7ea24cdfb1b5498f73a1008c71ad37.tar.gz
Remove obsolete EC targets
This is needed to allow cleanup and refactoring of the EC codebase in ToT. All of these boards use firmware from branches and uploaded to BCS, so they don't actually care that ToT can't build their firmware. BUG=chromium:493866 TEST=build on the following using cbuildbot: daisy-paladin falco-paladin link-paladin nyan-paladin peppy-paladin samus-paladin squawks-paladin daisy_spring-paladin CQ-DEPEND=CL:274121,CL:274127 BRANCH=none Change-Id: I19598843755ded7b2385cc712ef463e5de4411b8 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/274121 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/build.mk6
-rw-r--r--test/led_spring.c270
-rw-r--r--test/led_spring.tasklist17
l---------test/led_spring_impl.c1
-rw-r--r--test/thermal_falco.c874
-rw-r--r--test/thermal_falco.tasklist19
-rw-r--r--test/thermal_falco_externs.h15
7 files changed, 1 insertions, 1201 deletions
diff --git a/test/build.mk b/test/build.mk
index e2652d4270..5addad174f 100644
--- a/test/build.mk
+++ b/test/build.mk
@@ -11,8 +11,6 @@ test-list-y=pingpong timer_calib timer_dos timer_jump mutex utils
test-list-$(BOARD_BDS)+=
test-list-$(BOARD_PIT)+=kb_scan stress
-test-list-$(BOARD_SNOW)+=kb_scan stress
-test-list-$(BOARD_SPRING)+=kb_scan stress
# Samus has board-specific chipset code, and the tests don't
# compile with it. Disable them for now.
@@ -38,7 +36,7 @@ test-list-$(BOARD_OAK_PD)=
# Emulator tests
test-list-host=mutex pingpong utils kb_scan kb_mkbp lid_sw power_button hooks
test-list-host+=thermal flash queue kb_8042 extpwr_gpio console_edit system
-test-list-host+=sbs_charging adapter host_command thermal_falco led_spring
+test-list-host+=sbs_charging adapter host_command
test-list-host+=bklight_lid bklight_passthru interrupt timer_dos button
test-list-host+=motion_lid math_util sbs_charging_v2 battery_get_params_smart
test-list-host+=lightbar inductive_charging usb_pd fan charge_manager
@@ -62,7 +60,6 @@ interrupt-scale=10
kb_8042-y=kb_8042.o
kb_mkbp-y=kb_mkbp.o
kb_scan-y=kb_scan.o
-led_spring-y=led_spring.o led_spring_impl.o
lid_sw-y=lid_sw.o
math_util-y=math_util.o
motion_lid-y=motion_lid.o
@@ -76,7 +73,6 @@ sbs_charging_v2-y=sbs_charging_v2.o
stress-y=stress.o
system-y=system.o
thermal-y=thermal.o
-thermal_falco-y=thermal_falco.o
timer_calib-y=timer_calib.o
timer_dos-y=timer_dos.o
usb_pd-y=usb_pd.o
diff --git a/test/led_spring.c b/test/led_spring.c
deleted file mode 100644
index e1170a7992..0000000000
--- a/test/led_spring.c
+++ /dev/null
@@ -1,270 +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 lid switch.
- */
-
-#include "battery_smart.h"
-#include "common.h"
-#include "console.h"
-#include "driver/led/lp5562.h"
-#include "host_command.h"
-#include "pmu_tpschrome.h"
-#include "test_util.h"
-#include "timer.h"
-#include "util.h"
-
-#define LP5562_I2C_ADDR (0x30 << 1)
-#define LP5562_NUM_WATCH_REG 0x71
-static uint8_t lp5562_reg[LP5562_NUM_WATCH_REG];
-
-#define LED_COLOR_NONE LP5562_COLOR_NONE
-#define LED_COLOR_GREEN LP5562_COLOR_GREEN(0x10)
-#define LED_COLOR_YELLOW LP5562_COLOR_BLUE(0x40)
-#define LED_COLOR_RED LP5562_COLOR_RED(0x80)
-
-static enum charging_state mock_charge_state = ST_IDLE;
-static int lp5562_failed_i2c_reg = -1;
-static const char * const state_names[] = CHARGE_STATE_NAME_TABLE;
-
-/*****************************************************************************/
-/* Mock functions */
-
-static void set_ac(int ac)
-{
- gpio_set_level(GPIO_AC_PRESENT, ac);
- ccprintf("[%T TEST AC = %d]\n", ac);
-}
-
-enum charging_state charge_get_state(void)
-{
- return mock_charge_state;
-}
-
-static void set_charge_state(enum charging_state s)
-{
- mock_charge_state = s;
- ccprintf("[%T TEST Charge state = %s]\n", state_names[s]);
-}
-
-static void set_battery_soc(int soc)
-{
- sb_write(SB_RELATIVE_STATE_OF_CHARGE, soc);
- sb_write(SB_ABSOLUTE_STATE_OF_CHARGE, soc);
-}
-
-/*****************************************************************************/
-/* Test utilities */
-
-static int lp5562_i2c_write8(int port, int slave_addr, int offset, int data)
-{
- if (port != I2C_PORT_MASTER || slave_addr != LP5562_I2C_ADDR)
- return EC_ERROR_INVAL;
- if (offset == lp5562_failed_i2c_reg)
- return EC_ERROR_UNKNOWN;
- if (offset < LP5562_NUM_WATCH_REG)
- lp5562_reg[offset] = data;
- return EC_SUCCESS;
-}
-DECLARE_TEST_I2C_WRITE8(lp5562_i2c_write8);
-
-static int lp5562_get_color(void)
-{
- return lp5562_reg[LP5562_REG_B_PWM] |
- (lp5562_reg[LP5562_REG_G_PWM] << 8) |
- (lp5562_reg[LP5562_REG_R_PWM] << 16);
-}
-
-static int lp5562_powered(void)
-{
- return lp5562_reg[LP5562_REG_ENABLE] & 0x40;
-}
-
-static int lp5562_in_pwm_mode(void)
-{
- return lp5562_reg[LP5562_REG_LED_MAP] == 0;
-}
-
-static int verify_color(int expected_color)
-{
- int actual = lp5562_get_color();
-
- if (expected_color == LED_COLOR_NONE)
- return !lp5562_powered();
- if (!lp5562_powered())
- return 0;
- if (!lp5562_in_pwm_mode())
- return 0;
-
- ccprintf("[%T LED color = 0x%06x]\n", actual);
-
- return actual == expected_color;
-}
-
-/*****************************************************************************/
-/* Tests */
-
-static int test_led_power(void)
-{
- /* Check LED is off */
- TEST_ASSERT(!lp5562_powered());
-
- /* Plug in AC, and LED should turn on within a second */
- set_ac(1);
- msleep(1500);
- TEST_ASSERT(lp5562_powered());
-
- /* Change state while AC is on. LED should keep on */
- set_charge_state(ST_CHARGING_ERROR);
- msleep(1500);
- TEST_ASSERT(lp5562_powered());
-
- /* Unplug AC. LED should turn off */
- set_ac(0);
- msleep(1500);
- TEST_ASSERT(!lp5562_powered());
-
- /* Plug AC again. LED should turn on */
- set_ac(1);
- msleep(1500);
- TEST_ASSERT(lp5562_powered());
-
- return EC_SUCCESS;
-}
-
-static int test_led_color(void)
-{
- /* IDLE0 */
- set_ac(1);
- set_charge_state(ST_IDLE0);
- msleep(30000);
- TEST_ASSERT(verify_color(LED_COLOR_YELLOW));
-
- /* BAD_COND*/
- set_charge_state(ST_BAD_COND);
- msleep(30000);
- TEST_ASSERT(verify_color(LED_COLOR_YELLOW));
-
- /* PRE_CHARGING */
- set_charge_state(ST_PRE_CHARGING);
- msleep(30000);
- TEST_ASSERT(verify_color(LED_COLOR_YELLOW));
-
- /* IDLE */
- set_charge_state(ST_IDLE);
- set_battery_soc(50);
- msleep(30000);
- TEST_ASSERT(verify_color(LED_COLOR_YELLOW));
- set_battery_soc(99);
- msleep(30000);
- TEST_ASSERT(verify_color(LED_COLOR_GREEN));
-
- /* DISCHARGING */
- set_charge_state(ST_DISCHARGING);
- set_battery_soc(50);
- msleep(30000);
- TEST_ASSERT(verify_color(LED_COLOR_YELLOW));
- set_battery_soc(99);
- msleep(30000);
- TEST_ASSERT(verify_color(LED_COLOR_GREEN));
-
- /* CHARGING */
- set_charge_state(ST_CHARGING);
- set_battery_soc(50);
- msleep(30000);
- TEST_ASSERT(verify_color(LED_COLOR_YELLOW));
- set_battery_soc(99);
- msleep(30000);
- TEST_ASSERT(verify_color(LED_COLOR_GREEN));
-
- /* CHARGING_ERROR */
- set_charge_state(ST_CHARGING_ERROR);
- msleep(1500);
- TEST_ASSERT(verify_color(LED_COLOR_RED));
-
- return EC_SUCCESS;
-}
-
-static int test_green_yellow(void)
-{
- /* Make LED green */
- set_ac(1);
- set_charge_state(ST_CHARGING);
- set_battery_soc(95);
- msleep(30000);
- TEST_ASSERT(verify_color(LED_COLOR_GREEN));
-
- /* Make it yellow now */
- set_battery_soc(90);
- msleep(1500);
- TEST_ASSERT(verify_color(LED_COLOR_YELLOW));
-
- /* Shouldn't change from yellow to green in 15 seconds */
- set_battery_soc(95);
- msleep(13000);
- TEST_ASSERT(verify_color(LED_COLOR_YELLOW));
-
- /* After 15 seconds, it should turn green */
- msleep(3000);
- TEST_ASSERT(verify_color(LED_COLOR_GREEN));
-
- /* Shouldn't change from green to yellow in 15 seconds */
- set_charge_state(ST_BAD_COND);
- msleep(12000);
- TEST_ASSERT(verify_color(LED_COLOR_GREEN));
-
- /* After 15 seconds, it should turn yellow */
- msleep(4000);
- TEST_ASSERT(verify_color(LED_COLOR_YELLOW));
-
- return EC_SUCCESS;
-}
-
-static int test_bad_i2c(void)
-{
- /* Make LED green */
- set_ac(1);
- set_charge_state(ST_DISCHARGING);
- set_battery_soc(95);
- msleep(30000);
- TEST_ASSERT(verify_color(LED_COLOR_GREEN));
-
- /* Make it red, but fail the I2C write to green PWM register */
- lp5562_failed_i2c_reg = LP5562_REG_G_PWM;
- set_charge_state(ST_CHARGING_ERROR);
- msleep(3000);
- TEST_ASSERT(!verify_color(LED_COLOR_RED));
-
- /* I2C works again. LED should turn red */
- lp5562_failed_i2c_reg = -1;
- msleep(1500);
- TEST_ASSERT(verify_color(LED_COLOR_RED));
-
- /* Make it green, but I2C fails again */
- lp5562_failed_i2c_reg = LP5562_REG_R_PWM;
- set_charge_state(ST_DISCHARGING);
- msleep(1500);
- TEST_ASSERT(!verify_color(LED_COLOR_GREEN));
- TEST_ASSERT(!verify_color(LED_COLOR_RED));
-
- /* I2C works now, but LED turns red at the same time */
- lp5562_failed_i2c_reg = -1;
- set_charge_state(ST_CHARGING_ERROR);
- msleep(1500);
- TEST_ASSERT(verify_color(LED_COLOR_RED));
-
- return EC_SUCCESS;
-}
-
-void run_test(void)
-{
- test_reset();
-
- RUN_TEST(test_led_power);
- RUN_TEST(test_led_color);
- RUN_TEST(test_green_yellow);
- RUN_TEST(test_bad_i2c);
-
- test_print_result();
-}
diff --git a/test/led_spring.tasklist b/test/led_spring.tasklist
deleted file mode 100644
index 26cfc53453..0000000000
--- a/test/led_spring.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/led_spring_impl.c b/test/led_spring_impl.c
deleted file mode 120000
index 25fcf73a27..0000000000
--- a/test/led_spring_impl.c
+++ /dev/null
@@ -1 +0,0 @@
-../board/spring/led.c \ No newline at end of file
diff --git a/test/thermal_falco.c b/test/thermal_falco.c
deleted file mode 100644
index 885dcfcdfb..0000000000
--- a/test/thermal_falco.c
+++ /dev/null
@@ -1,874 +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 "battery.h"
-#include "battery_smart.h"
-#include "chipset.h"
-#include "common.h"
-#include "console.h"
-#include "extpower.h"
-#include "extpower_falco.h"
-#include "fan.h"
-#include "hooks.h"
-#include "host_command.h"
-#include "printf.h"
-#include "temp_sensor.h"
-#include "test_util.h"
-#include "thermal.h"
-#include "throttle_ap.h"
-#include "timer.h"
-#include "util.h"
-
-/* Normally private stuff from the modules we're going to test */
-#include "thermal_falco_externs.h"
-
-
-/*****************************************************************************/
-/* Exported data */
-
-struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT];
-
-/* The tests below make some assumptions. */
-BUILD_ASSERT(TEMP_SENSOR_COUNT == 4);
-BUILD_ASSERT(EC_TEMP_THRESH_COUNT == 3);
-
-/*****************************************************************************/
-/* Mock functions */
-
-static int mock_temp[TEMP_SENSOR_COUNT];
-static int host_throttled;
-static int cpu_throttled;
-static int cpu_shutdown;
-static int fan_pct;
-static int no_temps_read;
-static int mock_id;
-static int mock_ac;
-static int mock_charger_current;
-static int mock_battery_discharge_current;
-
-/* constants to match against throttling sources */
-static const int t_s_therm = (1 << THROTTLE_SRC_THERMAL);
-static const int t_s_power = (1 << THROTTLE_SRC_POWER);
-static const int t_s_both = ((1 << THROTTLE_SRC_THERMAL) |
- (1 << THROTTLE_SRC_POWER));
-
-int dummy_temp_get_val(int idx, int *temp_ptr)
-{
- if (mock_temp[idx] >= 0) {
- *temp_ptr = mock_temp[idx];
- return EC_SUCCESS;
- }
-
- return EC_ERROR_NOT_POWERED;
-}
-
-void chipset_force_shutdown(void)
-{
- cpu_shutdown = 1;
-}
-
-void chipset_throttle_cpu(int throttled)
-{
- cpu_throttled = throttled;
-}
-
-void host_throttle_cpu(int throttled)
-{
- host_throttled = throttled;
-}
-
-void fan_set_percent_needed(int fan, int pct)
-{
- fan_pct = pct;
-}
-
-void smi_sensor_failure_warning(void)
-{
- no_temps_read = 1;
-}
-
-static void change_ac(int val)
-{
- mock_ac = val;
- extpower_interrupt(GPIO_AC_PRESENT);
- sleep(1);
-}
-
-int gpio_get_level(enum gpio_signal signal)
-{
- if (signal == GPIO_AC_PRESENT)
- return mock_ac;
- return 0;
-}
-
-int adc_read_channel(enum adc_channel ch)
-{
- switch (ch) {
- case ADC_AC_ADAPTER_ID_VOLTAGE:
- return mock_id;
- case ADC_CH_CHARGER_CURRENT:
- return mock_charger_current;
- default:
- break;
- }
-
- return 0;
-}
-
-/*****************************************************************************/
-/* Test utilities */
-
-static void set_temps(int t0, int t1, int t2, int t3)
-{
- mock_temp[0] = t0;
- mock_temp[1] = t1;
- mock_temp[2] = t2;
- mock_temp[3] = t3;
-}
-
-static void all_temps(int t)
-{
- set_temps(t, t, t, t);
-}
-
-static void reset_mock_battery(void)
-{
- const struct battery_info *bat_info = battery_get_info();
-
- /* 50% of charge */
- sb_write(SB_RELATIVE_STATE_OF_CHARGE, 50);
- sb_write(SB_ABSOLUTE_STATE_OF_CHARGE, 50);
- /* 25 degree Celsius */
- sb_write(SB_TEMPERATURE, 250 + 2731);
- /* Normal voltage */
- sb_write(SB_VOLTAGE, bat_info->voltage_normal);
- sb_write(SB_CHARGING_VOLTAGE, bat_info->voltage_max);
- sb_write(SB_CHARGING_CURRENT, 4000);
- /* Discharging at 100mAh */
- sb_write(SB_CURRENT, -100);
-}
-DECLARE_HOOK(HOOK_INIT, reset_mock_battery, HOOK_PRIO_DEFAULT);
-
-static void mock_batt(int cur)
-{
- sb_write(SB_CURRENT, -cur); /* discharge current is neg here */
-}
-
-static void reset_mocks(void)
-{
- /* Ignore all sensors */
- memset(thermal_params, 0, sizeof(thermal_params));
-
- /* All sensors report error anyway */
- set_temps(-1, -1 , -1, -1);
-
- /* Reset expectations */
- host_throttled = 0;
- cpu_throttled = 0;
- cpu_shutdown = 0;
- fan_pct = 0;
- no_temps_read = 0;
-
- /* other mocked inputs */
- mock_id = 0;
- mock_ac = 0;
- mock_charger_current = 0;
- mock_battery_discharge_current = 0;
-}
-
-/*****************************************************************************/
-/* Tests */
-
-static int test_init_val(void)
-{
- reset_mocks();
- sleep(2);
-
- TEST_ASSERT(host_throttled == 0);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
- TEST_ASSERT(fan_pct == 0);
- TEST_ASSERT(no_temps_read);
-
- sleep(2);
-
- TEST_ASSERT(host_throttled == 0);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
- TEST_ASSERT(fan_pct == 0);
- TEST_ASSERT(no_temps_read);
-
- return EC_SUCCESS;
-}
-
-static int test_sensors_can_be_read(void)
-{
- reset_mocks();
- mock_temp[2] = 100;
-
- sleep(2);
-
- TEST_ASSERT(host_throttled == 0);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
- TEST_ASSERT(fan_pct == 0);
- TEST_ASSERT(no_temps_read == 0);
-
- return EC_SUCCESS;
-}
-
-
-static int test_one_fan(void)
-{
- reset_mocks();
- thermal_params[2].temp_fan_off = 100;
- thermal_params[2].temp_fan_max = 200;
-
- all_temps(50);
- sleep(2);
- TEST_ASSERT(fan_pct == 0);
-
- all_temps(100);
- sleep(2);
- TEST_ASSERT(fan_pct == 0);
-
- all_temps(101);
- sleep(2);
- TEST_ASSERT(fan_pct == 1);
-
- all_temps(130);
- sleep(2);
- TEST_ASSERT(fan_pct == 30);
-
- all_temps(150);
- sleep(2);
- TEST_ASSERT(fan_pct == 50);
-
- all_temps(170);
- sleep(2);
- TEST_ASSERT(fan_pct == 70);
-
- all_temps(200);
- sleep(2);
- TEST_ASSERT(fan_pct == 100);
-
- all_temps(300);
- sleep(2);
- TEST_ASSERT(fan_pct == 100);
-
- return EC_SUCCESS;
-}
-
-static int test_two_fans(void)
-{
- reset_mocks();
-
- thermal_params[1].temp_fan_off = 120;
- thermal_params[1].temp_fan_max = 160;
- thermal_params[2].temp_fan_off = 100;
- thermal_params[2].temp_fan_max = 200;
-
- all_temps(50);
- sleep(2);
- TEST_ASSERT(fan_pct == 0);
-
- all_temps(100);
- sleep(2);
- TEST_ASSERT(fan_pct == 0);
-
- all_temps(101);
- sleep(2);
- TEST_ASSERT(fan_pct == 1);
-
- all_temps(130);
- sleep(2);
- /* fan 2 is still higher */
- TEST_ASSERT(fan_pct == 30);
-
- all_temps(150);
- sleep(2);
- /* now fan 1 is higher: 150 = 75% of [120-160] */
- TEST_ASSERT(fan_pct == 75);
-
- all_temps(170);
- sleep(2);
- /* fan 1 is maxed now */
- TEST_ASSERT(fan_pct == 100);
-
- all_temps(200);
- sleep(2);
- TEST_ASSERT(fan_pct == 100);
-
- all_temps(300);
- sleep(2);
- TEST_ASSERT(fan_pct == 100);
-
- return EC_SUCCESS;
-}
-
-static int test_all_fans(void)
-{
- reset_mocks();
-
- thermal_params[0].temp_fan_off = 20;
- thermal_params[0].temp_fan_max = 60;
- thermal_params[1].temp_fan_off = 120;
- thermal_params[1].temp_fan_max = 160;
- thermal_params[2].temp_fan_off = 100;
- thermal_params[2].temp_fan_max = 200;
- thermal_params[3].temp_fan_off = 300;
- thermal_params[3].temp_fan_max = 500;
-
- set_temps(1, 1, 1, 1);
- sleep(2);
- TEST_ASSERT(fan_pct == 0);
-
- /* Each sensor has its own range */
- set_temps(40, 0, 0, 0);
- sleep(2);
- TEST_ASSERT(fan_pct == 50);
-
- set_temps(0, 140, 0, 0);
- sleep(2);
- TEST_ASSERT(fan_pct == 50);
-
- set_temps(0, 0, 150, 0);
- sleep(2);
- TEST_ASSERT(fan_pct == 50);
-
- set_temps(0, 0, 0, 400);
- sleep(2);
- TEST_ASSERT(fan_pct == 50);
-
- set_temps(60, 0, 0, 0);
- sleep(2);
- TEST_ASSERT(fan_pct == 100);
-
- set_temps(0, 160, 0, 0);
- sleep(2);
- TEST_ASSERT(fan_pct == 100);
-
- set_temps(0, 0, 200, 0);
- sleep(2);
- TEST_ASSERT(fan_pct == 100);
-
- set_temps(0, 0, 0, 500);
- sleep(2);
- TEST_ASSERT(fan_pct == 100);
-
- /* But sensor 0 needs the most cooling */
- all_temps(20);
- sleep(2);
- TEST_ASSERT(fan_pct == 0);
-
- all_temps(21);
- sleep(2);
- TEST_ASSERT(fan_pct == 2);
-
- all_temps(30);
- sleep(2);
- TEST_ASSERT(fan_pct == 25);
-
- all_temps(40);
- sleep(2);
- TEST_ASSERT(fan_pct == 50);
-
- all_temps(50);
- sleep(2);
- TEST_ASSERT(fan_pct == 75);
-
- all_temps(60);
- sleep(2);
- TEST_ASSERT(fan_pct == 100);
-
- all_temps(65);
- sleep(2);
- TEST_ASSERT(fan_pct == 100);
-
- return EC_SUCCESS;
-}
-
-static int test_one_limit(void)
-{
- reset_mocks();
- thermal_params[2].temp_host[EC_TEMP_THRESH_WARN] = 100;
- thermal_params[2].temp_host[EC_TEMP_THRESH_HIGH] = 200;
- thermal_params[2].temp_host[EC_TEMP_THRESH_HALT] = 300;
-
- all_temps(50);
- sleep(2);
- TEST_ASSERT(host_throttled == 0);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
-
- all_temps(100);
- sleep(2);
- TEST_ASSERT(host_throttled == 0);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
-
- all_temps(101);
- sleep(2);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
-
- all_temps(100);
- sleep(2);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
-
- all_temps(99);
- sleep(2);
- TEST_ASSERT(host_throttled == 0);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
-
- all_temps(199);
- sleep(2);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
-
- all_temps(200);
- sleep(2);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
-
- all_temps(201);
- sleep(2);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == t_s_therm);
- TEST_ASSERT(cpu_shutdown == 0);
-
- all_temps(200);
- sleep(2);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == t_s_therm);
- TEST_ASSERT(cpu_shutdown == 0);
-
- all_temps(199);
- sleep(2);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
-
- all_temps(99);
- sleep(2);
- TEST_ASSERT(host_throttled == 0);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
-
- all_temps(201);
- sleep(2);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == t_s_therm);
- TEST_ASSERT(cpu_shutdown == 0);
-
- all_temps(99);
- sleep(2);
- TEST_ASSERT(host_throttled == 0);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
-
- all_temps(301);
- sleep(2);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == t_s_therm);
- TEST_ASSERT(cpu_shutdown == 1);
-
- /* We probably won't be able to read the CPU temp while shutdown,
- * so nothing will change. */
- all_temps(-1);
- sleep(2);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == t_s_therm);
- /* cpu_shutdown is only set for testing purposes. The thermal task
- * doesn't do anything that could clear it. */
-
- all_temps(50);
- sleep(2);
- TEST_ASSERT(host_throttled == 0);
- TEST_ASSERT(cpu_throttled == 0);
-
- return EC_SUCCESS;
-}
-
-static int test_several_limits(void)
-{
- reset_mocks();
-
- thermal_params[1].temp_host[EC_TEMP_THRESH_WARN] = 150;
- thermal_params[1].temp_host[EC_TEMP_THRESH_HIGH] = 200;
- thermal_params[1].temp_host[EC_TEMP_THRESH_HALT] = 250;
-
- thermal_params[2].temp_host[EC_TEMP_THRESH_WARN] = 100;
- thermal_params[2].temp_host[EC_TEMP_THRESH_HIGH] = 200;
- thermal_params[2].temp_host[EC_TEMP_THRESH_HALT] = 300;
-
- thermal_params[3].temp_host[EC_TEMP_THRESH_WARN] = 20;
- thermal_params[3].temp_host[EC_TEMP_THRESH_HIGH] = 30;
- thermal_params[3].temp_host[EC_TEMP_THRESH_HALT] = 40;
-
- set_temps(500, 100, 150, 10);
- sleep(2);
- TEST_ASSERT(host_throttled == t_s_therm); /* 1=low, 2=warn, 3=low */
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
-
- set_temps(500, 50, -1, 10); /* 1=low, 2=X, 3=low */
- sleep(2);
- TEST_ASSERT(host_throttled == 0);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
-
- set_temps(500, 170, 210, 10); /* 1=warn, 2=high, 3=low */
- sleep(2);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == t_s_therm);
- TEST_ASSERT(cpu_shutdown == 0);
-
- set_temps(500, 100, 50, 40); /* 1=low, 2=low, 3=high */
- sleep(2);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == t_s_therm);
- TEST_ASSERT(cpu_shutdown == 0);
-
- set_temps(500, 100, 50, 41); /* 1=low, 2=low, 3=shutdown */
- sleep(2);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == t_s_therm);
- TEST_ASSERT(cpu_shutdown == 1);
-
- all_temps(0); /* reset from shutdown */
- sleep(2);
- TEST_ASSERT(host_throttled == 0);
- TEST_ASSERT(cpu_throttled == 0);
-
-
- return EC_SUCCESS;
-}
-
-static int test_batt(void)
-{
- struct adapter_limits *l;
- int longtime;
- int i;
-
- reset_mocks();
- /* We're assuming two limits, mild and urgent. */
- TEST_ASSERT(NUM_BATT_THRESHOLDS == 2);
- /* Find out which is which, only use the lower one */
- if (batt_limits[0].hi_val > batt_limits[1].hi_val)
- l = &batt_limits[1];
- else
- l = &batt_limits[0];
-
- /* Find a time longer than all sample count limits */
- for (i = longtime = 0; i < NUM_BATT_THRESHOLDS; i++)
- longtime = MAX(longtime,
- MAX(batt_limits[i].lo_cnt,
- batt_limits[i].hi_cnt));
- longtime += 2;
-
- /* On AC, but this doesn't actually matter for this test */
- mock_batt(0);
- change_ac(1);
-
- TEST_ASSERT(ap_is_throttled == 0);
- change_ac(0);
- TEST_ASSERT(ap_is_throttled == 0);
-
- /* reset, by staying low for a long time */
- usleep(EXTPOWER_FALCO_POLL_PERIOD * longtime);
- TEST_ASSERT(l->triggered == 0);
- TEST_ASSERT(ap_is_throttled == 0);
-
- /* mock_batt() specifies the DISCHARGE current. Charging
- * should do nothing, no matter how high. */
- mock_batt(-1);
- usleep(EXTPOWER_FALCO_POLL_PERIOD * longtime);
- TEST_ASSERT(l->triggered == 0);
- TEST_ASSERT(ap_is_throttled == 0);
-
- /* midrange for a long time shouldn't do anything */
- mock_batt((l->lo_val + l->hi_val) / 2);
- usleep(EXTPOWER_FALCO_POLL_PERIOD * longtime);
- TEST_ASSERT(l->triggered == 0);
- TEST_ASSERT(ap_is_throttled == 0);
-
- /* above high limit for not quite long enough */
- mock_batt(l->hi_val + 1);
- usleep(EXTPOWER_FALCO_POLL_PERIOD * (l->hi_cnt - 1));
- TEST_ASSERT(l->count != 0);
- TEST_ASSERT(l->triggered == 0);
- TEST_ASSERT(ap_is_throttled == 0);
-
- /* drop below the high limit once */
- mock_batt(l->hi_val - 1);
- usleep(EXTPOWER_FALCO_POLL_PERIOD * 1);
- TEST_ASSERT(l->count == 0);
- TEST_ASSERT(l->triggered == 0);
- TEST_ASSERT(ap_is_throttled == 0);
-
- /* now back up */
- mock_batt(l->hi_val + 1);
- usleep(EXTPOWER_FALCO_POLL_PERIOD * (l->hi_cnt - 1));
- TEST_ASSERT(l->count != 0);
- TEST_ASSERT(l->triggered == 0);
- TEST_ASSERT(ap_is_throttled == 0);
-
- /* one more ought to do it */
- usleep(EXTPOWER_FALCO_POLL_PERIOD * 1);
- TEST_ASSERT(l->triggered == 1);
- TEST_ASSERT(ap_is_throttled);
-
- /* going midrange for a long time shouldn't change anything */
- mock_batt((l->lo_val + l->hi_val) / 2);
- usleep(EXTPOWER_FALCO_POLL_PERIOD * longtime);
- TEST_ASSERT(l->triggered == 1);
- TEST_ASSERT(ap_is_throttled);
-
- /* charge for not quite long enough */
- mock_batt(-1);
- usleep(EXTPOWER_FALCO_POLL_PERIOD * (l->lo_cnt - 1));
- TEST_ASSERT(l->triggered == 1);
- TEST_ASSERT(ap_is_throttled);
-
- /* back above the low limit once */
- mock_batt(l->lo_val + 1);
- usleep(EXTPOWER_FALCO_POLL_PERIOD * 1);
- TEST_ASSERT(l->triggered == 1);
- TEST_ASSERT(ap_is_throttled);
-
- /* now charge again - that should have reset the count */
- mock_batt(-1);
- usleep(EXTPOWER_FALCO_POLL_PERIOD * (l->lo_cnt - 1));
- TEST_ASSERT(l->triggered == 1);
- TEST_ASSERT(ap_is_throttled);
-
- /* One more ought to do it */
- usleep(EXTPOWER_FALCO_POLL_PERIOD * 1);
- TEST_ASSERT(l->triggered == 0);
- TEST_ASSERT(ap_is_throttled == 0);
-
- return EC_SUCCESS;
-}
-
-static int test_several_limits_with_batt(void)
-{
- struct adapter_limits *l;
- int longtime;
- int i;
-
- /* We're assuming two limits, mild and urgent. */
- TEST_ASSERT(NUM_BATT_THRESHOLDS == 2);
- /* Find out which is which, only use the lower one */
- if (batt_limits[0].hi_val > batt_limits[1].hi_val)
- l = &batt_limits[1];
- else
- l = &batt_limits[0];
-
- /* Find a time longer than all sample count limits */
- for (i = longtime = 0; i < NUM_BATT_THRESHOLDS; i++)
- longtime = MAX(longtime,
- MAX(batt_limits[i].lo_cnt,
- batt_limits[i].hi_cnt));
- longtime += 2;
- longtime *= EXTPOWER_FALCO_POLL_PERIOD;
-
- reset_mocks();
-
- /* Set some thermal limits */
- thermal_params[1].temp_host[EC_TEMP_THRESH_WARN] = 150;
- thermal_params[1].temp_host[EC_TEMP_THRESH_HIGH] = 200;
- thermal_params[1].temp_host[EC_TEMP_THRESH_HALT] = 250;
-
- thermal_params[2].temp_host[EC_TEMP_THRESH_WARN] = 100;
- thermal_params[2].temp_host[EC_TEMP_THRESH_HIGH] = 200;
- thermal_params[2].temp_host[EC_TEMP_THRESH_HALT] = 300;
-
- thermal_params[3].temp_host[EC_TEMP_THRESH_WARN] = 20;
- thermal_params[3].temp_host[EC_TEMP_THRESH_HIGH] = 30;
- thermal_params[3].temp_host[EC_TEMP_THRESH_HALT] = 40;
-
-
- /* On AC, charging */
- mock_batt(-1);
- all_temps(0);
- change_ac(1);
- usleep(longtime);
- /* Everything is ready */
- TEST_ASSERT(l->triggered == 0);
- TEST_ASSERT(ap_is_throttled == 0);
- TEST_ASSERT(host_throttled == 0);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
-
-
- set_temps(500, 100, 150, 10);
- usleep(longtime);
- TEST_ASSERT(host_throttled == t_s_therm); /* 1=low, 2=warn, 3=low */
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
-
- /* battery up and down */
- mock_batt(l->hi_val + 1);
- usleep(longtime);
- TEST_ASSERT(l->triggered == 1);
- TEST_ASSERT(ap_is_throttled);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(host_throttled == t_s_both); /* 1=low, 2=warn, 3=low */
- TEST_ASSERT(cpu_shutdown == 0);
- mock_batt(-1);
- usleep(longtime);
- TEST_ASSERT(l->triggered == 0);
- TEST_ASSERT(ap_is_throttled == 0);
- TEST_ASSERT(host_throttled == t_s_therm); /* 1=low, 2=warn, 3=low */
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
-
-
- set_temps(500, 50, -1, 10); /* 1=low, 2=X, 3=low */
- usleep(longtime);
- TEST_ASSERT(host_throttled == 0);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
- TEST_ASSERT(l->triggered == 0);
- TEST_ASSERT(ap_is_throttled == 0);
-
- /* battery up and down */
- mock_batt(l->hi_val + 1);
- usleep(longtime);
- TEST_ASSERT(l->triggered == 1);
- TEST_ASSERT(ap_is_throttled);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(host_throttled == t_s_power);
- TEST_ASSERT(cpu_shutdown == 0);
- mock_batt(-1);
- usleep(longtime);
- TEST_ASSERT(l->triggered == 0);
- TEST_ASSERT(ap_is_throttled == 0);
- TEST_ASSERT(host_throttled == 0);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(cpu_shutdown == 0);
-
-
- set_temps(500, 170, 210, 10); /* 1=warn, 2=high, 3=low */
- sleep(2);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == t_s_therm);
- TEST_ASSERT(cpu_shutdown == 0);
-
- /* battery up and down */
- mock_batt(l->hi_val + 1);
- usleep(longtime);
- TEST_ASSERT(l->triggered == 1);
- TEST_ASSERT(ap_is_throttled);
- TEST_ASSERT(cpu_throttled == t_s_therm);
- TEST_ASSERT(host_throttled == t_s_both);
- TEST_ASSERT(cpu_shutdown == 0);
- mock_batt(-1);
- usleep(longtime);
- TEST_ASSERT(l->triggered == 0);
- TEST_ASSERT(ap_is_throttled == 0);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == t_s_therm);
- TEST_ASSERT(cpu_shutdown == 0);
-
-
- set_temps(500, 100, 50, 40); /* 1=low, 2=low, 3=high */
- usleep(longtime);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == t_s_therm);
- TEST_ASSERT(cpu_shutdown == 0);
-
- /* battery up and down */
- mock_batt(l->hi_val + 1);
- usleep(longtime);
- TEST_ASSERT(l->triggered == 1);
- TEST_ASSERT(ap_is_throttled);
- TEST_ASSERT(cpu_throttled == t_s_therm);
- TEST_ASSERT(host_throttled == t_s_both);
- TEST_ASSERT(cpu_shutdown == 0);
- mock_batt(-1);
- usleep(longtime);
- TEST_ASSERT(l->triggered == 0);
- TEST_ASSERT(ap_is_throttled == 0);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == t_s_therm);
- TEST_ASSERT(cpu_shutdown == 0);
-
-
- set_temps(500, 100, 50, 41); /* 1=low, 2=low, 3=shutdown */
- usleep(longtime);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == t_s_therm);
- TEST_ASSERT(cpu_shutdown == 1);
-
- /* battery up and down */
- mock_batt(l->hi_val + 1);
- usleep(longtime);
- TEST_ASSERT(l->triggered == 1);
- TEST_ASSERT(ap_is_throttled);
- TEST_ASSERT(cpu_throttled == t_s_therm);
- TEST_ASSERT(host_throttled == t_s_both);
- TEST_ASSERT(cpu_shutdown == 1);
- mock_batt(-1);
- usleep(longtime);
- TEST_ASSERT(l->triggered == 0);
- TEST_ASSERT(ap_is_throttled == 0);
- TEST_ASSERT(host_throttled == t_s_therm);
- TEST_ASSERT(cpu_throttled == t_s_therm);
- TEST_ASSERT(cpu_shutdown == 1);
-
-
- all_temps(0);
- usleep(longtime);
- TEST_ASSERT(host_throttled == 0);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(l->triggered == 0);
- TEST_ASSERT(ap_is_throttled == 0);
-
- /* battery up and down */
- mock_batt(l->hi_val + 1);
- usleep(longtime);
- TEST_ASSERT(l->triggered == 1);
- TEST_ASSERT(ap_is_throttled);
- TEST_ASSERT(cpu_throttled == 0);
- TEST_ASSERT(host_throttled == t_s_power);
- mock_batt(-1);
- usleep(longtime);
- TEST_ASSERT(l->triggered == 0);
- TEST_ASSERT(ap_is_throttled == 0);
- TEST_ASSERT(host_throttled == 0);
- TEST_ASSERT(cpu_throttled == 0);
-
- return EC_SUCCESS;
-}
-
-
-void run_test(void)
-{
- test_chipset_on();
-
- RUN_TEST(test_init_val);
- RUN_TEST(test_sensors_can_be_read);
- RUN_TEST(test_one_fan);
- RUN_TEST(test_two_fans);
- RUN_TEST(test_all_fans);
-
- RUN_TEST(test_one_limit);
- RUN_TEST(test_several_limits);
-
- RUN_TEST(test_batt);
- RUN_TEST(test_several_limits_with_batt);
-
- test_print_result();
-}
diff --git a/test/thermal_falco.tasklist b/test/thermal_falco.tasklist
deleted file mode 100644
index 6ca1e65553..0000000000
--- a/test/thermal_falco.tasklist
+++ /dev/null
@@ -1,19 +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 \
- TASK_TEST(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \
- TASK_TEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE)
diff --git a/test/thermal_falco_externs.h b/test/thermal_falco_externs.h
deleted file mode 100644
index 48c3c0ef18..0000000000
--- a/test/thermal_falco_externs.h
+++ /dev/null
@@ -1,15 +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.
- */
-
-#ifndef __THERMAL_FALCO_EXTERNS_H
-#define __THERMAL_FALCO_EXTERNS_H
-
-/* Normally private symbols from the modules that we're testing. */
-extern struct adapter_limits
- ad_limits[][NUM_AC_TURBO_STATES][NUM_AC_THRESHOLDS];
-extern uint32_t ap_is_throttled;
-extern struct adapter_limits batt_limits[NUM_BATT_THRESHOLDS];
-
-#endif /* __THERMAL_FALCO_EXTERNS_H */