diff options
author | Greg Cawthorne <greg.cawthorne@linaro.org> | 2021-11-11 23:42:22 +0000 |
---|---|---|
committer | Greg Cawthorne <greg.cawthorne@linaro.org> | 2021-11-29 20:53:06 +0000 |
commit | 7acc95cad1ac8865e9e7d287872223337c8bccf3 (patch) | |
tree | 3415e5ef468c8c847969c88144867ba944376426 | |
parent | b241e5d728535adf3c93fe0f9f3830d5a1f445a8 (diff) | |
download | art-build-scripts-7acc95cad1ac8865e9e7d287872223337c8bccf3.tar.gz |
Extend command line options for test_art_simulator
Test: ./art-build-scripts/tests/test_art_simulator.sh
Test: ./art-build-scripts/tests/test_art_simulator.sh --jobs 2
Test: ./art-build-scripts/tests/test_art_simulator.sh --single-test test-art-host-run-test-debug-prebuild-optimizing-no-relocate-ntrace-cms-checkjni-picimage-ndebuggable-no-jvmti-cdex-fast-530-checker-regression-reftyp-final64
Test: ./art-build-scripts/tests/test_art_simulator.sh --single-test test-art-host-run-test-debug-prebuild-optimizing-no-relocate-ntrace-cms-checkjni-picimage-ndebuggable-no-jvmti-cdex-fast-530-checker-regression-reftyp-final64 --gc-stress
Test: ./art-build-scripts/tests/test_art_simulator.sh --single-test test-art-host-run-test-debug-prebuild-optimizing-no-relocate-ntrace-cms-checkjni-picimage-ndebuggable-no-jvmti-cdex-fast-530-checker-regression-reftyp-final64 --dump-cfg /path/to/output/file
Test: ./art-build-scripts/tests/test_art_simulator.sh --single-test test-art-host-run-test-debug-prebuild-optimizing-no-relocate-ntrace-cms-checkjni-picimage-ndebuggable-no-jvmti-cdex-fast-530-checker-regression-reftyp-final64 --gdb-dex2oat
Test: ./art-build-scripts/tests/test_art_simulator.sh --keep-going
Test: ./art-build-scripts/tests/test_art_simulator.sh --keep-failures
Test: ./art-build-scripts/tests/test_art_simulator.sh --gc-stress
Change-Id: I76b623c005758a24ea2616cf9ba444c4d580029a
-rwxr-xr-x | tests/test_art_simulator.sh | 84 | ||||
-rw-r--r-- | utils/utils_run.sh | 24 | ||||
-rw-r--r-- | utils/utils_test.sh | 8 |
3 files changed, 98 insertions, 18 deletions
diff --git a/tests/test_art_simulator.sh b/tests/test_art_simulator.sh index 094a4ad3..320c4a94 100755 --- a/tests/test_art_simulator.sh +++ b/tests/test_art_simulator.sh @@ -22,6 +22,7 @@ source "${local_path}/../utils/utils.sh" source "${local_path}/../utils/utils_test.sh" source "${local_path}/../utils/utils_android.sh" source "${local_path}/../utils/utils_android_root.sh" +source "${local_path}/../utils/utils_run.sh" readonly timer_name="Simulator Test" readonly lunch_target="armv8" @@ -50,6 +51,25 @@ usage() { log I " -h|--help Show this help." log I " -t|--build-target Build arm64 target images, e.g. core.art" log I " -s|--sve Enable SVE2 Arm extension" + log I "-------------------------------------------" + log I "Test Options:" + log I " --jobs - a number of jobs on a target. Defaults to CPU count." + log I " --keep-failures - keep failing tests around (useful for debugging)." + log I " --keep-going - don't stop at the first failing test." + log I " --gcstress - use gc stress testing for run-tests." + log I " --isa-features - specify isa features to be used. + Possible values: default, runtime, a list of comma-separated + feature names. When the list is used, '-' before a feature name + means the ART compiler must not use the feature for code + generation." + log I " --dump-cfg <path> - dump .cfg to the specified host full path. Only runs for a" + log I " single test" + log I " --gdb-dex2oat - Run dex2oat under lldb. Only runs for a single test." + log I " --gdb-dex2oat-args - Use LLDB with arguments to debug the compiler (dex2oat) + Each argument needs to be separated by a semicolon." + log I "-------------------------------------------" + log I "Tests:" + log I " --single-test <test> - run specified test only" exit 0 } @@ -61,10 +81,38 @@ declare -A options_format=( ["t"]="r:&build-target" ["sve"]="false" ["s"]="r:&sve" + ["dump-cfg"]="" + ["gdb-dex2oat"]="false" + ["gdb-dex2oat-args"]="" + ["gcstress"]="false" + ["isa-features"]="" + ["jobs"]="" + ["keep-failures"]="false" + ["keep-going"]="false" + ["single-test"]="" ) + declare -A options=() + +validate_options() { + if [[ -n "${options["jobs"]}" ]] && [[ ! ${options["jobs"]} =~ ^[0-9]+$ ]]; then + log E "The --jobs option must be followed by an integer." + exit 1 + fi + + if [[ -n "${options["dump-cfg"]}" ]] && [[ -z "${options["single-test"]}" ]]; then + log E "Can only dump .cfg for a single test." + exit 1 + fi + + if [[ "${options["gdb-dex2oat"]}" == "true" ]] && [[ -z "${options["single-test"]}" ]]; then + log E "Can only run the debugger on dex2oat for a single test." + exit 1 + fi +} + prepare_workspace() { local -ar patch_change_ids=( "${sim_patch_change_id}" @@ -89,6 +137,10 @@ prepare_workspace() { fi done + if ${options["keep-failures"]}; then + set_environment_keep_test_failures + fi + # According to art/test/README.chroot.md, the test script needs to set this # env variable when building ART minimal tree. export SOONG_ALLOW_MISSING_DEPENDENCIES=true @@ -110,25 +162,39 @@ prepare_workspace() { } test_simulator() { - start_section "simulator" - disable_error_on_unset_expansion - set_environment_keep_test_failures - local -r test_command="art/test.py -v -j${JCPU_COUNT} --simulate-arm64 --optimizing --run-test" - log I "Running ${test_command}" - ${test_command} - local -r return_code=$? - enable_error_on_unset_expansion - end_section "simulator" "${return_code}" + if [[ -n ${options["single-test"]} ]]; then + test_single "64" "simulator" "${job_count}" "$(declare -p options)" + else + section_starter "simulator" "host" + run_test_unwrapped "run-test" "optimizing" "" "64" "simulator" "${job_count}" \ + "$(declare -p options)" + local -r return_code=$? + section_ender "simulator" "host" "${return_code}" "${options["keep-going"]}" + fi +} + +set_job_count() { + job_count=${JCPU_COUNT} + if [[ -n "${options["jobs"]}" ]]; then + job_count="${options["jobs"]}" + fi } main() { exit_on_failure arguments_parser options_format options -- "$@" + readonly options + + validate_options + dump_options + set_job_count + start_test "${timer_name}" prepare_workspace + test_simulator end_test "${timer_name}" diff --git a/utils/utils_run.sh b/utils/utils_run.sh index b1cd905f..9364354b 100644 --- a/utils/utils_run.sh +++ b/utils/utils_run.sh @@ -30,12 +30,22 @@ readonly art="$(get_art_dir)" # ${2}: test section # ${3}: test name # ${4}: bitness (32/64) -# ${5}: host/target +# ${5}: host/target/simulator # ${6}: job count (CPU Count when on host) # ${7}: options run_test_with_python_runner() { declare -A local_options=${7#*=} - local test_command="art/test.py -v -j${6} --${5} --ndebuggable" + local test_command="art/test.py -v -j${6}" + + local test_environment="$5" + + if [[ "${test_environment}" == "simulator" ]]; then + test_command+=" --simulate-arm64" + test_environment="host" + fi + + test_command+=" --${test_environment} --ndebuggable" + if ${local_options["gcstress"]}; then test_command+=" --gcstress" fi @@ -43,7 +53,7 @@ run_test_with_python_runner() { test_command+=" --dump-cfg ${local_options["dump-cfg"]}" fi if ${local_options["gdb-dex2oat"]}; then - if [[ "$5" != "host" ]]; then + if [[ "${test_environment}" != "host" ]]; then log E "The --gdb-dex2oat option is only available for host." return 1 fi @@ -69,7 +79,7 @@ run_test_with_python_runner() { # ${2}: test section # ${3}: test name # ${4}: bitness (32/64) -# ${5}: host/target +# ${5}: host/target/simulator # ${6}: job count (CPU Count when on host) # ${7}: options run_test_unwrapped() { @@ -110,7 +120,7 @@ find_gtests() { # # Arguments # ${1}: bitness (32/64) -# ${2}: host/target +# ${2}: host/target/simulator # ${3}: job count (CPU Count when on host) # ${4}: options test_single() { @@ -119,6 +129,10 @@ test_single() { local return_code=0 local section_name="TEST_SINGLE_" if is_single_test_gtest "${test_name}"; then + if [ "$2" == "simulator" ]; then + log E "gtest not supported for simulator yet." + return_code=1 + fi section_name+="gtest_$1" section_starter "${section_name}" "${2}" if [ "$2" == "host" ]; then diff --git a/utils/utils_test.sh b/utils/utils_test.sh index 3a41de8f..ddff8bb1 100644 --- a/utils/utils_test.sh +++ b/utils/utils_test.sh @@ -91,9 +91,9 @@ print_summary_and_exit_if_failed_and_not_continue() { # # Arguments: # ${1}: section name -# ${2}: host/target +# ${2}: host/target/simulator section_starter() { - if [[ "$2" == "host" ]]; then + if [[ "$2" == "host" || "$2" == "simulator" ]]; then start_section "$1" elif [[ "$2" == "target" ]]; then start_adb_section "$1" @@ -108,11 +108,11 @@ section_starter() { # # Arguments: # ${1}: section name -# ${2}: host/target +# ${2}: host/target/simulator # ${3}: return code # ${4}: keep-going option section_ender(){ - if [[ "$2" == "host" ]]; then + if [[ "$2" == "host" || "$2" == "simulator" ]]; then end_section "$1" "$3" elif [[ "$2" == "target" ]]; then end_adb_section "$1" "$3" |