From 7f9b8823c118d98952c42b19d04af900af4948f3 Mon Sep 17 00:00:00 2001 From: Phil Burk Date: Fri, 19 Jul 2024 13:47:32 -0700 Subject: [PATCH] OboeTester Data Paths skip remaining if unplugged (#2074) If a device is unplugged then there is no point in running any remaining tests. --- .../oboetester/TestDataPathsActivity.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/TestDataPathsActivity.java b/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/TestDataPathsActivity.java index fc43f9c7..bc3ca6f7 100644 --- a/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/TestDataPathsActivity.java +++ b/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/TestDataPathsActivity.java @@ -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; @@ -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() @@ -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) @@ -858,6 +865,12 @@ private void testOutputDeviceTypes() throws InterruptedException { } } + class DeviceUnpluggedException extends RuntimeException { + public DeviceUnpluggedException() { + super("Device was unplugged."); + } + } + @Override public void runTest() { try { @@ -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();