Cleanup use of ulimit in run tests.
Rather than setting a file size limit that is too low and overriding
the limit for all or many of the tests, set a single generous file
size limit. This should be much easier to maintain while still
providing some value.
Test: ./test/testrunner/testrunner.py --host --interpreter --jit --optimizing --relocate --no-relocate --prebuild --no-prebuild
Test: ./test/testrunner/testrunner.py --target
Change-Id: I9dc92c9db0819e8b65816b8be872dacc1871c30c
diff --git a/test/701-easy-div-rem/build b/test/701-easy-div-rem/build
index 666fe89..d83ee82 100644
--- a/test/701-easy-div-rem/build
+++ b/test/701-easy-div-rem/build
@@ -21,12 +21,4 @@
mkdir src
python ./genMain.py
-# Increase the file size limitation for classes.lst as the machine generated
-# source file contains a lot of methods and is quite large.
-
-# Jack generates big temp files so only apply ulimit for dx.
-if [ ${USE_JACK} = "false" ]; then
- ulimit -S 4096
-fi
-
./default-build
diff --git a/test/961-default-iface-resolution-gen/build b/test/961-default-iface-resolution-gen/build
index ccebbe4..2f7e3ba 100755
--- a/test/961-default-iface-resolution-gen/build
+++ b/test/961-default-iface-resolution-gen/build
@@ -17,15 +17,6 @@
# make us exit on a failure
set -e
-# We will be making more files than the ulimit is set to allow. Remove it temporarily.
-OLD_ULIMIT=`ulimit -S`
-ulimit -S unlimited
-
-restore_ulimit() {
- ulimit -S "$OLD_ULIMIT"
-}
-trap 'restore_ulimit' ERR
-
if [[ $@ != *"--jvm"* ]]; then
# Don't do anything with jvm
# Hard-wired use of experimental jack.
@@ -39,6 +30,3 @@
./util-src/generate_java.py ./src ./expected.txt
./default-build "$@" --experimental default-methods
-
-# Reset the ulimit back to its initial value
-restore_ulimit
diff --git a/test/964-default-iface-init-gen/build b/test/964-default-iface-init-gen/build
index ccebbe4..2f7e3ba 100755
--- a/test/964-default-iface-init-gen/build
+++ b/test/964-default-iface-init-gen/build
@@ -17,15 +17,6 @@
# make us exit on a failure
set -e
-# We will be making more files than the ulimit is set to allow. Remove it temporarily.
-OLD_ULIMIT=`ulimit -S`
-ulimit -S unlimited
-
-restore_ulimit() {
- ulimit -S "$OLD_ULIMIT"
-}
-trap 'restore_ulimit' ERR
-
if [[ $@ != *"--jvm"* ]]; then
# Don't do anything with jvm
# Hard-wired use of experimental jack.
@@ -39,6 +30,3 @@
./util-src/generate_java.py ./src ./expected.txt
./default-build "$@" --experimental default-methods
-
-# Reset the ulimit back to its initial value
-restore_ulimit
diff --git a/test/968-default-partial-compile-gen/build b/test/968-default-partial-compile-gen/build
index 1e9f8aa..00ccb89 100755
--- a/test/968-default-partial-compile-gen/build
+++ b/test/968-default-partial-compile-gen/build
@@ -17,15 +17,6 @@
# make us exit on a failure
set -e
-# We will be making more files than the ulimit is set to allow. Remove it temporarily.
-OLD_ULIMIT=`ulimit -S`
-ulimit -S unlimited
-
-restore_ulimit() {
- ulimit -S "$OLD_ULIMIT"
-}
-trap 'restore_ulimit' ERR
-
# TODO: Support running with jack.
if [[ $@ == *"--jvm"* ]]; then
@@ -45,6 +36,3 @@
# Use the default build script
./default-build "$@" "$EXTRA_ARGS" --experimental default-methods
fi
-
-# Reset the ulimit back to its initial value
-restore_ulimit
diff --git a/test/970-iface-super-resolution-gen/build b/test/970-iface-super-resolution-gen/build
index fd1b271..7217fac 100755
--- a/test/970-iface-super-resolution-gen/build
+++ b/test/970-iface-super-resolution-gen/build
@@ -17,15 +17,6 @@
# make us exit on a failure
set -e
-# We will be making more files than the ulimit is set to allow. Remove it temporarily.
-OLD_ULIMIT=`ulimit -S`
-ulimit -S unlimited
-
-restore_ulimit() {
- ulimit -S "$OLD_ULIMIT"
-}
-trap 'restore_ulimit' ERR
-
# Should we compile with Java source code. By default we will use Smali.
USES_JAVA_SOURCE="false"
if [[ $@ == *"--jvm"* ]]; then
@@ -50,6 +41,3 @@
fi
./default-build "$@" --experimental default-methods
-
-# Reset the ulimit back to its initial value
-restore_ulimit
diff --git a/test/971-iface-super/build b/test/971-iface-super/build
index 1e9f8aa..00ccb89 100755
--- a/test/971-iface-super/build
+++ b/test/971-iface-super/build
@@ -17,15 +17,6 @@
# make us exit on a failure
set -e
-# We will be making more files than the ulimit is set to allow. Remove it temporarily.
-OLD_ULIMIT=`ulimit -S`
-ulimit -S unlimited
-
-restore_ulimit() {
- ulimit -S "$OLD_ULIMIT"
-}
-trap 'restore_ulimit' ERR
-
# TODO: Support running with jack.
if [[ $@ == *"--jvm"* ]]; then
@@ -45,6 +36,3 @@
# Use the default build script
./default-build "$@" "$EXTRA_ARGS" --experimental default-methods
fi
-
-# Reset the ulimit back to its initial value
-restore_ulimit
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index de16256..c34f8e3 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -444,27 +444,11 @@
JNI_OPTS="-Xjnigreflimit:512 -Xcheck:jni"
+COMPILE_FLAGS="${COMPILE_FLAGS} --runtime-arg -Xnorelocate"
if [ "$RELOCATE" = "y" ]; then
- COMPILE_FLAGS="${COMPILE_FLAGS} --runtime-arg -Xnorelocate"
FLAGS="${FLAGS} -Xrelocate"
- if [ "$HOST" = "y" ]; then
- # Run test sets a fairly draconian ulimit that we will likely blow right over
- # since we are relocating. Get the total size of the /system/framework directory
- # in 512 byte blocks and set it as the ulimit. This should be more than enough
- # room.
- if [ ! `uname` = "Darwin" ]; then # TODO: Darwin doesn't support "du -B..."
- ulimit -S $(du -c -B512 ${ANDROID_HOST_OUT}/framework 2>/dev/null | tail -1 | cut -f1) || exit 1
- fi
- fi
else
FLAGS="$FLAGS -Xnorelocate"
- COMPILE_FLAGS="${COMPILE_FLAGS} --runtime-arg -Xnorelocate"
-fi
-
-if [ "$HOST" = "y" ]; then
- # Increase ulimit to 128MB in case we are running hprof test,
- # or string append test with art-debug-gc.
- ulimit -S 128000 || exit 1
fi
if [ "$HOST" = "n" ]; then
diff --git a/test/run-test b/test/run-test
index 1ac2857..1715423 100755
--- a/test/run-test
+++ b/test/run-test
@@ -766,27 +766,14 @@
run_args="${run_args} --testlib ${testlib}"
-# To cause tests to fail fast, limit the file sizes created by dx, dex2oat and ART output to 2MB.
-build_file_size_limit=2048
-run_file_size_limit=2048
-
-# Add tests requiring a higher ulimit to this list. Ulimits might need to be raised to deal with
-# large amounts of expected output or large generated files.
-if echo "$test_dir" | grep -Eq "(083|089|961|964|971)" > /dev/null; then
- build_file_size_limit=5120
- run_file_size_limit=5120
-fi
-if [ "$run_checker" = "yes" -a "$target_mode" = "yes" ]; then
- # We will need to `adb pull` the .cfg output from the target onto the host to
- # run checker on it. This file can be big.
- build_file_size_limit=32768
- run_file_size_limit=32768
-fi
-if [ ${USE_JACK} = "false" ]; then
- # Set ulimit if we build with dx only, Jack can generate big temp files.
- if ! ulimit -S "$build_file_size_limit"; then
- err_echo "ulimit file size setting failed"
- fi
+# To cause tests to fail fast, limit the file sizes created by dx, dex2oat and
+# ART output to approximately 128MB. This should be more than sufficient
+# for any test while still catching cases of runaway output.
+# Set a hard limit to encourage ART developers to increase the ulimit here if
+# needed to support a test case rather than resetting the limit in the run
+# script for the particular test in question.
+if ! ulimit -f -H 128000; then
+ err_echo "ulimit file size setting failed"
fi
good="no"
@@ -797,9 +784,6 @@
build_exit="$?"
echo "build exit status: $build_exit" 1>&2
if [ "$build_exit" = '0' ]; then
- if ! ulimit -S "$run_file_size_limit"; then
- err_echo "ulimit file size setting failed"
- fi
echo "${test_dir}: running..." 1>&2
"./${run}" $run_args "$@" 2>&1
run_exit="$?"
@@ -825,9 +809,6 @@
"./${build}" $build_args >"$build_output" 2>&1
build_exit="$?"
if [ "$build_exit" = '0' ]; then
- if ! ulimit -S "$run_file_size_limit"; then
- err_echo "ulimit file size setting failed"
- fi
echo "${test_dir}: running..." 1>&2
"./${run}" $run_args "$@" >"$output" 2>&1
if [ "$run_checker" = "yes" ]; then
@@ -862,9 +843,6 @@
"./${build}" $build_args >"$build_output" 2>&1
build_exit="$?"
if [ "$build_exit" = '0' ]; then
- if ! ulimit -S "$run_file_size_limit"; then
- err_echo "ulimit file size setting failed"
- fi
echo "${test_dir}: running..." 1>&2
"./${run}" $run_args "$@" >"$output" 2>&1
run_exit="$?"
@@ -934,9 +912,6 @@
echo "${test_dir}: not bisecting, checker test." 1>&2
else
# Increase file size limit, bisection search can generate large logfiles.
- if ! ulimit -S unlimited; then
- err_echo "ulimit file size setting failed"
- fi
echo "${test_dir}: bisecting..." 1>&2
cwd=`pwd`
maybe_device_mode=""