diff options
| author | 2012-07-16 07:01:18 -0700 | |
|---|---|---|
| committer | 2012-07-16 07:01:18 -0700 | |
| commit | bfc6d462ace1281872b65afd0fd477b796ba3f19 (patch) | |
| tree | 15d1c952de1249020b04b5424eb6940840391f55 | |
| parent | 57393a0e7c55c3e348ed942f5799d8656af6366c (diff) | |
| parent | 011fade82899fe3607789ca061e3a6c7fa4c71f4 (diff) | |
Merge "Build run-test files." into dalvik-dev
| -rw-r--r-- | test/Android.mk | 45 | ||||
| -rwxr-xr-x | test/run-test | 34 |
2 files changed, 75 insertions, 4 deletions
diff --git a/test/Android.mk b/test/Android.mk new file mode 100644 index 0000000000..83d439976e --- /dev/null +++ b/test/Android.mk @@ -0,0 +1,45 @@ +# Copyright (C) 2012 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LOCAL_PATH := $(call my-dir) + +TEST_ART_RUN_TEST_MAKE_TARGETS := + +# Helper to create individual build targets for tests. +# Must be called with $(eval) +# $(1): the test number +define declare-make-art-run-test +dmart_target := $(TARGET_OUT_DATA)/art-run-tests/$(1)/touch +$$(dmart_target): + $(hide) rm -rf $$(dir $$@) && mkdir -p $$(dir $$@) + $(hide) $(LOCAL_PATH)/run-test --build-only --output-path $$(abspath $$(dir $$@)) $(1) + $(hide) touch $$@ + +TEST_ART_RUN_TEST_MAKE_TARGETS += $$(dmart_target) +dmart_target := +endef + +# Expand all tests. +$(foreach test, $(wildcard art/test/[0-9]*), $(eval $(call declare-make-art-run-test,$(notdir $(test))))) + +include $(CLEAR_VARS) +LOCAL_MODULE_TAGS := tests +LOCAL_MODULE := art-run-tests +LOCAL_ADDITIONAL_DEPENDENCIES := $(TEST_ART_RUN_TEST_MAKE_TARGETS) +include $(BUILD_PHONY_PACKAGE) + +# clear temp vars +TEST_ART_RUN_TEST_MAKE_TARGETS := +declare-make-art-run-test := diff --git a/test/run-test b/test/run-test index 7a974794eb..f7a5827fca 100755 --- a/test/run-test +++ b/test/run-test @@ -55,6 +55,7 @@ dev_mode="no" update_mode="no" debug_mode="no" usage="no" +build_only="no" while true; do if [ "x$1" = "x--host" ]; then @@ -99,6 +100,13 @@ while true; do run_args="${run_args} --dev" dev_mode="yes" shift + elif [ "x$1" = "x--build-only" ]; then + build_only="yes" + shift + elif [ "x$1" = "x--output-path" ]; then + shift + tmp_dir=$1 + shift elif [ "x$1" = "x--update" ]; then update_mode="yes" shift @@ -134,7 +142,6 @@ if [ "$usage" = "no" ]; then fi test_dir="$td2" fi - # Shift to get rid of the test name argument. The rest of the arguments # will get passed to the test run. shift @@ -156,6 +163,7 @@ if [ "$usage" = "yes" ]; then echo " -O Run oatexec rather than oatexecd (off by default)." echo " --debug Wait for a debugger to attach." #echo " --gdb Run under gdb; incompatible with some tests." + echo " --build-only Build test files only (off by default)." echo " --no-verify Turn off verification (on by default)." echo " --no-optimize Turn off optimization (on by default)." echo " --no-precise Turn off precise GC (on by default)." @@ -165,6 +173,8 @@ if [ "$usage" = "yes" ]; then echo " --host Use the host-mode virtual machine." echo " --valgrind Use valgrind when running locally." echo " --jvm Use a host-local RI virtual machine." + echo " --output-path [path] Location where to store the build" \ + "files." ) 1>&2 exit 1 fi @@ -224,6 +234,20 @@ elif [ "$update_mode" = "yes" ]; then cat "$build_output" 1>&2 echo "build exit status: $build_exit" 1>&2 fi +elif [ "$build_only" = "yes" ]; then + good="yes" + "./${build}" >"$build_output" 2>&1 + build_exit="$?" + if [ "$build_exit" '!=' '0' ]; then + cp "$build_output" "$output" + echo "build exit status: $build_exit" >>"$output" + diff --strip-trailing-cr -q "$expected" "$output" >/dev/null + if [ "$?" '!=' "0" ]; then + good="no" + echo "BUILD FAILED For ${TEST_NAME}" + fi + fi + exit 0 else "./${build}" >"$build_output" 2>&1 build_exit="$?" @@ -241,7 +265,8 @@ else fi fi -if [ "$good" = "yes" ]; then +# Clean up test files. +if [ "$good" == "yes" ]; then cd "$oldwd" rm -rf "$tmp_dir" if [ "$target_mode" = "yes" -a "$build_exit" = "0" ]; then @@ -250,8 +275,9 @@ if [ "$good" = "yes" ]; then exit 0 fi + ( - if [ "$update_mode" '!=' "yes" ]; then + if [ "$update_mode" != "yes" ]; then echo "${test_dir}: FAILED!" echo ' ' echo '#################### info' @@ -262,7 +288,7 @@ fi echo ' ' fi echo "${TEST_NAME} files left in ${tmp_dir} on host" - if [ "$target_mode" = "yes" ]; then + if [ "$target_mode" == "yes" ]; then echo "and in ${DEX_LOCATION} on target" fi |