Limit the size of files created by run-test to 2MB.

In MemMap::MapAnonymous on the host, avoid creating ashmem regions that are
backed by files, when the size of the file will be greater than the ulimit.

Change-Id: I7cbf2ac59bf5869ed85850bea8d71898f3b7e1c7
diff --git a/test/run-test b/test/run-test
index 34b06cc..d1c5bb2 100755
--- a/test/run-test
+++ b/test/run-test
@@ -298,6 +298,17 @@
 
 export TEST_NAME=`basename ${test_dir}`
 
+# To cause tests to fail fast, limit the file sizes created by dx, dex2oat and ART output to 2MB.
+file_size_limit=2048
+if echo "$test_dir" | grep 089; then
+  file_size_limit=5120
+elif echo "$test_dir" | grep 083; then
+  file_size_limit=5120
+fi
+if ! ulimit "$file_size_limit"; then
+   echo "ulimit file size setting failed"
+fi
+
 good="no"
 if [ "$dev_mode" = "yes" ]; then
     "./${build}" 2>&1
@@ -376,7 +387,7 @@
         echo '#################### info'
         cat "${td_info}" | sed 's/^/# /g'
         echo '#################### diffs'
-        diff --strip-trailing-cr -u "$expected" "$output"
+        diff --strip-trailing-cr -u "$expected" "$output" | tail -n 500
         echo '####################'
         echo ' '
     fi