commit | 675dc6d6cde1ca1e98fe067a0f46dbe2ab255d37 | [log] [tgz] |
---|---|---|
author | jdesprez <jdesprez@google.com> | Mon May 01 14:11:16 2017 -0700 |
committer | jdesprez <jdesprez@google.com> | Mon May 01 14:11:16 2017 -0700 |
tree | 17f5bf7e73cb6f205c38930281cc8cb8bd3fa879 | |
parent | 5f1a18a023d873d7a8f989bd95e2d3c95fb97d25 [diff] |
Cts unit test: aapt parse can fail Add a retry when parsing apks for their abis since some errors with aapt have been observed. Test: local unit tests run Change-Id: Ia21d14d57ad63821202f9d6bfec0cd82540d811b
diff --git a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ValidateTestsAbi.java b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ValidateTestsAbi.java index b85a036..f9f2be4 100644 --- a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ValidateTestsAbi.java +++ b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ValidateTestsAbi.java
@@ -89,6 +89,20 @@ for (File testApk : listApks) { AaptParser result = AaptParser.parse(testApk); + // Retry as we have seen flake with aapt sometimes. + if (result == null) { + for (int i = 0; i < 2; i++) { + result = AaptParser.parse(testApk); + if (result != null) { + break; + } + } + // If still couldn't parse the apk + if (result == null) { + fail(String.format("Fail to run 'aapt dump badging %s'", + testApk.getAbsolutePath())); + } + } // We only check the apk that have native code if (!result.getNativeCode().isEmpty()) { List<String> supportedAbiApk = result.getNativeCode();