Bail out of the integration tests if enable fails (#792)

A failure is much better then an infinite loop.
This commit is contained in:
Thad House
2017-12-04 20:24:26 -08:00
committed by Peter Johnson
parent 65cc85f68d
commit 64bfdc1a69
2 changed files with 17 additions and 1 deletions

View File

@@ -43,10 +43,20 @@ class TestEnvironment : public testing::Environment {
HAL_ObserveUserProgramStarting();
LiveWindow::GetInstance()->SetEnabled(false);
llvm::outs() << "Waiting for enable\n";
llvm::outs() << "Started coms\n";
int enableCounter = 0;
while (!DriverStation::GetInstance().IsEnabled()) {
if (enableCounter > 50) {
// Robot did not enable properly after 5 seconds.
// Force exit
llvm::errs() << " Failed to enable. Aborting\n";
std::terminate();
}
Wait(0.1);
llvm::outs() << "Waiting for enable: " << enableCounter++ << "\n";
}
}