summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Calin Juravle <calin@google.com> 2018-02-19 13:26:39 -0800
committer Calin Juravle <calin@google.com> 2018-02-19 13:28:32 -0800
commita1322f062616c7979da49d2c2198eabb6b7b259d (patch)
tree1fe9765b364868d8a0b5b13d670023602e5a453d
parent02c08794435da77724486a5170d1733f760bc8af (diff)
Stress profile saving for gc-stress tests
Force profiling saving for gc-stress configuration. It will verify the interactions between profile saving and GC. Test: run-test Bug: 62004634 Change-Id: Ia6f76debedd39353b210975fe95b155f63b1fa57
-rwxr-xr-xtest/etc/run-test-jar18
-rwxr-xr-xtest/run-test3
2 files changed, 21 insertions, 0 deletions
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index bb6ace1b06..5200db51b1 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -75,6 +75,7 @@ JVMTI_REDEFINE_STRESS="n"
VDEX_FILTER=""
PROFILE="n"
RANDOM_PROFILE="n"
+SAVE_PROFILE="n"
# The normal dex2oat timeout.
DEX2OAT_TIMEOUT="300" # 5 mins
# The *hard* timeout where we really start trying to kill the dex2oat.
@@ -364,6 +365,9 @@ while true; do
elif [ "x$1" = "x--random-profile" ]; then
RANDOM_PROFILE="y"
shift
+ elif [ "x$1" = "x--save-profile" ]; then
+ SAVE_PROFILE="y"
+ shift
elif [ "x$1" = "x--set-stack-trace-dump-dir" ]; then
SET_STACK_TRACE_DUMP_DIR="y"
shift
@@ -680,6 +684,7 @@ if [ ${#VDEX_NAME} -gt $max_filename_size ]; then
exit 1
fi
+create_profile_cmdline="true"
profman_cmdline="true"
dex2oat_cmdline="true"
vdex_cmdline="true"
@@ -688,6 +693,16 @@ mkdir_locations="${mkdir_locations} ${DEX_LOCATION}/dalvik-cache/$ISA"
strip_cmdline="true"
sync_cmdline="true"
+if [ "$SAVE_PROFILE" = "y" ]; then
+ profile_file="$DEX_LOCATION/$TEST_NAME.prof"
+ create_profile_cmdline="touch $DEX_LOCATION/$TEST_NAME.prof"
+ FLAGS="${FLAGS} -Xjitsaveprofilinginfo -Xps-profile-boot-class-path"
+ FLAGS="${FLAGS} -Xps-profile-path:${profile_file}"
+ # Use -Xjitinitialsize:32M to prevent profiling info creation failure.
+ # On debug build the code cache is too small.
+ FLAGS="${FLAGS} -Xjitinitialsize:32M"
+fi
+
# PROFILE takes precedence over RANDOM_PROFILE, since PROFILE tests require a
# specific profile to run properly.
if [ "$PROFILE" = "y" ] || [ "$RANDOM_PROFILE" = "y" ]; then
@@ -801,6 +816,7 @@ dalvikvm_cmdline=$(echo $dalvikvm_cmdline)
dm_cmdline=$(echo $dm_cmdline)
vdex_cmdline=$(echo $vdex_cmdline)
profman_cmdline=$(echo $profman_cmdline)
+create_profile_cmdline=$(echo $create_profile_cmdline)
# Use an empty ASAN_OPTIONS to enable defaults.
# Note: this is required as envsetup right now exports detect_leaks=0.
@@ -866,6 +882,7 @@ if [ "$HOST" = "n" ]; then
mkdir -p ${mkdir_locations} && \
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH && \
export PATH=$ANDROID_ROOT/bin:$PATH && \
+ $create_profile_cmdline && \
$profman_cmdline && \
$dex2oat_cmdline && \
$dm_cmdline && \
@@ -962,6 +979,7 @@ else
export ASAN_OPTIONS=$RUN_TEST_ASAN_OPTIONS
mkdir -p ${mkdir_locations} || exit 1
+ $create_profile_cmdline || { echo "Failed to create profile." >&2 ; exit 2; }
$profman_cmdline || { echo "Profman failed." >&2 ; exit 2; }
$dex2oat_cmdline || { echo "Dex2oat failed." >&2 ; exit 2; }
$dm_cmdline || { echo "Dex2oat failed." >&2 ; exit 2; }
diff --git a/test/run-test b/test/run-test
index 6bcb9cdabb..456349e287 100755
--- a/test/run-test
+++ b/test/run-test
@@ -254,6 +254,9 @@ while true; do
elif [ "x$1" = "x--gcstress" ]; then
basic_verify="true"
gc_stress="true"
+ # Save profiles when stressing the GC.
+ # This will verify the interactions between profile saving and GC.
+ run_args="${run_args} --save-profile"
shift
elif [ "x$1" = "x--jvmti-step-stress" ]; then
jvmti_step_stress="true"