Generate config for //frc971/wpilib:loop_output_handler_test
This is in preparation for timing reports.
Change-Id: I34b3cd5b2df1bb8b69693ac657ffaede1e794bff
diff --git a/frc971/wpilib/BUILD b/frc971/wpilib/BUILD
index b7fe837..ac9bc87 100644
--- a/frc971/wpilib/BUILD
+++ b/frc971/wpilib/BUILD
@@ -1,6 +1,7 @@
package(default_visibility = ["//visibility:public"])
load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
+load("//aos:config.bzl", "aos_config")
flatbuffer_cc_library(
name = "logging_fbs",
@@ -122,6 +123,15 @@
srcs = [
"loop_output_handler_test.fbs",
],
+ gen_reflections = 1,
+)
+
+aos_config(
+ name = "loop_output_handler_test_config",
+ src = "loop_output_handler_test_config_source.json",
+ flatbuffers = [
+ ":loop_output_handler_test_fbs",
+ ],
)
cc_library(
@@ -147,6 +157,9 @@
srcs = [
"loop_output_handler_test.cc",
],
+ data = [
+ "loop_output_handler_test_config.json",
+ ],
deps = [
":loop_output_handler",
":loop_output_handler_test_fbs",
diff --git a/frc971/wpilib/loop_output_handler_test.cc b/frc971/wpilib/loop_output_handler_test.cc
index f1d403c..a74b762 100644
--- a/frc971/wpilib/loop_output_handler_test.cc
+++ b/frc971/wpilib/loop_output_handler_test.cc
@@ -21,20 +21,8 @@
class LoopOutputHandlerTest : public ::testing::Test {
public:
LoopOutputHandlerTest()
- : ::testing::Test(),
- configuration_(aos::configuration::MergeConfiguration(
- aos::FlatbufferDetachedBuffer<aos::Configuration>(
- aos::JsonToFlatbuffer(
- "{\n"
- " \"channels\": [ \n"
- " {\n"
- " \"name\": \"/test\",\n"
- " \"type\": "
- "\"frc971.wpilib.LoopOutputHandlerTestOutput\"\n"
- " }\n"
- " ]\n"
- "}\n",
- aos::Configuration::MiniReflectTypeTable())))),
+ : configuration_(aos::configuration::ReadConfig(
+ "frc971/wpilib/loop_output_handler_test_config.json")),
event_loop_factory_(&configuration_.message()),
loop_output_hander_event_loop_(
event_loop_factory_.MakeEventLoop("output")),
diff --git a/frc971/wpilib/loop_output_handler_test.fbs b/frc971/wpilib/loop_output_handler_test.fbs
index 6cb2cf1..ddd36d0 100644
--- a/frc971/wpilib/loop_output_handler_test.fbs
+++ b/frc971/wpilib/loop_output_handler_test.fbs
@@ -4,3 +4,5 @@
table LoopOutputHandlerTestOutput {
voltage:double;
}
+
+root_type LoopOutputHandlerTestOutput;
diff --git a/frc971/wpilib/loop_output_handler_test_config_source.json b/frc971/wpilib/loop_output_handler_test_config_source.json
new file mode 100644
index 0000000..ef07eb0
--- /dev/null
+++ b/frc971/wpilib/loop_output_handler_test_config_source.json
@@ -0,0 +1,9 @@
+{
+ "channels":
+ [
+ {
+ "name": "/test",
+ "type": "frc971.wpilib.LoopOutputHandlerTestOutput"
+ }
+ ]
+}