Mercurial > louis > mq > lightsd
changeset 201:36d245fddcdd
More testing
author | Louis Opter <kalessin@kalessin.fr> |
---|---|
date | Wed, 22 Jul 2015 21:18:41 -0700 |
parents | 623a0664aecb |
children | 045df907f18a |
files | series tag_untag_testing.patch |
diffstat | 2 files changed, 818 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/series Sun Jul 19 21:27:29 2015 -0700 +++ b/series Wed Jul 22 21:18:41 2015 -0700 @@ -3,3 +3,4 @@ ignore_duplicated_listening_addresses.patch add_command_pipe.patch fix_usage_and_version.patch +tag_untag_testing.patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tag_untag_testing.patch Wed Jul 22 21:18:41 2015 -0700 @@ -0,0 +1,817 @@ +# HG changeset patch +# Parent e1c9800ece5cb3b9d8ed9265f7c1b07e2b66a746 + +diff --git a/lifx/bulb.c b/lifx/bulb.c +--- a/lifx/bulb.c ++++ b/lifx/bulb.c +@@ -76,6 +76,23 @@ + assert(bulb); + assert(bulb->gw); + ++#ifndef NDEBUG ++ // FIXME: Yeah, so an unit test would be better because it can be easily ++ // automated, but this looks so much easier to do and this code path is ++ // often exercised: ++ int tag_id; ++ LGTD_LIFX_WIRE_FOREACH_TAG_ID(tag_id, bulb->state.tags) { ++ int n = 0; ++ struct lgtd_lifx_bulb *gw_bulb; ++ SLIST_FOREACH(gw_bulb, &bulb->gw->bulbs, link_by_gw) { ++ if (LGTD_LIFX_WIRE_TAG_ID_TO_VALUE(tag_id) & gw_bulb->state.tags) { ++ n++; ++ } ++ } ++ assert(bulb->gw->tag_refcounts[i] == n - 1); ++ } ++#endif ++ + LGTD_STATS_ADD_AND_UPDATE_PROCTITLE(bulbs, -1); + if (bulb->state.power == LGTD_LIFX_POWER_ON) { + LGTD_STATS_ADD_AND_UPDATE_PROCTITLE(bulbs_powered_on, -1); +diff --git a/tests/core/jsonrpc/test_jsonrpc_build_target_list.c b/tests/core/jsonrpc/test_jsonrpc_build_target_list.c +--- a/tests/core/jsonrpc/test_jsonrpc_build_target_list.c ++++ b/tests/core/jsonrpc/test_jsonrpc_build_target_list.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + #include "test_jsonrpc_utils.h" + + static void +diff --git a/tests/core/jsonrpc/test_jsonrpc_check_and_call_power_off.c b/tests/core/jsonrpc/test_jsonrpc_check_and_call_power_off.c +--- a/tests/core/jsonrpc/test_jsonrpc_check_and_call_power_off.c ++++ b/tests/core/jsonrpc/test_jsonrpc_check_and_call_power_off.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + + #define LGTD_TESTING_POWER_OFF + #include "test_jsonrpc_utils.h" +diff --git a/tests/core/jsonrpc/test_jsonrpc_check_and_call_power_off_missing_target.c b/tests/core/jsonrpc/test_jsonrpc_check_and_call_power_off_missing_target.c +--- a/tests/core/jsonrpc/test_jsonrpc_check_and_call_power_off_missing_target.c ++++ b/tests/core/jsonrpc/test_jsonrpc_check_and_call_power_off_missing_target.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + + #define LGTD_TESTING_POWER_OFF + #include "test_jsonrpc_utils.h" +diff --git a/tests/core/jsonrpc/test_jsonrpc_check_and_call_power_on.c b/tests/core/jsonrpc/test_jsonrpc_check_and_call_power_on.c +--- a/tests/core/jsonrpc/test_jsonrpc_check_and_call_power_on.c ++++ b/tests/core/jsonrpc/test_jsonrpc_check_and_call_power_on.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + + #define LGTD_TESTING_POWER_ON + #include "test_jsonrpc_utils.h" +diff --git a/tests/core/jsonrpc/test_jsonrpc_check_and_call_power_on_missing_target.c b/tests/core/jsonrpc/test_jsonrpc_check_and_call_power_on_missing_target.c +--- a/tests/core/jsonrpc/test_jsonrpc_check_and_call_power_on_missing_target.c ++++ b/tests/core/jsonrpc/test_jsonrpc_check_and_call_power_on_missing_target.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + + #define LGTD_TESTING_POWER_ON + #include "test_jsonrpc_utils.h" +diff --git a/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_light_from_hsbk.c b/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_light_from_hsbk.c +--- a/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_light_from_hsbk.c ++++ b/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_light_from_hsbk.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + + #define LGTD_TESTING_SET_LIGHT_FROM_HSBK + #include "test_jsonrpc_utils.h" +diff --git a/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_light_from_hsbk_from_array.c b/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_light_from_hsbk_from_array.c +--- a/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_light_from_hsbk_from_array.c ++++ b/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_light_from_hsbk_from_array.c +@@ -1,7 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" +-#include "tests_shims.h" ++#include "mock_gateway.h" + + #define LGTD_TESTING_SET_LIGHT_FROM_HSBK + #include "test_jsonrpc_utils.h" +diff --git a/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_light_from_hsbk_invalid_params.c b/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_light_from_hsbk_invalid_params.c +--- a/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_light_from_hsbk_invalid_params.c ++++ b/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_light_from_hsbk_invalid_params.c +@@ -1,7 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" +-#include "tests_shims.h" ++#include "mock_gateway.h" + + #define LGTD_TESTING_SET_LIGHT_FROM_HSBK + #include "test_jsonrpc_utils.h" +diff --git a/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_waveform.c b/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_waveform.c +--- a/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_waveform.c ++++ b/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_waveform.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + + #define LGTD_TESTING_SET_WAVEFORM + #include "test_jsonrpc_utils.h" +diff --git a/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_waveform_invalid_params.c b/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_waveform_invalid_params.c +--- a/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_waveform_invalid_params.c ++++ b/tests/core/jsonrpc/test_jsonrpc_check_and_call_set_waveform_invalid_params.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + + #define LGTD_TESTING_SET_WAVEFORM + #include "test_jsonrpc_utils.h" +diff --git a/tests/core/jsonrpc/test_jsonrpc_check_and_call_tag.c b/tests/core/jsonrpc/test_jsonrpc_check_and_call_tag.c +--- a/tests/core/jsonrpc/test_jsonrpc_check_and_call_tag.c ++++ b/tests/core/jsonrpc/test_jsonrpc_check_and_call_tag.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + + #define MOCKED_LGTD_TAG + #include "test_jsonrpc_utils.h" +diff --git a/tests/core/jsonrpc/test_jsonrpc_check_and_call_tag_missing_params.c b/tests/core/jsonrpc/test_jsonrpc_check_and_call_tag_missing_params.c +--- a/tests/core/jsonrpc/test_jsonrpc_check_and_call_tag_missing_params.c ++++ b/tests/core/jsonrpc/test_jsonrpc_check_and_call_tag_missing_params.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + + #define MOCKED_LGTD_TAG + #include "test_jsonrpc_utils.h" +diff --git a/tests/core/jsonrpc/test_jsonrpc_check_and_call_untag.c b/tests/core/jsonrpc/test_jsonrpc_check_and_call_untag.c +--- a/tests/core/jsonrpc/test_jsonrpc_check_and_call_untag.c ++++ b/tests/core/jsonrpc/test_jsonrpc_check_and_call_untag.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + + #define MOCKED_LGTD_UNTAG + #include "test_jsonrpc_utils.h" +diff --git a/tests/core/jsonrpc/test_jsonrpc_check_and_call_untag_invalid_params.c b/tests/core/jsonrpc/test_jsonrpc_check_and_call_untag_invalid_params.c +--- a/tests/core/jsonrpc/test_jsonrpc_check_and_call_untag_invalid_params.c ++++ b/tests/core/jsonrpc/test_jsonrpc_check_and_call_untag_invalid_params.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + + #define MOCKED_LGTD_UNTAG + #include "test_jsonrpc_utils.h" +diff --git a/tests/core/jsonrpc/test_jsonrpc_extract_request_no_params.c b/tests/core/jsonrpc/test_jsonrpc_extract_request_no_params.c +--- a/tests/core/jsonrpc/test_jsonrpc_extract_request_no_params.c ++++ b/tests/core/jsonrpc/test_jsonrpc_extract_request_no_params.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + #include "test_jsonrpc_utils.h" + + int +diff --git a/tests/core/jsonrpc/test_jsonrpc_extract_request_notification_no_params.c b/tests/core/jsonrpc/test_jsonrpc_extract_request_notification_no_params.c +--- a/tests/core/jsonrpc/test_jsonrpc_extract_request_notification_no_params.c ++++ b/tests/core/jsonrpc/test_jsonrpc_extract_request_notification_no_params.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + #include "test_jsonrpc_utils.h" + + int +diff --git a/tests/core/jsonrpc/test_jsonrpc_extract_request_params_array.c b/tests/core/jsonrpc/test_jsonrpc_extract_request_params_array.c +--- a/tests/core/jsonrpc/test_jsonrpc_extract_request_params_array.c ++++ b/tests/core/jsonrpc/test_jsonrpc_extract_request_params_array.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + #include "test_jsonrpc_utils.h" + + int +diff --git a/tests/core/jsonrpc/test_jsonrpc_extract_request_params_obj.c b/tests/core/jsonrpc/test_jsonrpc_extract_request_params_obj.c +--- a/tests/core/jsonrpc/test_jsonrpc_extract_request_params_obj.c ++++ b/tests/core/jsonrpc/test_jsonrpc_extract_request_params_obj.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + #include "test_jsonrpc_utils.h" + + int +diff --git a/tests/core/jsonrpc/test_jsonrpc_extract_request_valid_notification.c b/tests/core/jsonrpc/test_jsonrpc_extract_request_valid_notification.c +--- a/tests/core/jsonrpc/test_jsonrpc_extract_request_valid_notification.c ++++ b/tests/core/jsonrpc/test_jsonrpc_extract_request_valid_notification.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + #include "test_jsonrpc_utils.h" + + int +diff --git a/tests/core/jsonrpc/test_jsonrpc_send_error.c b/tests/core/jsonrpc/test_jsonrpc_send_error.c +--- a/tests/core/jsonrpc/test_jsonrpc_send_error.c ++++ b/tests/core/jsonrpc/test_jsonrpc_send_error.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + #include "test_jsonrpc_utils.h" + + int +diff --git a/tests/core/jsonrpc/test_jsonrpc_send_response.c b/tests/core/jsonrpc/test_jsonrpc_send_response.c +--- a/tests/core/jsonrpc/test_jsonrpc_send_response.c ++++ b/tests/core/jsonrpc/test_jsonrpc_send_response.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + #include "test_jsonrpc_utils.h" + + int +diff --git a/tests/core/jsonrpc/test_jsonrpc_type_float_between_0_and_1_invalid.c b/tests/core/jsonrpc/test_jsonrpc_type_float_between_0_and_1_invalid.c +--- a/tests/core/jsonrpc/test_jsonrpc_type_float_between_0_and_1_invalid.c ++++ b/tests/core/jsonrpc/test_jsonrpc_type_float_between_0_and_1_invalid.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + #include "test_jsonrpc_utils.h" + + static void +diff --git a/tests/core/jsonrpc/test_jsonrpc_type_float_between_0_and_1_valid.c b/tests/core/jsonrpc/test_jsonrpc_type_float_between_0_and_1_valid.c +--- a/tests/core/jsonrpc/test_jsonrpc_type_float_between_0_and_1_valid.c ++++ b/tests/core/jsonrpc/test_jsonrpc_type_float_between_0_and_1_valid.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + #include "test_jsonrpc_utils.h" + + static void +diff --git a/tests/core/jsonrpc/test_jsonrpc_type_float_between_0_and_360_invalid.c b/tests/core/jsonrpc/test_jsonrpc_type_float_between_0_and_360_invalid.c +--- a/tests/core/jsonrpc/test_jsonrpc_type_float_between_0_and_360_invalid.c ++++ b/tests/core/jsonrpc/test_jsonrpc_type_float_between_0_and_360_invalid.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + #include "test_jsonrpc_utils.h" + + static void +diff --git a/tests/core/jsonrpc/test_jsonrpc_type_float_between_0_and_360_valid.c b/tests/core/jsonrpc/test_jsonrpc_type_float_between_0_and_360_valid.c +--- a/tests/core/jsonrpc/test_jsonrpc_type_float_between_0_and_360_valid.c ++++ b/tests/core/jsonrpc/test_jsonrpc_type_float_between_0_and_360_valid.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + #include "test_jsonrpc_utils.h" + + static void +diff --git a/tests/core/jsonrpc/test_jsonrpc_type_integer.c b/tests/core/jsonrpc/test_jsonrpc_type_integer.c +--- a/tests/core/jsonrpc/test_jsonrpc_type_integer.c ++++ b/tests/core/jsonrpc/test_jsonrpc_type_integer.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + #include "test_jsonrpc_utils.h" + + int +diff --git a/tests/core/jsonrpc/test_jsonrpc_type_integer_invalid_characters.c b/tests/core/jsonrpc/test_jsonrpc_type_integer_invalid_characters.c +--- a/tests/core/jsonrpc/test_jsonrpc_type_integer_invalid_characters.c ++++ b/tests/core/jsonrpc/test_jsonrpc_type_integer_invalid_characters.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + #include "test_jsonrpc_utils.h" + + int +diff --git a/tests/core/jsonrpc/test_jsonrpc_type_integer_too_big.c b/tests/core/jsonrpc/test_jsonrpc_type_integer_too_big.c +--- a/tests/core/jsonrpc/test_jsonrpc_type_integer_too_big.c ++++ b/tests/core/jsonrpc/test_jsonrpc_type_integer_too_big.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + #include "test_jsonrpc_utils.h" + + int +diff --git a/tests/core/jsonrpc/test_jsonrpc_type_integer_too_small.c b/tests/core/jsonrpc/test_jsonrpc_type_integer_too_small.c +--- a/tests/core/jsonrpc/test_jsonrpc_type_integer_too_small.c ++++ b/tests/core/jsonrpc/test_jsonrpc_type_integer_too_small.c +@@ -1,6 +1,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + #include "test_jsonrpc_utils.h" + + int +diff --git a/tests/core/jsonrpc/test_jsonrpc_uint16_range_to_float_string.c b/tests/core/jsonrpc/test_jsonrpc_uint16_range_to_float_string.c +--- a/tests/core/jsonrpc/test_jsonrpc_uint16_range_to_float_string.c ++++ b/tests/core/jsonrpc/test_jsonrpc_uint16_range_to_float_string.c +@@ -3,6 +3,7 @@ + #include "jsonrpc.c" + + #include "mock_client_buf.h" ++#include "mock_gateway.h" + #include "test_jsonrpc_utils.h" + + int +diff --git a/tests/core/mock_gateway.h b/tests/core/mock_gateway.h +new file mode 100644 +--- /dev/null ++++ b/tests/core/mock_gateway.h +@@ -0,0 +1,131 @@ ++#pragma once ++ ++#include "time_monotonic.h" ++#include "lifx/bulb.h" ++#include "lifx/gateway.h" ++ ++struct lgtd_lifx_tag; ++struct lgtd_lifx_gateway; ++ ++#ifndef MOCKED_LIFX_GATEWAY_SEND_TO_SITE ++bool ++lgtd_lifx_gateway_send_to_site(struct lgtd_lifx_gateway *gw, ++ enum lgtd_lifx_packet_type pkt_type, ++ const void *pkt) ++{ ++ (void)gw; ++ (void)pkt_type; ++ (void)pkt; ++ return false; ++} ++#endif ++ ++#ifndef MOCKED_LIFX_GATEWAY_ALLOCATE_TAG_ID ++int ++lgtd_lifx_gateway_allocate_tag_id(struct lgtd_lifx_gateway *gw, ++ int tag_id, ++ const char *tag_label) ++{ ++ (void)gw; ++ (void)tag_id; ++ (void)tag_label; ++ return -1; ++} ++#endif ++ ++#ifndef LGTD_LIFX_GATEWAY_HANDLE_PAN_GATEWAY ++void ++lgtd_lifx_gateway_handle_pan_gateway(struct lgtd_lifx_gateway *gw, ++ const struct lgtd_lifx_packet_header *hdr, ++ const struct lgtd_lifx_packet_pan_gateway *pkt) ++{ ++ (void)gw; ++ (void)hdr; ++ (void)pkt; ++} ++#endif ++ ++#ifndef LGTD_LIFX_GATEWAY_HANDLE_LIGHT_STATUS ++void ++lgtd_lifx_gateway_handle_light_status(struct lgtd_lifx_gateway *gw, ++ const struct lgtd_lifx_packet_header *hdr, ++ const struct lgtd_lifx_packet_light_status *pkt) ++{ ++ (void)gw; ++ (void)hdr; ++ (void)pkt; ++} ++#endif ++ ++#ifndef LGTD_LIFX_GATEWAY_HANDLE_POWER_STATE ++void ++lgtd_lifx_gateway_handle_power_state(struct lgtd_lifx_gateway *gw, ++ const struct lgtd_lifx_packet_header *hdr, ++ const struct lgtd_lifx_packet_power_state *pkt) ++{ ++ (void)gw; ++ (void)hdr; ++ (void)pkt; ++} ++#endif ++ ++#ifndef LGTD_LIFX_GATEWAY_HANDLE_TAG_LABELS ++void ++lgtd_lifx_gateway_handle_tag_labels(struct lgtd_lifx_gateway *gw, ++ const struct lgtd_lifx_packet_header *hdr, ++ const struct lgtd_lifx_packet_tag_labels *pkt) ++{ ++ (void)gw; ++ (void)hdr; ++ (void)pkt; ++} ++#endif ++ ++#ifndef LGTD_LIFX_GATEWAY_HANDLE_TAGS ++void ++lgtd_lifx_gateway_handle_tags(struct lgtd_lifx_gateway *gw, ++ const struct lgtd_lifx_packet_header *hdr, ++ const struct lgtd_lifx_packet_tags *pkt) ++{ ++ (void)gw; ++ (void)hdr; ++ (void)pkt; ++} ++#endif ++ ++#ifndef LGTD_LIFX_GATEWAY_DEALLOCATE_TAG_ID ++void ++lgtd_lifx_gateway_deallocate_tag_id(struct lgtd_lifx_gateway *gw, int tag_id) ++{ ++ (void)gw; ++ (void)tag_id; ++} ++#endif ++ ++#ifndef LGTD_LIFX_GATEWAY_GET_TAG_ID ++int ++lgtd_lifx_gateway_get_tag_id(const struct lgtd_lifx_gateway *gw, ++ const struct lgtd_lifx_tag *tag) ++{ ++ int tag_id; ++ LGTD_LIFX_WIRE_FOREACH_TAG_ID(tag_id, gw->tag_ids) { ++ if (gw->tags[tag_id] == tag) { ++ return tag_id; ++ } ++ } ++ ++ return -1; ++} ++#endif ++ ++#ifndef LGTD_LIFX_GATEWAY_UPDATE_TAG_REFCOUNTS ++void ++lgtd_lifx_gateway_update_tag_refcounts(struct lgtd_lifx_gateway *gw, ++ uint64_t bulb_tags, ++ uint64_t pkt_tags) ++{ ++ (void)gw; ++ (void)bulb_tags; ++ (void)pkt_tags; ++} ++#endif +diff --git a/tests/core/proto/test_proto_get_light_state.c b/tests/core/proto/test_proto_get_light_state.c +--- a/tests/core/proto/test_proto_get_light_state.c ++++ b/tests/core/proto/test_proto_get_light_state.c +@@ -1,7 +1,7 @@ + #include "proto.c" + + #include "mock_client_buf.h" +-#include "tests_shims.h" ++#include "mock_gateway.h" + #include "tests_utils.h" + + #define MOCKED_ROUTER_TARGETS_TO_DEVICES +diff --git a/tests/core/proto/test_proto_get_light_state_empty_device_list.c b/tests/core/proto/test_proto_get_light_state_empty_device_list.c +--- a/tests/core/proto/test_proto_get_light_state_empty_device_list.c ++++ b/tests/core/proto/test_proto_get_light_state_empty_device_list.c +@@ -1,7 +1,7 @@ + #include "proto.c" + + #include "mock_client_buf.h" +-#include "tests_shims.h" ++#include "mock_gateway.h" + #include "tests_utils.h" + + #define MOCKED_ROUTER_TARGETS_TO_DEVICES +diff --git a/tests/core/proto/test_proto_get_light_state_null_device_list.c b/tests/core/proto/test_proto_get_light_state_null_device_list.c +--- a/tests/core/proto/test_proto_get_light_state_null_device_list.c ++++ b/tests/core/proto/test_proto_get_light_state_null_device_list.c +@@ -1,7 +1,7 @@ + #include "proto.c" + + #include "mock_client_buf.h" +-#include "tests_shims.h" ++#include "mock_gateway.h" + #include "tests_utils.h" + + #define MOCKED_ROUTER_TARGETS_TO_DEVICES +diff --git a/tests/core/proto/test_proto_power_off.c b/tests/core/proto/test_proto_power_off.c +--- a/tests/core/proto/test_proto_power_off.c ++++ b/tests/core/proto/test_proto_power_off.c +@@ -1,7 +1,7 @@ + #include "proto.c" + + #include "mock_client_buf.h" +-#include "tests_shims.h" ++#include "mock_gateway.h" + #include "tests_utils.h" + + #define MOCKED_CLIENT_SEND_RESPONSE +diff --git a/tests/core/proto/test_proto_power_off_routing_error.c b/tests/core/proto/test_proto_power_off_routing_error.c +--- a/tests/core/proto/test_proto_power_off_routing_error.c ++++ b/tests/core/proto/test_proto_power_off_routing_error.c +@@ -1,7 +1,7 @@ + #include "proto.c" + + #include "mock_client_buf.h" +-#include "tests_shims.h" ++#include "mock_gateway.h" + #include "tests_utils.h" + + #define MOCKED_CLIENT_SEND_RESPONSE +diff --git a/tests/core/proto/test_proto_power_on.c b/tests/core/proto/test_proto_power_on.c +--- a/tests/core/proto/test_proto_power_on.c ++++ b/tests/core/proto/test_proto_power_on.c +@@ -1,7 +1,7 @@ + #include "proto.c" + + #include "mock_client_buf.h" +-#include "tests_shims.h" ++#include "mock_gateway.h" + #include "tests_utils.h" + + #define MOCKED_CLIENT_SEND_RESPONSE +diff --git a/tests/core/proto/test_proto_power_on_routing_error.c b/tests/core/proto/test_proto_power_on_routing_error.c +--- a/tests/core/proto/test_proto_power_on_routing_error.c ++++ b/tests/core/proto/test_proto_power_on_routing_error.c +@@ -1,7 +1,7 @@ + #include "proto.c" + + #include "mock_client_buf.h" +-#include "tests_shims.h" ++#include "mock_gateway.h" + #include "tests_utils.h" + + #define MOCKED_CLIENT_SEND_RESPONSE +diff --git a/tests/core/proto/test_proto_set_light_from_hsbk.c b/tests/core/proto/test_proto_set_light_from_hsbk.c +--- a/tests/core/proto/test_proto_set_light_from_hsbk.c ++++ b/tests/core/proto/test_proto_set_light_from_hsbk.c +@@ -3,7 +3,7 @@ + #include "proto.c" + + #include "mock_client_buf.h" +-#include "tests_shims.h" ++#include "mock_gateway.h" + #include "tests_utils.h" + + #define MOCKED_CLIENT_SEND_RESPONSE +diff --git a/tests/core/proto/test_proto_set_light_from_hsbk_on_routing_error.c b/tests/core/proto/test_proto_set_light_from_hsbk_on_routing_error.c +--- a/tests/core/proto/test_proto_set_light_from_hsbk_on_routing_error.c ++++ b/tests/core/proto/test_proto_set_light_from_hsbk_on_routing_error.c +@@ -3,7 +3,7 @@ + #include "proto.c" + + #include "mock_client_buf.h" +-#include "tests_shims.h" ++#include "mock_gateway.h" + #include "tests_utils.h" + + #define MOCKED_CLIENT_SEND_RESPONSE +diff --git a/tests/core/proto/test_proto_set_waveform.c b/tests/core/proto/test_proto_set_waveform.c +--- a/tests/core/proto/test_proto_set_waveform.c ++++ b/tests/core/proto/test_proto_set_waveform.c +@@ -3,7 +3,7 @@ + #include "proto.c" + + #include "mock_client_buf.h" +-#include "tests_shims.h" ++#include "mock_gateway.h" + #include "tests_utils.h" + + #define MOCKED_CLIENT_SEND_RESPONSE +diff --git a/tests/core/proto/test_proto_set_waveform_on_routing_error.c b/tests/core/proto/test_proto_set_waveform_on_routing_error.c +--- a/tests/core/proto/test_proto_set_waveform_on_routing_error.c ++++ b/tests/core/proto/test_proto_set_waveform_on_routing_error.c +@@ -3,7 +3,7 @@ + #include "proto.c" + + #include "mock_client_buf.h" +-#include "tests_shims.h" ++#include "mock_gateway.h" + #include "tests_utils.h" + + #define MOCKED_CLIENT_SEND_RESPONSE +diff --git a/tests/core/proto/test_proto_tag_create.c b/tests/core/proto/test_proto_tag_create.c +--- a/tests/core/proto/test_proto_tag_create.c ++++ b/tests/core/proto/test_proto_tag_create.c +@@ -3,7 +3,7 @@ + #include "mock_client_buf.h" + #define MOCKED_LIFX_GATEWAY_SEND_TO_SITE + #define MOCKED_LIFX_GATEWAY_ALLOCATE_TAG_ID +-#include "tests_shims.h" ++#include "mock_gateway.h" + #include "tests_utils.h" + + #define MOCKED_ROUTER_TARGETS_TO_DEVICES +diff --git a/tests/core/proto/test_proto_tag_create_lifx_gw_tag_ids_full.c b/tests/core/proto/test_proto_tag_create_lifx_gw_tag_ids_full.c +--- a/tests/core/proto/test_proto_tag_create_lifx_gw_tag_ids_full.c ++++ b/tests/core/proto/test_proto_tag_create_lifx_gw_tag_ids_full.c +@@ -3,7 +3,7 @@ + #include "mock_client_buf.h" + #define MOCKED_LIFX_GATEWAY_SEND_TO_SITE + #define MOCKED_LIFX_GATEWAY_ALLOCATE_TAG_ID +-#include "tests_shims.h" ++#include "mock_gateway.h" + #include "tests_utils.h" + + #define MOCKED_CLIENT_SEND_ERROR +diff --git a/tests/core/proto/test_proto_tag_update.c b/tests/core/proto/test_proto_tag_update.c +--- a/tests/core/proto/test_proto_tag_update.c ++++ b/tests/core/proto/test_proto_tag_update.c +@@ -3,7 +3,7 @@ + #include "mock_client_buf.h" + #define MOCKED_LIFX_GATEWAY_SEND_TO_SITE + #define MOCKED_LIFX_GATEWAY_ALLOCATE_TAG_ID +-#include "tests_shims.h" ++#include "mock_gateway.h" + #include "tests_utils.h" + + #define MOCKED_ROUTER_TARGETS_TO_DEVICES +diff --git a/tests/core/proto/test_proto_untag.c b/tests/core/proto/test_proto_untag.c +--- a/tests/core/proto/test_proto_untag.c ++++ b/tests/core/proto/test_proto_untag.c +@@ -1,7 +1,7 @@ + #include "proto.c" + + #include "mock_client_buf.h" +-#include "tests_shims.h" ++#include "mock_gateway.h" + #include "tests_utils.h" + + #define MOCKED_ROUTER_TARGETS_TO_DEVICES +diff --git a/tests/core/proto/test_proto_untag_tag_does_not_exist.c b/tests/core/proto/test_proto_untag_tag_does_not_exist.c +--- a/tests/core/proto/test_proto_untag_tag_does_not_exist.c ++++ b/tests/core/proto/test_proto_untag_tag_does_not_exist.c +@@ -1,7 +1,7 @@ + #include "proto.c" + + #include "mock_client_buf.h" +-#include "tests_shims.h" ++#include "mock_gateway.h" + #include "tests_utils.h" + + #define MOCKED_ROUTER_TARGETS_TO_DEVICES +diff --git a/tests/core/router/tests_router_utils.h b/tests/core/router/tests_router_utils.h +--- a/tests/core/router/tests_router_utils.h ++++ b/tests/core/router/tests_router_utils.h +@@ -1,5 +1,7 @@ + #pragma once + ++#include "mock_gateway.h" ++ + int lgtd_tests_gw_pkt_queue_size = 0; + struct { + struct lgtd_lifx_gateway *gw; +diff --git a/tests/core/tests_shims.c b/tests/core/tests_shims.c +--- a/tests/core/tests_shims.c ++++ b/tests/core/tests_shims.c +@@ -32,80 +32,3 @@ + lgtd_cleanup(void) + { + } +- +- +-void lgtd_lifx_gateway_handle_pan_gateway(struct lgtd_lifx_gateway *gw, +- const struct lgtd_lifx_packet_header *hdr, +- const struct lgtd_lifx_packet_pan_gateway *pkt) +-{ +- (void)gw; +- (void)hdr; +- (void)pkt; +-} +- +-void lgtd_lifx_gateway_handle_light_status(struct lgtd_lifx_gateway *gw, +- const struct lgtd_lifx_packet_header *hdr, +- const struct lgtd_lifx_packet_light_status *pkt) +-{ +- (void)gw; +- (void)hdr; +- (void)pkt; +-} +- +-void lgtd_lifx_gateway_handle_power_state(struct lgtd_lifx_gateway *gw, +- const struct lgtd_lifx_packet_header *hdr, +- const struct lgtd_lifx_packet_power_state *pkt) +-{ +- (void)gw; +- (void)hdr; +- (void)pkt; +-} +- +-void lgtd_lifx_gateway_handle_tag_labels(struct lgtd_lifx_gateway *gw, +- const struct lgtd_lifx_packet_header *hdr, +- const struct lgtd_lifx_packet_tag_labels *pkt) +-{ +- (void)gw; +- (void)hdr; +- (void)pkt; +-} +- +-void lgtd_lifx_gateway_handle_tags(struct lgtd_lifx_gateway *gw, +- const struct lgtd_lifx_packet_header *hdr, +- const struct lgtd_lifx_packet_tags *pkt) +-{ +- (void)gw; +- (void)hdr; +- (void)pkt; +-} +- +-void +-lgtd_lifx_gateway_deallocate_tag_id(struct lgtd_lifx_gateway *gw, int tag_id) +-{ +- (void)gw; +- (void)tag_id; +-} +- +-int +-lgtd_lifx_gateway_get_tag_id(const struct lgtd_lifx_gateway *gw, +- const struct lgtd_lifx_tag *tag) +-{ +- int tag_id; +- LGTD_LIFX_WIRE_FOREACH_TAG_ID(tag_id, gw->tag_ids) { +- if (gw->tags[tag_id] == tag) { +- return tag_id; +- } +- } +- +- return -1; +-} +- +-void +-lgtd_lifx_gateway_update_tag_refcounts(struct lgtd_lifx_gateway *gw, +- uint64_t bulb_tags, +- uint64_t pkt_tags) +-{ +- (void)gw; +- (void)bulb_tags; +- (void)pkt_tags; +-} +diff --git a/tests/core/tests_shims.h b/tests/core/tests_shims.h +deleted file mode 100644 +--- a/tests/core/tests_shims.h ++++ /dev/null +@@ -1,27 +0,0 @@ +-#pragma once +- +-#ifndef MOCKED_LIFX_GATEWAY_SEND_TO_SITE +-bool +-lgtd_lifx_gateway_send_to_site(struct lgtd_lifx_gateway *gw, +- enum lgtd_lifx_packet_type pkt_type, +- const void *pkt) +-{ +- (void)gw; +- (void)pkt_type; +- (void)pkt; +- return false; +-} +-#endif +- +-#ifndef MOCKED_LIFX_GATEWAY_ALLOCATE_TAG_ID +-int +-lgtd_lifx_gateway_allocate_tag_id(struct lgtd_lifx_gateway *gw, +- int tag_id, +- const char *tag_label) +-{ +- (void)gw; +- (void)tag_id; +- (void)tag_label; +- return -1; +-} +-#endif