Generalize fugu failure handling in run-libcore-tests.sh

Rename libcore_get_no_random_failures.txt to libcore_fugu_failures.txt
and add failures for memfd_create.

The command-line flag --no-getrandom continues to choose fugu failures
as fixing this requires coordination with buildbot scripts in
chrome-infra.

Bug: 146113753
Test: art/tools/run-libcore-tests.sh --mode=device --no-getrandom --verbose

Change-Id: I68999ad25e16f65309e5644256d4d12da8288ab5
diff --git a/tools/libcore_failures.txt b/tools/libcore_failures.txt
index b59eb0e..5d4f3ef 100644
--- a/tools/libcore_failures.txt
+++ b/tools/libcore_failures.txt
@@ -9,12 +9,12 @@
 
 [
 {
-  description: "Os.memfd_create needs kernel version >= 3.17 and bionic-based platform.",
+  description: "Os.memfd_create() only supports bionic-based platforms.",
   result: EXEC_FAILED,
+  modes: [host],
   names: ["libcore.android.system.OsTest#testMemfdCreate",
           "libcore.android.system.OsTest#testMemfdCreateErrno",
-          "libcore.android.system.OsTest#testMemfdCreateFlags"],
-  bug: 146113753
+          "libcore.android.system.OsTest#testMemfdCreateFlags"]
 },
 {
   description: "Assert.java differences between vogar and junit.",
diff --git a/tools/libcore_no_getrandom_failures.txt b/tools/libcore_fugu_failures.txt
similarity index 95%
rename from tools/libcore_no_getrandom_failures.txt
rename to tools/libcore_fugu_failures.txt
index 05af9d7..11183bb 100644
--- a/tools/libcore_no_getrandom_failures.txt
+++ b/tools/libcore_fugu_failures.txt
@@ -1,15 +1,27 @@
 /*
- * 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).
+ * This file contains expectations for ART's Buildbot when running on fugu devices
+ * (Nexus Player, kernel 3.10).
+ *
  * The script that uses this file is art/tools/run-libcore-tests.sh.
  */
 
 [
 {
+  description: "Test using memfd_create() syscall, only available from Linux 3.17.",
+  result: EXEC_FAILED,
+  bug: 146113753,
+  modes: [device_testdex],
+  names: [
+    "libcore.android.system.OsTest#testMemfdCreate",
+    "libcore.android.system.OsTest#testMemfdCreateErrno",
+    "libcore.android.system.OsTest#testMemfdCreateFlags"
+  ]
+},
+{
   description: "Test using the getrandom() syscall, only available from Linux 3.17.",
   result: EXEC_FAILED,
   bug: 141230711,
+  modes: [device_testdex],
   names: [
     "libcore.java.math.BigIntegerTest#test_Constructor_IILjava_util_Random",
     "libcore.java.math.BigIntegerTest#test_probablePrime",
diff --git a/tools/run-libcore-tests.sh b/tools/run-libcore-tests.sh
index 94e7f4a..5bc208e 100755
--- a/tools/run-libcore-tests.sh
+++ b/tools/run-libcore-tests.sh
@@ -225,10 +225,9 @@
 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"
+  # Ignore failures in tests that use the system calls not supported
+  # on fugu (Nexus Player, kernel version Linux 3.10).
+  expectations="$expectations --expectations art/tools/libcore_fugu_failures.txt"
 fi
 
 if [ ! -t 1 ] ; then