shard unit tests (#2906)

* scripts

* it found problems!

* off by one

* call bash maybe?
This commit is contained in:
Matthew Kennedy 2021-07-04 19:28:31 -07:00 committed by GitHub
parent 78edc0ce79
commit 3574de1da3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 0 deletions

View File

@ -90,3 +90,7 @@ jobs:
with:
github_token: ${{ github.token }}
branch: master
- name: Run Tests (sharded)
working-directory: ./unit_tests/
run: bash ./run_sharded_tests.sh

View File

@ -0,0 +1,16 @@
#!/bin/bash
# This script runs every test in its own process (own invocation of rusefi_test executable)
# This allows us to test for accidental cross-test leakage that fixes/breaks something
set -e
export GTEST_TOTAL_SHARDS=500
for IDX in {0..499}
do
export GTEST_SHARD_INDEX=$IDX
build/rusefi_test
done
unset GTEST_TOTAL_SHARDS
unset GTEST_SHARD_INDEX

View File

@ -447,6 +447,9 @@ TEST(etb, etbTpsSensor) {
Sensor::setMockValue(SensorType::WastegatePosition, 33.0f);
Sensor::setMockValue(SensorType::IdlePosition, 66.0f);
// Redundant accelerator pedal required for init
Sensor::setMockValue(SensorType::AcceleratorPedal, 0, true);
// Test first throttle
{
EtbController etb;
@ -479,6 +482,10 @@ TEST(etb, etbTpsSensor) {
TEST(etb, setOutputInvalid) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
// Redundant TPS & accelerator pedal required for init
Sensor::setMockValue(SensorType::Tps1, 0, true);
Sensor::setMockValue(SensorType::AcceleratorPedal, 0, true);
StrictMock<MockMotor> motor;
EtbController etb;
@ -644,6 +651,10 @@ TEST(etb, closedLoopPid) {
TEST(etb, openLoopThrottle) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
// Redundant TPS & accelerator pedal required for init
Sensor::setMockValue(SensorType::Tps1, 0, true);
Sensor::setMockValue(SensorType::AcceleratorPedal, 0, true);
EtbController etb;
INJECT_ENGINE_REFERENCE(&etb);
etb.init(ETB_Throttle1, nullptr, nullptr, nullptr, true);
@ -662,6 +673,10 @@ TEST(etb, openLoopThrottle) {
TEST(etb, openLoopNonThrottle) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
// Redundant TPS & accelerator pedal required for init
Sensor::setMockValue(SensorType::Tps1, 0, true);
Sensor::setMockValue(SensorType::AcceleratorPedal, 0, true);
EtbController etb;
INJECT_ENGINE_REFERENCE(&etb);
etb.init(ETB_Wastegate, nullptr, nullptr, nullptr, false);