[wpilib] Wait 0.5s after enabling interrupt in tests (#6891)

If the interrupt edge tests are running while under heavy CPU load (like building wpilib) they are prone to failure since the interrupt thread doesn't have enough time to set up callbacks. The interrupt edge tests now copy the original AsynchronousInterrupt test, which has a 0.5s delay after the interrupt is enabled. Running the new interrupt tests while building allwpilib causes far less failures than the old tests.
This commit is contained in:
Gold856
2024-07-29 10:51:25 -04:00
committed by GitHub
parent 6f6e8ee931
commit 24dd544825
2 changed files with 4 additions and 8 deletions

View File

@@ -57,9 +57,8 @@ TEST(InterruptTest, RisingEdge) {
interrupt.SetInterruptEdges(true, true);
DIOSim digitalSim{di};
digitalSim.SetValue(false);
frc::Wait(0.5_s);
interrupt.Enable();
frc::Wait(20_ms);
frc::Wait(0.5_s);
digitalSim.SetValue(true);
frc::Wait(20_ms);
@@ -87,9 +86,8 @@ TEST(InterruptTest, FallingEdge) {
interrupt.SetInterruptEdges(true, true);
DIOSim digitalSim{di};
digitalSim.SetValue(true);
frc::Wait(0.5_s);
interrupt.Enable();
frc::Wait(20_ms);
frc::Wait(0.5_s);
digitalSim.SetValue(false);
frc::Wait(20_ms);