mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user