Break out unit tests #2627

This commit is contained in:
rusefillc 2021-05-07 17:43:24 -04:00
parent 7eb28a1367
commit 66cd0da92f
4 changed files with 38 additions and 31 deletions

View File

@ -36,8 +36,6 @@ CSRC = $(ALLCSRC) \
# setting.
CPPSRC = $(ALLCPPSRC) \
$(UTILSRC_CPP) \
gtest-all.cpp \
gmock-all.cpp \
$(CONTROLLERS_ALGO_SRC_CPP) \
$(TRIGGER_DECODERS_SRC_CPP) \
$(ENGINES_SRC_CPP) \
@ -56,6 +54,7 @@ CPPSRC = $(ALLCPPSRC) \
$(PROJECT_DIR)/../unit_tests/logicdata.cpp \
$(DEVELOPMENT_DIR)/engine_sniffer.cpp \
$(PROJECT_DIR)/../unit_tests/main.cpp \
$(PROJECT_DIR)/../unit_tests/global_mocks.cpp \
$(PROJECT_DIR)/console/binary/tooth_logger.cpp \
$(PROJECT_DIR)/console/binary_log/log_field.cpp \
@ -73,9 +72,6 @@ INCDIR = $(UNIT_TESTS_DIR) \
$(HW_SENSORS_INC) \
$(HW_LAYER_DRIVERS_INC) \
$(UNIT_TESTS_DIR)/test_data_structures \
$(UNIT_TESTS_DIR)/googletest/googlemock/include \
$(UNIT_TESTS_DIR)/googletest/googletest \
$(UNIT_TESTS_DIR)/googletest/googletest/include \
$(UNIT_TESTS_DIR)/tests \
$(UNIT_TESTS_DIR)/tests/sensor \
$(UNIT_TESTS_DIR)/test_basic_math

View File

@ -0,0 +1,25 @@
#include "global.h"
#include "engine_configuration.h"
#include "test_signal_executor.h"
#include "trigger_central.h"
#include "map_resize.h"
#include "engine_math.h"
#include "engine_test_helper.h"
bool verboseMode = false;
int timeNowUs = 0;
efitimeus_t getTimeNowUs(void) {
return timeNowUs;
}
efitick_t getTimeNowNt(void) {
return getTimeNowUs() * US_TO_NT_MULTIPLIER;
}
void initLogging(LoggingWithStorage *logging, const char *name) {
}

View File

@ -2,35 +2,13 @@
* @file main.cpp
* @file Unit tests (and some integration tests to be fair) of rusEFI
*
* @author Andrey Belomutskiy, (c) 2012-2020
* @author Andrey Belomutskiy, (c) 2012-2021
*/
#include <stdlib.h>
#include "global.h"
#include "engine_configuration.h"
#include "test_signal_executor.h"
#include "trigger_central.h"
#include "map_resize.h"
#include "engine_math.h"
#include "engine_test_helper.h"
#include "gtest/gtest.h"
int timeNowUs = 0;
efitimeus_t getTimeNowUs(void) {
return timeNowUs;
}
efitick_t getTimeNowNt(void) {
return getTimeNowUs() * US_TO_NT_MULTIPLIER;
}
bool verboseMode = false;
GTEST_API_ int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
// uncomment if you only want to run selected tests
@ -43,5 +21,3 @@ GTEST_API_ int main(int argc, char **argv) {
return result == 0 ? 0 : -1;
}
void initLogging(LoggingWithStorage *logging, const char *name) {
}

View File

@ -1,5 +1,15 @@
include $(PROJECT_DIR)/rusefi_rules.mk
UNIT_TESTS_DIR=$(PROJECT_DIR)/../unit_tests
CPPSRC += gtest-all.cpp \
gmock-all.cpp \
INCDIR += $(UNIT_TESTS_DIR)/googletest/googlemock/include \
$(UNIT_TESTS_DIR)/googletest/googletest \
$(UNIT_TESTS_DIR)/googletest/googletest/include \
include $(PROJECT_DIR)/rusefi_rules.mk
# Compiler options here.
ifeq ($(USE_OPT),)