Add Vogar expectations file for tests failing because of missing getrandom().

Add Libcore tests using the `getrandom()` syscall (introduced in Linux
3.17) to a new expectations
file (`art/tools/libcore_no_getrandom_failures.txt`) and add new
option `--no-getrandom` to script `art/tools/run-libcore-tests.sh` to
honor this expectations file.

This option is meant for ART Buildbot devices that have a kernel older
than Linux 3.17, like fugu (Nexus Player) devices, which runs
Linux 3.10.

Test: Rely on the ART Buildbot, once crrev.com/c/1811251 is in.
Bug: 141230711
Change-Id: I8c513da63012c86e81038fd1d3cbb57e8ac3c17c
diff --git a/tools/libcore_no_getrandom_failures.txt b/tools/libcore_no_getrandom_failures.txt
new file mode 100644
index 0000000..3290f35
--- /dev/null
+++ b/tools/libcore_no_getrandom_failures.txt
@@ -0,0 +1,102 @@
+/*
+ * This file contains expectations for ART's Buildbot when running on devices
+ * whose kernel does not support the getrandom() syscall (available from
+ * Linux 3.17).
+ * The script that uses this file is art/tools/run-libcore-tests.sh.
+ */
+
+[
+{
+  description: "Test using the getrandom() syscall, only available from Linux 3.17.",
+  result: EXEC_FAILED,
+  bug: 141230711,
+  names: [
+    "libcore.java.math.BigIntegerTest#test_Constructor_IILjava_util_Random",
+    "libcore.java.math.BigIntegerTest#test_probablePrime",
+    "libcore.javax.crypto.CipherInputStreamTest#testDecryptCorruptGCM",
+    "libcore.javax.crypto.CipherOutputStreamTest#testDecryptCorruptGCM",
+    "libcore.libcore.timezone.TimeZoneFinderTest#createInstanceWithFallback",
+    "libcore.libcore.timezone.TimeZoneFinderTest#getCountryZonesFinder",
+    "libcore.libcore.timezone.TimeZoneFinderTest#getCountryZonesFinder_empty",
+    "libcore.libcore.timezone.TimeZoneFinderTest#getCountryZonesFinder_invalid",
+    "libcore.libcore.timezone.TimeZoneFinderTest#getIanaVersion",
+    "libcore.libcore.timezone.TimeZoneFinderTest#lookupCountryTimeZones_caseInsensitive",
+    "libcore.libcore.timezone.TimeZoneFinderTest#lookupCountryTimeZones_unknownCountryReturnsNull",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_badCountryEverUtc",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_badTimeZoneMappingNotAfter",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_badTimeZoneMappingPicker",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_emptyFile",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_missingCountryCode",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_missingCountryDefault",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_missingCountryEverUtc",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_missingCountryZones",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_missingIanaVersionAttribute",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_noCountriesOk",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_timeZoneMappingNotAfter",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_timeZoneMappingPicker",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_truncatedInput",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_unexpectedChildInTimeZoneIdThrows",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_unexpectedComments",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_unexpectedElementsIgnored",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_unexpectedRootElement",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_unexpectedTextIgnored",
+    "libcore.libcore.timezone.TimeZoneFinderTest#xmlParsing_unknownTimeZoneIdIgnored",
+    "org.apache.harmony.crypto.tests.javax.crypto.CipherInputStream1Test#test_ConstructorLjava_io_InputStreamLjavax_crypto_Cipher",
+    "org.apache.harmony.crypto.tests.javax.crypto.CipherOutputStream1Test#test_ConstructorLjava_io_OutputStreamLjavax_crypto_Cipher",
+    "org.apache.harmony.crypto.tests.javax.crypto.CipherTest#test_",
+    "org.apache.harmony.crypto.tests.javax.crypto.CipherTest#test_doFinalLjava_nio_ByteBufferLjava_nio_ByteBuffer",
+    "org.apache.harmony.crypto.tests.javax.crypto.CipherTest#test_initWithKey",
+    "org.apache.harmony.crypto.tests.javax.crypto.CipherTest#test_initWithSecureRandom",
+    "org.apache.harmony.crypto.tests.javax.crypto.CipherTest#test_updateLjava_nio_ByteBufferLjava_nio_ByteBuffer",
+    "org.apache.harmony.crypto.tests.javax.crypto.EncryptedPrivateKeyInfoTest#test_ROUNDTRIP_GetKeySpecCipher01",
+    "org.apache.harmony.crypto.tests.javax.crypto.EncryptedPrivateKeyInfoTest#test_ROUNDTRIP_GetKeySpecCipher02",
+    "org.apache.harmony.crypto.tests.javax.crypto.EncryptedPrivateKeyInfoTest#test_ROUNDTRIP_GetKeySpecKey01",
+    "org.apache.harmony.crypto.tests.javax.crypto.EncryptedPrivateKeyInfoTest#test_ROUNDTRIP_GetKeySpecKey02",
+    "org.apache.harmony.crypto.tests.javax.crypto.EncryptedPrivateKeyInfoTest#test_ROUNDTRIP_GetKeySpecKeyProvider01",
+    "org.apache.harmony.crypto.tests.javax.crypto.EncryptedPrivateKeyInfoTest#test_ROUNDTRIP_GetKeySpecKeyProvider02",
+    "org.apache.harmony.crypto.tests.javax.crypto.EncryptedPrivateKeyInfoTest#test_ROUNDTRIP_GetKeySpecKeyString01",
+    "org.apache.harmony.crypto.tests.javax.crypto.EncryptedPrivateKeyInfoTest#test_ROUNDTRIP_GetKeySpecKeyString02",
+    "org.apache.harmony.crypto.tests.javax.crypto.EncryptedPrivateKeyInfoTest#test_getAlgName",
+    "org.apache.harmony.crypto.tests.javax.crypto.ExemptionMechanismTest#test_initLjava_security_Key",
+    "org.apache.harmony.crypto.tests.javax.crypto.ExemptionMechanismTest#test_initLjava_security_KeyLjava_security_AlgorithmParameters",
+    "org.apache.harmony.crypto.tests.javax.crypto.ExemptionMechanismTest#test_initLjava_security_KeyLjava_security_spec_AlgorithmParameterSpec",
+    "org.apache.harmony.crypto.tests.javax.crypto.KeyGeneratorTest#testGenerateKey",
+    "org.apache.harmony.crypto.tests.javax.crypto.KeyGeneratorTest#test_initLjava_security_spec_AlgorithmParameterSpec",
+    "org.apache.harmony.crypto.tests.javax.crypto.SealedObjectTest#testDeserialization",
+    "org.apache.harmony.crypto.tests.javax.crypto.SealedObjectTest#testGetAlgorithm",
+    "org.apache.harmony.crypto.tests.javax.crypto.SealedObjectTest#testGetAlgorithmAfterSerialization",
+    "org.apache.harmony.crypto.tests.javax.crypto.SealedObjectTest#testGetObject1",
+    "org.apache.harmony.crypto.tests.javax.crypto.SealedObjectTest#testGetObject2",
+    "org.apache.harmony.crypto.tests.javax.crypto.SealedObjectTest#testGetObject3",
+    "org.apache.harmony.crypto.tests.javax.crypto.SealedObjectTest#testSealedObject1",
+    "org.apache.harmony.crypto.tests.javax.crypto.SecretKeyFactoryTest#test_translateKeyLjavax_crypto_SecretKey",
+    "org.apache.harmony.crypto.tests.javax.crypto.func.CipherAesTest#test_AesISO",
+    "org.apache.harmony.crypto.tests.javax.crypto.func.CipherAesTest#test_AesNoISO",
+    "org.apache.harmony.crypto.tests.javax.crypto.func.CipherAesWrapTest#test_AesWrap",
+    "org.apache.harmony.crypto.tests.javax.crypto.func.CipherDESedeTest#test_DESedeISO",
+    "org.apache.harmony.crypto.tests.javax.crypto.func.CipherDESedeTest#test_DESedeNoISO",
+    "org.apache.harmony.crypto.tests.javax.crypto.func.CipherDESedeWrapTest#test_DESedeWrap",
+    "org.apache.harmony.crypto.tests.javax.crypto.func.CipherDesTest#test_DesISO",
+    "org.apache.harmony.crypto.tests.javax.crypto.func.CipherDesTest#test_DesNoISO",
+    "org.apache.harmony.crypto.tests.javax.crypto.func.CipherPBETest#test_PBEWithMD5AndDES",
+    "org.apache.harmony.crypto.tests.javax.crypto.func.CipherPBETest#test_PBEWithSHAand3KeyTripleDES",
+    "org.apache.harmony.crypto.tests.javax.crypto.func.CipherRSATest#test_RSANoPadding",
+    "org.apache.harmony.crypto.tests.javax.crypto.func.CipherRSATest#test_RSAShortKey",
+    "org.apache.harmony.crypto.tests.javax.crypto.func.KeyGeneratorFunctionalTest#test_",
+    "org.apache.harmony.tests.java.math.BigIntegerConstructorsTest#testConstructorPrime",
+    "org.apache.harmony.tests.java.math.BigIntegerTest#test_isProbablePrimeI",
+    "org.apache.harmony.tests.java.math.OldBigIntegerTest#test_ConstructorIILjava_util_Random",
+    "org.apache.harmony.tests.java.math.OldBigIntegerTest#test_isProbablePrimeI",
+    "org.apache.harmony.tests.java.math.OldBigIntegerTest#test_nextProbablePrime",
+    "org.apache.harmony.tests.java.math.OldBigIntegerTest#test_probablePrime",
+    "org.apache.harmony.tests.java.util.ScannerTest#test_ConstructorLjava_nio_file_Path",
+    "org.apache.harmony.tests.java.util.ScannerTest#test_ConstructorLjava_nio_file_PathLjava_lang_String",
+    "org.apache.harmony.tests.java.util.ScannerTest#test_ConstructorLjava_nio_file_PathLjava_lang_String_Exception",
+    "org.apache.harmony.tests.java.util.UUIDTest#test_randomUUID",
+    "org.apache.harmony.tests.javax.security.OldSHA1PRNGSecureRandomTest#testGenerateSeedint02",
+    "org.apache.harmony.tests.javax.security.OldSHA1PRNGSecureRandomTest#testGenerateSeedint03",
+    "org.apache.harmony.tests.javax.security.OldSHA1PRNGSecureRandomTest#testNextBytesbyteArray03",
+    "org.apache.harmony.tests.javax.security.OldSHA1PRNGSecureRandomTest#testSetSeedbyteArray02"
+  ]
+}
+]
diff --git a/tools/run-libcore-tests.sh b/tools/run-libcore-tests.sh
index 22f2549..5f49bbe 100755
--- a/tools/run-libcore-tests.sh
+++ b/tools/run-libcore-tests.sh
@@ -131,6 +131,9 @@
 gcstress=false
 debug=false
 
+# Run tests that use the getrandom() syscall? (Requires Linux 3.17+).
+getrandom=true
+
 # Don't use device mode by default.
 device_mode=false
 
@@ -164,6 +167,9 @@
   elif [[ "$1" == "-Xgc:gcstress" ]]; then
     gcstress=true
     shift
+  elif [[ "$1" == "--no-getrandom" ]]; then
+    getrandom=false
+    shift
   elif [[ "$1" == "" ]]; then
     break
   else
@@ -214,6 +220,13 @@
   working_packages+=("libcore.libcore.icu")
 fi
 
+if $getrandom; then :; else
+  # Ignore failures in tests that use the getrandom() syscall (which requires
+  # Linux 3.17+). This is needed on fugu (Nexus Player) devices, where the
+  # kernel is Linux 3.10.
+  expectations="$expectations --expectations art/tools/libcore_no_getrandom_failures.txt"
+fi
+
 # Run the tests using vogar.
 echo "Running tests for the following test packages:"
 echo ${working_packages[@]} | tr " " "\n"