Integrate crash parser into TestMedia and TestMediaCodec
Bug: 140568097
Run tests on Android/aosp_marlin/marlin:NMR1/NDE27K/3122367:userdebug/test-keys or equivalent.
Expect failures to be caught by crash parser.
Test: run cts -m CtsSecurityBulletinHostTestCases -t android.security.cts.TestMediaCodec
Test: run cts -m CtsSecurityBulletinHostTestCases -t android.security.cts.TestMedia
Change-Id: Ibe2aab97d9735283991aa8c7c4276e8da41051b8
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java b/hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java
index 2c7c121..bc71522 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java
@@ -405,27 +405,12 @@
AdbUtils.runCommandLine("rm /data/local/tmp/" + tempFile, device);
}
}
- if (test_failed == true) {
- Assert.fail("PoC was interrupted");
+ if (test_failed) {
+ fail("PoC was interrupted");
}
}
if (t.isAlive()) {
Assert.fail("PoC not completed within timeout of " + timeout + " ms");
}
}
-
- /**
- * Raises assert exception upon crash/error occurence
- *
- * @param crashPatternList array of crash log patterns to be checked for
- * @param logcat String to be parsed
- */
- public static void checkCrash(String crashPatternList[], String logcat)
- throws Exception {
- for (String crashPattern : crashPatternList) {
- assertFalse("Crash log pattern found!",
- Pattern.compile(crashPattern, Pattern.MULTILINE)
- .matcher(logcat).find());
- }
- }
}
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java b/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java
index bbfd78e..98793bb 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java
@@ -45,41 +45,6 @@
* before any existing test methods
****************************************************************/
-
- /**
- * Checks for linker errors
- *
- * @param binaryName name of the binary
- * @param logcat String to be parsed
- */
- public static boolean isLinkerErrorPresent(String binaryName, String logcat)
- throws Exception {
- return Pattern
- .compile("CANNOT LINK EXECUTABLE \"" + TMP_FILE_PATH
- + binaryName + "\"", Pattern.MULTILINE)
- .matcher(logcat).find();
- }
-
- /**
- * Checks for crash
- *
- * @param binaryName Name of the binary
- * @param errPattern error patterns to be checked for
- * @param logcat String to be parsed
- */
- public static void checkCrash(String binaryName, String errPattern[],
- String logcat) throws Exception {
- String genericCrashPattern[] = {
- "name: " + binaryName + " >>> " + TMP_FILE_PATH + binaryName
- + " <<<\n.*?SIGABRT",
- "name: " + binaryName + " >>> " + TMP_FILE_PATH + binaryName
- + " <<<\n.*?SIGSEGV"};
- AdbUtils.checkCrash(genericCrashPattern, logcat);
- if (errPattern != null) {
- AdbUtils.checkCrash(errPattern, logcat);
- }
- }
-
/**
* Pushes input files, runs the PoC and checks for crash and hang
*
@@ -110,10 +75,7 @@
}
}
}, TIMEOUT_SEC * 1000, device, inputFiles);
- String logcatOut = AdbUtils.runCommandLine("logcat -d", device);
- boolean linkerErrorFound = isLinkerErrorPresent(binaryName, logcatOut);
- if (!linkerErrorFound) {
- checkCrash(binaryName, errPattern, logcatOut);
- }
+
+ AdbUtils.assertNoCrashes(device, binaryName);
}
}