Skip to content

Commit

Permalink
OboeTester Data Paths skip remaining if unplugged (#2074)
Browse files Browse the repository at this point in the history
If a device is unplugged then there is no point in running any remaining tests.
  • Loading branch information
philburk authored Jul 19, 2024
1 parent 568bde6 commit 7f9b882
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ public class TestDataPathsActivity extends BaseAutoGlitchActivity {
private double mPhaseErrorSum;
private double mPhaseErrorCount;

private boolean mSkipRemainingTests;

private CheckBox mCheckBoxInputPresets;
private CheckBox mCheckBoxAllChannels;
private CheckBox mCheckBoxInputChannelMasks;
Expand Down Expand Up @@ -403,11 +405,13 @@ protected String whyShouldTestBeSkipped() {
&& (requestedInConfig.getDeviceId() != actualInConfig.getDeviceId())) {
why += "inDev(" + requestedInConfig.getDeviceId()
+ "!=" + actualInConfig.getDeviceId() + "),";
mSkipRemainingTests = true; // the device must have been unplugged
}
if (requestedOutConfig.getDeviceId() != 0
&& (requestedOutConfig.getDeviceId() != actualOutConfig.getDeviceId())) {
why += ", outDev(" + requestedOutConfig.getDeviceId()
+ "!=" + actualOutConfig.getDeviceId() + "),";
mSkipRemainingTests = true; // the device must have been unplugged
}
if ((requestedInConfig.getInputPreset() != actualInConfig.getInputPreset())) {
why += ", inPre(" + requestedInConfig.getInputPreset()
Expand Down Expand Up @@ -468,6 +472,9 @@ String getOneLineSummary() {

@Override
protected TestResult testCurrentConfigurations() throws InterruptedException {
if (mSkipRemainingTests) {
throw new DeviceUnpluggedException();
}
TestResult testResult = super.testCurrentConfigurations();
if (testResult != null) {
testResult.addComment("mag = " + TestDataPathsActivity.getMagnitudeText(mMagnitude)
Expand Down Expand Up @@ -858,6 +865,12 @@ private void testOutputDeviceTypes() throws InterruptedException {
}
}

class DeviceUnpluggedException extends RuntimeException {
public DeviceUnpluggedException() {
super("Device was unplugged.");
}
}

@Override
public void runTest() {
try {
Expand All @@ -871,7 +884,12 @@ public void runTest() {

runOnUiThread(() -> keepScreenOn(true));

testOutputDeviceTypes();
mSkipRemainingTests = false;
try {
testOutputDeviceTypes();
} catch(DeviceUnpluggedException e) {
log("Remaining tests were skipped, " + e.getMessage());
}

compareFailedTestsWithNearestPassingTest();

Expand Down

0 comments on commit 7f9b882

Please sign in to comment.