rusefi/unit_tests
Scott Smith 344c9073e2
Start the process of using a global engine ptr for unit tests. (#3551)
* Start the process of using a global engine ptr for unit tests.

Passing around the engine, config, and persistent state wasn't buying anything.  Instead, use
EngineTestHelper(Base) to correctly set and clear the global variables.  Add a dummy check in
case some test tries to set them manually.

* Fix OSX build

* Adapt PR to recently added code.
2021-11-16 00:23:14 -05:00
..
chibios-mock
googletest@dcc92d0ab6
test_basic_math
tests Start the process of using a global engine ptr for unit tests. (#3551) 2021-11-16 00:23:14 -05:00
.cproject
.gitignore
.project
Makefile
adc_inputs.h
boards.cpp
boards.h
ci_gcov.sh
clean_compile.bat
clean_compile.sh
efifeatures.h
engine_test_helper.cpp Start the process of using a global engine ptr for unit tests. (#3551) 2021-11-16 00:23:14 -05:00
engine_test_helper.h Start the process of using a global engine ptr for unit tests. (#3551) 2021-11-16 00:23:14 -05:00
global.h Start the process of using a global engine ptr for unit tests. (#3551) 2021-11-16 00:23:14 -05:00
global_execution_queue.cpp
global_execution_queue.h
global_mocks.cpp
globalaccess.h
gmock-all.cpp
gtest-all.cpp
jenkins.sh
logicdata.cpp
logicdata.h
logicdata_csv_reader.cpp
logicdata_csv_reader.h
logicdata_sandbox.cpp
main.cpp
map_resize.cpp
map_resize.h
mocks.cpp
mocks.h
os_access.h
readme.md
rules.mk
run_clean_gcov.sh
run_gcov.bat
run_logicdata_sandbox.bat let's add .logicdata for unit tests 2020-07-19 16:13:55 -04:00
run_sharded_tests.sh
svnversion.h
test.mk
triggers.txt
unit_test_framework.cpp
unit_test_framework.h
unit_test_rules.mk

readme.md

TL, DR: just follow tests folder as examples

In this folder we have rusEFI unit tests using https://github.com/google/googletest

Unit tests are not aware of ChibiOS or ARM or else, they are just plain C/C++ which you build for your desktop, not your MCU.

  1. Run 'make' to build desktop binary.
  2. Execute rusefi_test binary on your PC/Mac, it's expected to say SUCCESS and not fail :) Googletest will also print results summary.

Code Coverage Report

See also https://github.com/rusefi/rusefi/wiki/Build-Server-and-Automation

Triggers Images

Trigger images generation is still a two-step manual process:

Step 1: Invoke unit_tests. One of the unit_tests artifacts is triggers.txt

Step 2: Once we have triggers.txt updated by unit_tests we can invoke firmware/gen_trigger_images.bat in order to generate actual trigger images.