From b6d607be62f44108b51442a71ac82676d40f7a76 Mon Sep 17 00:00:00 2001 From: Eric Paniagua Date: Fri, 4 Sep 2020 15:07:28 -0700 Subject: [PATCH] [WIP]: Debugging NPE in kaleidoscope/simulator_test.cpp. Signed-off-by: Eric Paniagua --- src/kaleidoscope/Runtime.cpp | 16 ++++++++++++++++ testing/Makefile | 6 ++++++ testing/common/Makefile | 4 ++++ testing/common/VirtualDeviceTest.h | 2 +- testing/hello-simulator/Makefile | 1 + testing/kaleidoscope/Makefile | 5 +++-- 6 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/kaleidoscope/Runtime.cpp b/src/kaleidoscope/Runtime.cpp index 4f45f0c8..59ab3eb8 100644 --- a/src/kaleidoscope/Runtime.cpp +++ b/src/kaleidoscope/Runtime.cpp @@ -18,6 +18,14 @@ #include "kaleidoscope/layers.h" #include "kaleidoscope/keyswitch_state.h" +#undef T +#undef U +#undef min +#undef max +#undef TEST + +#include + namespace kaleidoscope { uint32_t Runtime_::millis_at_cycle_start_; @@ -51,18 +59,26 @@ Runtime_::setup(void) { void Runtime_::loop(void) { + std::cout << "epan 2.2.1.1" << std::endl; millis_at_cycle_start_ = millis(); + std::cout << "epan 2.2.1.2" << std::endl; kaleidoscope::Hooks::beforeEachCycle(); + std::cout << "epan 2.2.1.3" << std::endl; device().scanMatrix(); + std::cout << "epan 2.2.1.4" << std::endl; kaleidoscope::Hooks::beforeReportingState(); + std::cout << "epan 2.2.1.5" << std::endl; device().hid().keyboard().sendReport(); + std::cout << "epan 2.2.1.6" << std::endl; device().hid().keyboard().releaseAllKeys(); + std::cout << "epan 2.2.1.7" << std::endl; kaleidoscope::Hooks::afterEachCycle(); + std::cout << "epan 2.2.1.8" << std::endl; } Runtime_ Runtime; diff --git a/testing/Makefile b/testing/Makefile index 2907e55c..79d45ab4 100644 --- a/testing/Makefile +++ b/testing/Makefile @@ -13,6 +13,12 @@ googletest: FORCE common: FORCE cd common && env LIB_DIR="${LIB_DIR}" $(MAKE) +clean: FORCE + rm -rf "${LIB_DIR}" + cd common && make clean + cd hello-simulator && make clean + cd kaleidoscope && make clean + %: common googltest FORCE if [ -f "$@/Makefile" ]; then cd "$@"; $(MAKE); fi diff --git a/testing/common/Makefile b/testing/common/Makefile index eed75aa7..9a70e991 100644 --- a/testing/common/Makefile +++ b/testing/common/Makefile @@ -25,6 +25,7 @@ ${OBJ_DIR}/%.o: %.cpp $(wildcard *.h) -I${PWD}/../../testing/googletest/googlemock/include \ -I${PWD}/../../testing/googletest/googletest/include \ -DARDUINO=10607 \ + -DARDUINO_ARCH_VIRTUAL \ -DARDUINO_AVR_MODEL01 \ '-DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Model01.h"' \ -DKALEIDOSCOPE_VIRTUAL_BUILD=1 \ @@ -33,3 +34,6 @@ ${OBJ_DIR}/%.o: %.cpp $(wildcard *.h) -DARDUINO_ARCH_AVR=1 \ '-DUSB_PRODUCT="Model 01"' \ $< + +clean: + rm -rf "${LIB_DIR}" "${OBJ_DIR}" diff --git a/testing/common/VirtualDeviceTest.h b/testing/common/VirtualDeviceTest.h index 0a76ddf3..6c15eace 100644 --- a/testing/common/VirtualDeviceTest.h +++ b/testing/common/VirtualDeviceTest.h @@ -36,7 +36,7 @@ class VirtualDeviceTest : public ::testing::Test { const State& Result() const; - Simulator sim_; + ::kaleidoscope::testing::Simulator sim_; private: State state_; diff --git a/testing/hello-simulator/Makefile b/testing/hello-simulator/Makefile index d77a2fe9..527b7a19 100644 --- a/testing/hello-simulator/Makefile +++ b/testing/hello-simulator/Makefile @@ -31,6 +31,7 @@ ${OBJ_DIR}/%.o: %.cpp -I../../testing/googletest/googlemock/include \ -I../../testing/googletest/googletest/include \ -DARDUINO=10607 \ + -DARDUINO_ARCH_VIRTUAL \ -DARDUINO_AVR_MODEL01 \ '-DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Model01.h"' \ -DKALEIDOSCOPE_VIRTUAL_BUILD=1 \ diff --git a/testing/kaleidoscope/Makefile b/testing/kaleidoscope/Makefile index 2dcbbb85..bb991b5d 100644 --- a/testing/kaleidoscope/Makefile +++ b/testing/kaleidoscope/Makefile @@ -23,10 +23,10 @@ ${BIN_DIR}/${BIN_FILE}: ${TEST_OBJS} FORCE -g \ -w \ ${TEST_OBJS} \ - "${LIB_DIR}/${LIB_FILE}" \ - -L"$(PWD)/../googletest/lib" \ -L"${PWD}/../lib" \ -lcommon \ + "${LIB_DIR}/${LIB_FILE}" \ + -L"$(PWD)/../googletest/lib" \ -lgtest \ -lgmock \ -lm \ @@ -45,6 +45,7 @@ ${OBJ_DIR}/%.o: ${SRC_DIR}/%.cpp -I${PWD}/../../testing/googletest/googlemock/include \ -I${PWD}/../../testing/googletest/googletest/include \ -DARDUINO=10607 \ + -DARDUINO_ARCH_VIRTUAL \ -DARDUINO_AVR_MODEL01 \ '-DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Model01.h"' \ -DKALEIDOSCOPE_VIRTUAL_BUILD=1 \