summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Dombroski <cdombroski@google.com>2021-03-15 21:13:42 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-03-15 21:13:42 +0000
commitb1e69386fe32130a3295f5036c6e1f871bbb9df7 (patch)
treec329340f939e3bc984c8c3909cea2818b0cfdcb6
parent3713b49ef556b3fc5f5f38aef36b5c95bd98e3ec (diff)
parent19c722f1441c875b1b962b63d6e71ac371cfd837 (diff)
downloadcts-b1e69386fe32130a3295f5036c6e1f871bbb9df7.tar.gz
Add more logging and locking to StagefrightTest am: 4c2cd98825 am: 1610edc6c2 am: b8cfcab102 am: 19c722f144
Original change: https://googleplex-android-review.googlesource.com/c/platform/cts/+/13843935 Change-Id: Ife8b1b9f8c01f18b750862b5ed61f1836db464b8
-rw-r--r--tests/tests/security/src/android/security/cts/StagefrightTest.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/tests/security/src/android/security/cts/StagefrightTest.java b/tests/tests/security/src/android/security/cts/StagefrightTest.java
index bff8c2a8915..a2d5ccd9cab 100644
--- a/tests/tests/security/src/android/security/cts/StagefrightTest.java
+++ b/tests/tests/security/src/android/security/cts/StagefrightTest.java
@@ -1861,7 +1861,9 @@ public class StagefrightTest {
Thread.sleep(CHECK_INTERVAL);
timeout -= CHECK_INTERVAL;
}
+
if (!reportFile.exists() || !reportFile.isFile() || !lockFile.exists()) {
+ Log.e(TAG, "couldn't get the report or lock file");
return null;
}
try (BufferedReader reader = new BufferedReader(new FileReader(reportFile))) {
@@ -1926,7 +1928,9 @@ public class StagefrightTest {
if (what != MediaPlayer.MEDIA_ERROR_SERVER_DIED) {
what = newWhat;
}
+
lock.lock();
+ errored = true;
condition.signal();
lock.unlock();
@@ -1949,17 +1953,19 @@ public class StagefrightTest {
public int waitForError() throws InterruptedException {
lock.lock();
- if (condition.awaitNanos(TIMEOUT_NS) <= 0) {
- Log.d(TAG, "timed out on waiting for error");
+ if (!errored && !completed) {
+ if (condition.awaitNanos(TIMEOUT_NS) <= 0) {
+ Log.d(TAG, "timed out on waiting for error. " +
+ "errored: " + errored + ", completed: " + completed);
+ }
}
lock.unlock();
- if (what != 0) {
+ if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) {
// Sometimes mediaserver signals a decoding error first, and *then* crashes
// due to additional in-flight buffers being processed, so wait a little
// and see if more errors show up.
+ Log.e(TAG, "couldn't get media crash yet, waiting 1 second");
SystemClock.sleep(1000);
- }
- if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) {
JSONArray crashes = getCrashReport(name.getMethodName(), 5000);
if (crashes == null) {
Log.e(TAG, "Crash results not found for test " + name.getMethodName());
@@ -1972,8 +1978,8 @@ public class StagefrightTest {
// 0 is the code for no error.
return 0;
}
-
}
+ Log.d(TAG, "waitForError finished with no errors.");
return what;
}
@@ -1990,6 +1996,7 @@ public class StagefrightTest {
Condition condition = lock.newCondition();
int what;
boolean completed = false;
+ boolean errored = false;
}
class LooperThread extends Thread {