cleanup: move test mocks to board/host and remove unused mocks

Now that we have a better test framework in place, mock
implementations go in either chip/host/ or board/host/, depending on
whether they're mocking chip or common/board functionality.  Move the
remaining mocks there.  Also, several mocks were neither compiled nor
used, and haven't kept pace with other refactoring; delete those.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all board; pass all unit tests

Change-Id: Ie2a81c3ccd4506679192d979aa87fe7ed6c1c5a0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/169873
This commit is contained in:
Randall Spangler
2013-09-16 15:44:19 -07:00
committed by chrome-internal-fetch
parent a7f5224a83
commit 883dd51006
7 changed files with 1 additions and 212 deletions

View File

@@ -10,3 +10,4 @@ CHIP:=host
board-y=board.o
board-$(HAS_TASK_CHIPSET)+=chipset.o
board-$(CONFIG_BATTERY_MOCK)+=smart_battery.o charger.o

View File

@@ -22,7 +22,6 @@ common-$(CONFIG_BACKLIGHT_X86)+=backlight_x86.o
common-$(CONFIG_BATTERY_BQ20Z453)+=battery_bq20z453.o
common-$(CONFIG_BATTERY_BQ27541)+=battery.o battery_bq27541.o
common-$(CONFIG_BATTERY_LINK)+=battery_link.o
common-$(CONFIG_BATTERY_MOCK)+=mock_smart_battery.o mock_charger.o
common-$(CONFIG_BATTERY_SMART)+=battery.o smart_battery.o
common-$(CONFIG_CHARGER)+=charge_state.o charger_common.o
common-$(CONFIG_CHARGER_BQ24192)+=charger_bq24192.o

View File

@@ -1,45 +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.
*
* Mock EC i8042 interface code.
*/
#include "keyboard_i8042.h"
#include "timer.h"
#include "uart.h"
void keyboard_receive(int data, int is_cmd)
{
/* Not implemented */
return;
}
void keyboard_protocol_task(void)
{
/* Do nothing */
while (1)
sleep(5);
}
enum ec_error_list i8042_send_to_host(int len, const uint8_t *bytes)
{
int i;
uart_printf("i8042 SEND:");
for (i = 0; i < len; ++i)
uart_printf(" %02x", bytes[i]);
uart_printf("\n");
return EC_SUCCESS;
}
void i8042_enable_keyboard_irq(int enable)
{
/* Not implemented */
return;
}
void i8042_flush_buffer()
{
/* Not implemented */
return;
}

View File

@@ -1,76 +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.
*/
/* Mock temperature sensor module for Chrome EC */
#include "common.h"
#include "console.h"
#include "temp_sensor.h"
#include "timer.h"
#include "util.h"
static int temp_val[TEMP_SENSOR_TYPE_COUNT];
int temp_sensor_powered(enum temp_sensor_id id)
{
/* Always powered */
return 1;
}
int temp_sensor_read(enum temp_sensor_id id)
{
return temp_val[temp_sensors[id].type];
}
void temp_sensor_task(void)
{
/* Do nothing */
while (1)
sleep(5);
}
static int command_set_temp(int argc, char **argv, int type)
{
char *e;
int t;
ASSERT(argc == 2);
t = strtoi(argv[1], &e, 0);
temp_val[type] = t;
return EC_SUCCESS;
}
static int command_set_cpu_temp(int argc, char **argv)
{
return command_set_temp(argc, argv, TEMP_SENSOR_TYPE_CPU);
}
DECLARE_CONSOLE_COMMAND(setcputemp, command_set_cpu_temp,
"value",
"Set mock CPU temperature value",
NULL);
static int command_set_board_temp(int argc, char **argv)
{
return command_set_temp(argc, argv, TEMP_SENSOR_TYPE_BOARD);
}
DECLARE_CONSOLE_COMMAND(setboardtemp, command_set_board_temp,
"value",
"Set mock board temperature value",
NULL);
static int command_set_case_temp(int argc, char **argv)
{
return command_set_temp(argc, argv, TEMP_SENSOR_TYPE_CASE);
}
DECLARE_CONSOLE_COMMAND(setcasetemp, command_set_case_temp,
"value",
"Set mock case temperature value",
NULL);

View File

@@ -1,90 +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.
*/
/* Mock X86 chipset power control module for Chrome EC */
#include "chipset.h"
#include "chipset_x86_common.h"
#include "console.h"
#include "lpc.h"
#include "timer.h"
#include "uart.h"
#include "util.h"
static int mock_power_on = 0;
void chipset_force_shutdown(void)
{
uart_puts("Force shutdown\n");
mock_power_on = 0;
}
void chipset_reset(int cold_reset)
{
uart_printf("X86 Power %s reset\n", cold_reset ? "cold" : "warm");
}
void chipset_throttle_cpu(int throttle)
{
/* Print transitions */
static int last_val = 0;
if (throttle != last_val) {
if (throttle)
uart_printf("Throttle CPU.\n");
else
uart_printf("No longer throttle CPU.\n");
last_val = throttle;
}
}
void chipset_exit_hard_off(void)
{
/* Not implemented */
return;
}
int chipset_in_state(int state_mask)
{
if (mock_power_on)
return state_mask == CHIPSET_STATE_ON;
else
return (state_mask == CHIPSET_STATE_SOFT_OFF) ||
(state_mask == CHIPSET_STATE_ANY_OFF);
}
void x86_interrupt(enum gpio_signal signal)
{
/* Not implemented */
return;
}
void chipset_task(void)
{
/* Do nothing */
while (1)
sleep(5);
}
static int command_mock_power(int argc, char **argv)
{
if (argc != 2)
return EC_ERROR_PARAM_COUNT;
if (!parse_bool(argv[1], &mock_power_on))
return EC_ERROR_PARAM1;
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(powermock, command_mock_power,
"<on | off>",
"Mock power state",
NULL);