Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OboeTester: save a WAVE file when DataPaths test fails #2045

Merged
merged 2 commits into from
Jun 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
import android.media.AudioDeviceInfo;
import android.media.AudioManager;
import android.os.Bundle;
import android.os.Environment;

import androidx.annotation.Nullable;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Locale;
Expand Down Expand Up @@ -377,13 +379,13 @@ protected TestResult testCurrentConfigurations() throws InterruptedException {
appendFailedSummary(" " + getConfigText(actualInConfig) + "\n");
appendFailedSummary(" " + getConfigText(actualOutConfig) + "\n");
appendFailedSummary(" " + resultText + "\n");
saveRecordingAsWave();
mAutomatedTestRunner.incrementFailCount();
result = TEST_RESULT_FAILED;
} else {
mAutomatedTestRunner.incrementPassCount();
result = TEST_RESULT_PASSED;
}

}
mAutomatedTestRunner.flushLog();

Expand All @@ -397,6 +399,17 @@ protected TestResult testCurrentConfigurations() throws InterruptedException {
return testResult;
}

private void saveRecordingAsWave() {
File recordingDir = getExternalFilesDir(Environment.DIRECTORY_MUSIC);
File waveFile = new File(recordingDir, String.format("glitch_%03d.wav", getTestCount()));
int saveResult = saveWaveFile(waveFile.getAbsolutePath());
if (saveResult > 0) {
appendFailedSummary("Saved in " + waveFile.getAbsolutePath() + "\n");
} else {
appendFailedSummary("saveWaveFile() returned " + saveResult + "\n");
}
}

protected int getTestCount() {
return mAutomatedTestRunner.getTestCount();
}
Expand Down