diff options
author | 2016-09-23 10:59:55 -0700 | |
---|---|---|
committer | 2016-09-28 13:34:46 -0700 | |
commit | e663653c797446a6018523677c1a55769fd1423c (patch) | |
tree | 9ac356be54c6c02aa61e3dbeff89b6b01f224677 | |
parent | 7f7fb9c0dcb5fc0ed251b3f9bb775de5278534a7 (diff) |
Make run-test fail if output-path is too long
Long output-path in no prebuild mode leads to silent fallback to
interpreter in dalvikvm.
This change ensures that we handle this situation by failing the
test.
Bug: 31597671
Test: m test-art-run-test -j
Change-Id: I19a7cee788760a81c9395be1252b2edab0db39f7
-rwxr-xr-x | test/etc/run-test-jar | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar index c51cb0db2a..d8f42a2b4b 100755 --- a/test/etc/run-test-jar +++ b/test/etc/run-test-jar @@ -404,6 +404,24 @@ if [ "$HOST" = "n" ]; then fi fi +# Prevent test from silently falling back to interpreter in no-prebuild mode. This happens +# when DEX_LOCATION path is too long, because vdex/odex filename is constructed by taking +# full path to dex, stripping leading '/', appending '@classes.vdex' and changing every +# remaining '/' into '@'. +if [ "$HOST" = "y" ]; then + max_filename_size=$(getconf NAME_MAX $DEX_LOCATION) +else + # There is no getconf on device, fallback to standard value. See NAME_MAX in kernel <linux/limits.h> + max_filename_size=255 +fi +# Compute VDEX_NAME. +DEX_LOCATION_STRIPPED="${DEX_LOCATION#/}" +VDEX_NAME="${DEX_LOCATION_STRIPPED//\//@}@$TEST_NAME.jar@classes.vdex" +if [ ${#VDEX_NAME} -gt $max_filename_size ]; then + echo "Dex location path too long." + exit 1 +fi + dex2oat_cmdline="true" mkdir_locations="${DEX_LOCATION}/dalvik-cache/$ISA" strip_cmdline="true" |