shard unit tests (#2906)
* scripts * it found problems! * off by one * call bash maybe?
This commit is contained in:
parent
78edc0ce79
commit
3574de1da3
|
@ -90,3 +90,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
github_token: ${{ github.token }}
|
github_token: ${{ github.token }}
|
||||||
branch: master
|
branch: master
|
||||||
|
|
||||||
|
- name: Run Tests (sharded)
|
||||||
|
working-directory: ./unit_tests/
|
||||||
|
run: bash ./run_sharded_tests.sh
|
||||||
|
|
|
@ -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
|
|
@ -447,6 +447,9 @@ TEST(etb, etbTpsSensor) {
|
||||||
Sensor::setMockValue(SensorType::WastegatePosition, 33.0f);
|
Sensor::setMockValue(SensorType::WastegatePosition, 33.0f);
|
||||||
Sensor::setMockValue(SensorType::IdlePosition, 66.0f);
|
Sensor::setMockValue(SensorType::IdlePosition, 66.0f);
|
||||||
|
|
||||||
|
// Redundant accelerator pedal required for init
|
||||||
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 0, true);
|
||||||
|
|
||||||
// Test first throttle
|
// Test first throttle
|
||||||
{
|
{
|
||||||
EtbController etb;
|
EtbController etb;
|
||||||
|
@ -479,6 +482,10 @@ TEST(etb, etbTpsSensor) {
|
||||||
TEST(etb, setOutputInvalid) {
|
TEST(etb, setOutputInvalid) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
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;
|
StrictMock<MockMotor> motor;
|
||||||
|
|
||||||
EtbController etb;
|
EtbController etb;
|
||||||
|
@ -644,6 +651,10 @@ TEST(etb, closedLoopPid) {
|
||||||
TEST(etb, openLoopThrottle) {
|
TEST(etb, openLoopThrottle) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
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;
|
EtbController etb;
|
||||||
INJECT_ENGINE_REFERENCE(&etb);
|
INJECT_ENGINE_REFERENCE(&etb);
|
||||||
etb.init(ETB_Throttle1, nullptr, nullptr, nullptr, true);
|
etb.init(ETB_Throttle1, nullptr, nullptr, nullptr, true);
|
||||||
|
@ -662,6 +673,10 @@ TEST(etb, openLoopThrottle) {
|
||||||
TEST(etb, openLoopNonThrottle) {
|
TEST(etb, openLoopNonThrottle) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
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;
|
EtbController etb;
|
||||||
INJECT_ENGINE_REFERENCE(&etb);
|
INJECT_ENGINE_REFERENCE(&etb);
|
||||||
etb.init(ETB_Wastegate, nullptr, nullptr, nullptr, false);
|
etb.init(ETB_Wastegate, nullptr, nullptr, nullptr, false);
|
||||||
|
|
Loading…
Reference in New Issue