summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/mock/dp_alt_mode_mock.c4
-rw-r--r--common/mock/fp_sensor_mock.c4
-rw-r--r--common/mock/fpsensor_detect_mock.c4
-rw-r--r--common/mock/fpsensor_state_mock.c4
-rw-r--r--common/mock/mkbp_events_mock.c6
-rw-r--r--common/mock/rollback_mock.c4
-rw-r--r--common/mock/tcpc_mock.c4
-rw-r--r--common/mock/tcpci_i2c_mock.c4
-rw-r--r--common/mock/tcpm_mock.c4
-rw-r--r--common/mock/timer_mock.c4
-rw-r--r--common/mock/usb_mux_mock.c4
-rw-r--r--common/mock/usb_pd_dpm_mock.c4
-rw-r--r--common/mock/usb_pd_mock.c4
-rw-r--r--common/mock/usb_pe_sm_mock.c3
-rw-r--r--common/mock/usb_prl_mock.c4
-rw-r--r--common/mock/usb_tc_sm_mock.c4
16 files changed, 64 insertions, 1 deletions
diff --git a/common/mock/dp_alt_mode_mock.c b/common/mock/dp_alt_mode_mock.c
index 0b68f4a9b3..c489d39830 100644
--- a/common/mock/dp_alt_mode_mock.c
+++ b/common/mock/dp_alt_mode_mock.c
@@ -12,6 +12,10 @@
#include "usb_dp_alt_mode.h"
#include "mock/dp_alt_mode_mock.h"
+#ifndef TEST_BUILD
+#error "Mocks should only be in the test build."
+#endif
+
#ifdef CONFIG_COMMON_RUNTIME
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
diff --git a/common/mock/fp_sensor_mock.c b/common/mock/fp_sensor_mock.c
index 18e6d656be..363f092ff1 100644
--- a/common/mock/fp_sensor_mock.c
+++ b/common/mock/fp_sensor_mock.c
@@ -14,6 +14,10 @@
#include "fpsensor.h"
#include "mock/fp_sensor_mock.h"
+#ifndef TEST_BUILD
+#error "Mocks should only be in the test build."
+#endif
+
struct mock_ctrl_fp_sensor mock_ctrl_fp_sensor = MOCK_CTRL_DEFAULT_FP_SENSOR;
int fp_sensor_init(void)
diff --git a/common/mock/fpsensor_detect_mock.c b/common/mock/fpsensor_detect_mock.c
index af1d7f5103..fd4e2985e6 100644
--- a/common/mock/fpsensor_detect_mock.c
+++ b/common/mock/fpsensor_detect_mock.c
@@ -5,6 +5,10 @@
#include "mock/fpsensor_detect_mock.h"
+#ifndef TEST_BUILD
+#error "Mocks should only be in the test build."
+#endif
+
struct mock_ctrl_fpsensor_detect mock_ctrl_fpsensor_detect =
MOCK_CTRL_DEFAULT_FPSENSOR_DETECT;
diff --git a/common/mock/fpsensor_state_mock.c b/common/mock/fpsensor_state_mock.c
index 629b9a90a6..c3092fe860 100644
--- a/common/mock/fpsensor_state_mock.c
+++ b/common/mock/fpsensor_state_mock.c
@@ -10,6 +10,10 @@
#include "ec_commands.h"
#include "test_util.h"
+#ifndef TEST_BUILD
+#error "Mocks should only be in the test build."
+#endif
+
const uint8_t default_fake_tpm_seed[] = {
0xd9, 0x71, 0xaf, 0xc4, 0xcd, 0x36, 0xe3, 0x60, 0xf8, 0x5a, 0xa0,
0xa6, 0x2c, 0xb3, 0xf5, 0xe2, 0xeb, 0xb9, 0xd8, 0x2f, 0xb5, 0x78,
diff --git a/common/mock/mkbp_events_mock.c b/common/mock/mkbp_events_mock.c
index fdab664c39..d42c06fdec 100644
--- a/common/mock/mkbp_events_mock.c
+++ b/common/mock/mkbp_events_mock.c
@@ -13,7 +13,11 @@
#include "common.h"
#include "mock/mkbp_events_mock.h"
-struct mock_ctrl_mkbp_events mock_ctrl_mkbp_events = \
+#ifndef TEST_BUILD
+#error "Mocks should only be in the test build."
+#endif
+
+struct mock_ctrl_mkbp_events mock_ctrl_mkbp_events =
MOCK_CTRL_DEFAULT_MKBP_EVENTS;
int mkbp_send_event(uint8_t event_type)
diff --git a/common/mock/rollback_mock.c b/common/mock/rollback_mock.c
index 84e9c4aa43..2b26d9d8d7 100644
--- a/common/mock/rollback_mock.c
+++ b/common/mock/rollback_mock.c
@@ -16,6 +16,10 @@
#include "util.h"
#include "mock/rollback_mock.h"
+#ifndef TEST_BUILD
+#error "Mocks should only be in the test build."
+#endif
+
struct mock_ctrl_rollback mock_ctrl_rollback = MOCK_CTRL_DEFAULT_ROLLBACK;
static const uint8_t fake_rollback_secret[] = {
diff --git a/common/mock/tcpc_mock.c b/common/mock/tcpc_mock.c
index 457868c96a..d47aab729b 100644
--- a/common/mock/tcpc_mock.c
+++ b/common/mock/tcpc_mock.c
@@ -17,6 +17,10 @@
#define cprints(format, args...)
#endif
+#ifndef TEST_BUILD
+#error "Mocks should only be in the test build."
+#endif
+
/* Public API for controlling/inspecting this mock */
struct mock_tcpc_ctrl mock_tcpc;
diff --git a/common/mock/tcpci_i2c_mock.c b/common/mock/tcpci_i2c_mock.c
index fa7268ddf4..30a56ea0dc 100644
--- a/common/mock/tcpci_i2c_mock.c
+++ b/common/mock/tcpci_i2c_mock.c
@@ -9,6 +9,10 @@
#include "test_util.h"
#include "timer.h"
+#ifndef TEST_BUILD
+#error "Mocks should only be in the test build."
+#endif
+
#define BUFFER_SIZE 100
#define VERIFY_TIMEOUT (5 * SECOND)
diff --git a/common/mock/tcpm_mock.c b/common/mock/tcpm_mock.c
index 81534ad8be..2c212cf8c9 100644
--- a/common/mock/tcpm_mock.c
+++ b/common/mock/tcpm_mock.c
@@ -9,6 +9,10 @@
#include "memory.h"
#include "mock/tcpm_mock.h"
+#ifndef TEST_BUILD
+#error "Mocks should only be in the test build."
+#endif
+
struct mock_tcpm_t mock_tcpm[CONFIG_USB_PD_PORT_MAX_COUNT];
/**
diff --git a/common/mock/timer_mock.c b/common/mock/timer_mock.c
index 21408b7fe6..dc83aa24d5 100644
--- a/common/mock/timer_mock.c
+++ b/common/mock/timer_mock.c
@@ -5,6 +5,10 @@
#include "mock/timer_mock.h"
+#ifndef TEST_BUILD
+#error "Mocks should only be in the test build."
+#endif
+
static timestamp_t now;
void set_time(timestamp_t now_)
diff --git a/common/mock/usb_mux_mock.c b/common/mock/usb_mux_mock.c
index 2b9a5296fc..e04c69f04b 100644
--- a/common/mock/usb_mux_mock.c
+++ b/common/mock/usb_mux_mock.c
@@ -14,6 +14,10 @@
#define cprints(format, args...)
#endif
+#ifndef TEST_BUILD
+#error "Mocks should only be in the test build."
+#endif
+
/* Public API for controlling/inspecting this mock */
struct mock_usb_mux_ctrl mock_usb_mux;
diff --git a/common/mock/usb_pd_dpm_mock.c b/common/mock/usb_pd_dpm_mock.c
index bf1f191c07..ac45837971 100644
--- a/common/mock/usb_pd_dpm_mock.c
+++ b/common/mock/usb_pd_dpm_mock.c
@@ -12,6 +12,10 @@
#include "mock/usb_pd_dpm_mock.h"
#include "memory.h"
+#ifndef TEST_BUILD
+#error "Mocks should only be in the test build."
+#endif
+
struct mock_dpm_port_t dpm[CONFIG_USB_PD_PORT_MAX_COUNT];
void mock_dpm_reset(void)
diff --git a/common/mock/usb_pd_mock.c b/common/mock/usb_pd_mock.c
index 653c98c78e..b699fd72ec 100644
--- a/common/mock/usb_pd_mock.c
+++ b/common/mock/usb_pd_mock.c
@@ -11,6 +11,10 @@
#include "mock/usb_pd_mock.h"
#include "memory.h"
+#ifndef TEST_BUILD
+#error "Mocks should only be in the test build."
+#endif
+
struct mock_pd_port_t mock_pd_port[CONFIG_USB_PD_PORT_MAX_COUNT];
void mock_pd_reset(void)
diff --git a/common/mock/usb_pe_sm_mock.c b/common/mock/usb_pe_sm_mock.c
index a62f9709f5..0a47f22387 100644
--- a/common/mock/usb_pe_sm_mock.c
+++ b/common/mock/usb_pe_sm_mock.c
@@ -15,6 +15,9 @@
#define cprints(format, args...)
#endif
+#ifndef TEST_BUILD
+#error "Mocks should only be in the test build."
+#endif
struct mock_pe_port_t mock_pe_port[CONFIG_USB_PD_PORT_MAX_COUNT];
diff --git a/common/mock/usb_prl_mock.c b/common/mock/usb_prl_mock.c
index b682e67f80..75c0976362 100644
--- a/common/mock/usb_prl_mock.c
+++ b/common/mock/usb_prl_mock.c
@@ -11,6 +11,10 @@
#include "usb_prl_sm.h"
#include "mock/usb_prl_mock.h"
+#ifndef TEST_BUILD
+#error "Mocks should only be in the test build."
+#endif
+
/* Defaults should all be 0 values. */
struct extended_msg rx_emsg[CONFIG_USB_PD_PORT_MAX_COUNT];
struct extended_msg tx_emsg[CONFIG_USB_PD_PORT_MAX_COUNT];
diff --git a/common/mock/usb_tc_sm_mock.c b/common/mock/usb_tc_sm_mock.c
index 7679cae260..ebbbb43bb3 100644
--- a/common/mock/usb_tc_sm_mock.c
+++ b/common/mock/usb_tc_sm_mock.c
@@ -15,6 +15,10 @@
#define cprints(format, args...)
#endif
+#ifndef TEST_BUILD
+#error "Mocks should only be in the test build."
+#endif
+
struct mock_tc_port_t mock_tc_port[CONFIG_USB_PD_PORT_MAX_COUNT];
void mock_tc_port_reset(void)