Fix trigger error indicator (#4185)

* test and fix

* more shards!
This commit is contained in:
Matthew Kennedy 2022-05-19 06:43:42 -07:00 committed by GitHub
parent 3e1c7a8650
commit 6f45d0fd46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View File

@ -150,7 +150,7 @@ public:
); );
bool someSortOfTriggerError() const { bool someSortOfTriggerError() const {
return m_timeSinceDecodeError.getElapsedSeconds(1); return !m_timeSinceDecodeError.getElapsedSeconds(1);
} }
protected: protected:

4
unit_tests/run_sharded_tests.sh Normal file → Executable file
View File

@ -5,8 +5,8 @@
set -e set -e
export GTEST_TOTAL_SHARDS=500 export GTEST_TOTAL_SHARDS=600
for IDX in {0..499} for IDX in {0..599}
do do
export GTEST_SHARD_INDEX=$IDX export GTEST_SHARD_INDEX=$IDX
build/rusefi_test build/rusefi_test

View File

@ -85,6 +85,8 @@ TEST(TriggerDecoder, FindsFirstSyncPoint) {
doTooth(dut, shape, cfg, t); doTooth(dut, shape, cfg, t);
EXPECT_TRUE(dut.getShaftSynchronized()); EXPECT_TRUE(dut.getShaftSynchronized());
EXPECT_EQ(2, dut.currentCycle.current_index); EXPECT_EQ(2, dut.currentCycle.current_index);
EXPECT_FALSE(dut.someSortOfTriggerError());
} }
@ -130,6 +132,7 @@ TEST(TriggerDecoder, FindsSyncPointMultipleRevolutions) {
doTooth(dut, shape, cfg, t); doTooth(dut, shape, cfg, t);
EXPECT_TRUE(dut.getShaftSynchronized()); EXPECT_TRUE(dut.getShaftSynchronized());
EXPECT_EQ(0, dut.currentCycle.current_index); EXPECT_EQ(0, dut.currentCycle.current_index);
EXPECT_FALSE(dut.someSortOfTriggerError());
} }
} }
@ -216,6 +219,7 @@ TEST(TriggerDecoder, NotEnoughTeeth_CausesError) {
doTooth(dut, shape, cfg, t); doTooth(dut, shape, cfg, t);
EXPECT_TRUE(dut.getShaftSynchronized()); EXPECT_TRUE(dut.getShaftSynchronized());
EXPECT_EQ(2, dut.currentCycle.current_index); EXPECT_EQ(2, dut.currentCycle.current_index);
EXPECT_FALSE(dut.someSortOfTriggerError());
// Missing tooth, but it comes early - not enough teeth have happened yet! // Missing tooth, but it comes early - not enough teeth have happened yet!
t += MS2NT(2); t += MS2NT(2);
@ -224,4 +228,5 @@ TEST(TriggerDecoder, NotEnoughTeeth_CausesError) {
// Sync is lost until we get to another sync point // Sync is lost until we get to another sync point
EXPECT_FALSE(dut.getShaftSynchronized()); EXPECT_FALSE(dut.getShaftSynchronized());
EXPECT_EQ(0, dut.currentCycle.current_index); EXPECT_EQ(0, dut.currentCycle.current_index);
EXPECT_TRUE(dut.someSortOfTriggerError());
} }