diff options
| -rw-r--r-- | src/logging.h | 9 | ||||
| -rw-r--r-- | src/logging_linux.cc | 8 | ||||
| -rw-r--r-- | src/runtime.cc | 10 | ||||
| -rw-r--r-- | src/runtime_support.cc | 4 | ||||
| -rw-r--r-- | test/003-omnibus-opcodes/build | 2 | ||||
| -rw-r--r-- | test/022-interface/build | 2 | ||||
| -rw-r--r-- | test/023-many-interfaces/build | 2 | ||||
| -rw-r--r-- | test/056-const-string-jumbo/build | 2 | ||||
| -rw-r--r-- | test/085-old-style-inner-class/build | 2 | ||||
| -rwxr-xr-x | test/etc/default-build | 5 | ||||
| -rwxr-xr-x | test/etc/host-run-test-jar | 11 | ||||
| -rwxr-xr-x | test/run-all-tests | 6 | ||||
| -rwxr-xr-x | test/run-test | 9 |
13 files changed, 53 insertions, 19 deletions
diff --git a/src/logging.h b/src/logging.h index 7c04777755..c1ea3abda0 100644 --- a/src/logging.h +++ b/src/logging.h @@ -262,6 +262,15 @@ struct LogVerbosity { bool startup; bool third_party_jni; // Enabled with "-verbose:third-party-jni". bool threads; + std::ostream* logging_stream; + + void SetLoggingStream(std::ostream* new_logging_stream) { + DCHECK(new_logging_stream->good()); + if (logging_stream != NULL) { + delete logging_stream; + } + logging_stream = new_logging_stream; + } }; extern LogVerbosity gLogVerbosity; diff --git a/src/logging_linux.cc b/src/logging_linux.cc index e781a00766..4e7c7966bc 100644 --- a/src/logging_linux.cc +++ b/src/logging_linux.cc @@ -34,9 +34,11 @@ LogMessage::LogMessage(const char* file, int line, LogSeverity severity, int err } void LogMessage::LogLine(const char* message) { - std::cerr << "VDIWEFF"[data_->severity] << ' ' - << StringPrintf("%5d %5d", getpid(), ::art::GetTid()) << ' ' - << data_->file << ':' << data_->line_number << "] " << message << std::endl; + std::ostream &out = + (gLogVerbosity.logging_stream == NULL ? std::cerr : *gLogVerbosity.logging_stream); + out << "VDIWEFF"[data_->severity] << ' ' + << StringPrintf("%5d %5d", getpid(), ::art::GetTid()) << ' ' + << data_->file << ':' << data_->line_number << "] " << message << std::endl; } } // namespace art diff --git a/src/runtime.cc b/src/runtime.cc index 12f7c8b9c5..014ce6b475 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -22,6 +22,7 @@ #include <cstdlib> #include <limits> #include <vector> +#include <fstream> #include "class_linker.h" #include "class_loader.h" @@ -421,6 +422,15 @@ Runtime::ParsedOptions* Runtime::ParsedOptions::Create(const Options& options, b gLogVerbosity.third_party_jni = true; } else if (verbose_options[i] == "threads") { gLogVerbosity.threads = true; + } else if (StartsWith(verbose_options[i], "log-to=")) { + std::string log_file_name(verbose_options[i].substr(strlen("log-to="))); + std::ofstream* log_file = new std::ofstream(log_file_name.c_str()); + if (log_file->is_open() && log_file->good()) { + gLogVerbosity.SetLoggingStream(log_file); + } else { + LOG(ERROR) << "Fail to open log file: \"" << log_file_name << "\"," + << " use default logging stream."; + } } else { LOG(WARNING) << "Ignoring unknown -verbose option: " << verbose_options[i]; } diff --git a/src/runtime_support.cc b/src/runtime_support.cc index 0a1cf8f50b..d6efe1d7ea 100644 --- a/src/runtime_support.cc +++ b/src/runtime_support.cc @@ -221,8 +221,8 @@ std::string MethodNameFromIndex(const Method* method, uint32_t ref, return result; } -static inline std::string ClassNameFromIndex(const Method* method, uint32_t ref, - verifier::VerifyErrorRefType ref_type, bool access) { +static std::string ClassNameFromIndex(const Method* method, uint32_t ref, + verifier::VerifyErrorRefType ref_type, bool access) { ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); const DexFile& dex_file = class_linker->FindDexFile(method->GetDeclaringClass()->GetDexCache()); diff --git a/test/003-omnibus-opcodes/build b/test/003-omnibus-opcodes/build index 0671a32345..bb9c4f899a 100644 --- a/test/003-omnibus-opcodes/build +++ b/test/003-omnibus-opcodes/build @@ -24,4 +24,4 @@ ${JAVAC} -d classes `find src2 -name '*.java'` dx -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex classes zip $TEST_NAME.jar classes.dex -dex2oatd --boot-image=${ANDROID_PRODUCT_OUT}/data/art-test/core.art --dex-file=$TEST_NAME.jar --dex-location=/data/run-test/$TEST_NAME.jar --oat-file=$TEST_NAME.jar.oat +dex2oatd --boot-image=$IMAGE --dex-file=$TEST_NAME.jar --dex-location=$DEX_LOCATION/$TEST_NAME.jar --oat-file=$TEST_NAME.jar.oat $DEX2OAT_ARGS diff --git a/test/022-interface/build b/test/022-interface/build index 24b32bb95f..1841f0622d 100644 --- a/test/022-interface/build +++ b/test/022-interface/build @@ -21,4 +21,4 @@ set -e # issue when interfaces override methods in Object dx --debug --dex --dump-to=classes.lst --output=classes.dex classes zip $TEST_NAME.jar classes.dex -dex2oatd --boot-image=${ANDROID_PRODUCT_OUT}/data/art-test/core.art --dex-file=$TEST_NAME.jar --dex-location=/data/run-test/$TEST_NAME.jar --oat-file=$TEST_NAME.jar.oat +dex2oatd --boot-image=$IMAGE --dex-file=$TEST_NAME.jar --dex-location=$DEX_LOCATION/$TEST_NAME.jar --oat-file=$TEST_NAME.jar.oat $DEX2OAT_ARGS diff --git a/test/023-many-interfaces/build b/test/023-many-interfaces/build index b28ab880fd..5d981f4b5f 100644 --- a/test/023-many-interfaces/build +++ b/test/023-many-interfaces/build @@ -26,4 +26,4 @@ ${JAVAC} -d classes src/*.java dx --debug --dex --dump-to=classes.lst --output=classes.dex classes zip $TEST_NAME.jar classes.dex -dex2oatd --boot-image=${ANDROID_PRODUCT_OUT}/data/art-test/core.art --dex-file=$TEST_NAME.jar --dex-location=/data/run-test/$TEST_NAME.jar --oat-file=$TEST_NAME.jar.oat +dex2oatd --boot-image=$IMAGE --dex-file=$TEST_NAME.jar --dex-location=$DEX_LOCATION/$TEST_NAME.jar --oat-file=$TEST_NAME.jar.oat $DEX2OAT_ARGS diff --git a/test/056-const-string-jumbo/build b/test/056-const-string-jumbo/build index d0528312c8..b3d9aad243 100644 --- a/test/056-const-string-jumbo/build +++ b/test/056-const-string-jumbo/build @@ -44,4 +44,4 @@ ${JAVAC} -d classes src/*.java dx -JXmx500m --debug --dex --no-optimize --positions=none --no-locals --dump-to=classes.lst --output=classes.dex classes zip $TEST_NAME.jar classes.dex -dex2oatd --boot-image=${ANDROID_PRODUCT_OUT}/data/art-test/core.art --dex-file=$TEST_NAME.jar --dex-location=/data/run-test/$TEST_NAME.jar --oat-file=$TEST_NAME.jar.oat +dex2oatd --boot-image=$IMAGE --dex-file=$TEST_NAME.jar --dex-location=$DEX_LOCATION/$TEST_NAME.jar --oat-file=$TEST_NAME.jar.oat $DEX2OAT_ARGS diff --git a/test/085-old-style-inner-class/build b/test/085-old-style-inner-class/build index daf615db25..b771e6cea2 100644 --- a/test/085-old-style-inner-class/build +++ b/test/085-old-style-inner-class/build @@ -26,4 +26,4 @@ ${JAVAC} -source 1.4 -target 1.4 -d classes `find src -name '*.java'` dx --debug --dex --dump-to=classes.lst --output=classes.dex --dump-width=1000 classes 2>/dev/null zip $TEST_NAME.jar classes.dex -dex2oatd --boot-image=${ANDROID_PRODUCT_OUT}/data/art-test/core.art --dex-file=$TEST_NAME.jar --dex-location=/data/run-test/$TEST_NAME.jar --oat-file=$TEST_NAME.jar.oat +dex2oatd --boot-image=$IMAGE --dex-file=$TEST_NAME.jar --dex-location=$DEX_LOCATION/$TEST_NAME.jar --oat-file=$TEST_NAME.jar.oat $DEX2OAT_ARGS diff --git a/test/etc/default-build b/test/etc/default-build index 3e5ccd3ca8..01bac6b3ff 100755 --- a/test/etc/default-build +++ b/test/etc/default-build @@ -26,7 +26,8 @@ fi dx -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex --dump-width=1000 classes zip $TEST_NAME.jar classes.dex -dex2oatd --boot-image=${ANDROID_PRODUCT_OUT}/data/art-test/core.art --dex-file=$TEST_NAME.jar --dex-location=/data/run-test/$TEST_NAME.jar --oat-file=$TEST_NAME.jar.oat + +dex2oatd --boot-image=$IMAGE --dex-file=$TEST_NAME.jar --dex-location=$DEX_LOCATION/$TEST_NAME.jar --oat-file=$TEST_NAME.jar.oat $DEX2OAT_ARGS if [ -r src-ex ]; then mkdir classes-ex @@ -37,7 +38,7 @@ if [ -r src-ex ]; then mv classes.dex classes-1.dex mv classes-ex.dex classes.dex zip $TEST_NAME-ex.jar classes.dex - dex2oatd --boot-image=${ANDROID_PRODUCT_OUT}/data/art-test/core.art --dex-file=$TEST_NAME-ex.jar --dex-location=/data/run-test/$TEST_NAME-ex.jar --oat-file=$TEST_NAME-ex.jar.oat + dex2oatd --boot-image=$IMAGE --dex-file=$TEST_NAME-ex.jar --dex-location=$DEX_LOCATION/$TEST_NAME-ex.jar --oat-file=$TEST_NAME-ex.jar.oat $DEX2OAT_ARGS mv classes.dex classes-ex.dex mv classes-1.dex classes.dex fi diff --git a/test/etc/host-run-test-jar b/test/etc/host-run-test-jar index f424487125..b56549e483 100755 --- a/test/etc/host-run-test-jar +++ b/test/etc/host-run-test-jar @@ -61,7 +61,7 @@ msg "------------------------------" HOSTBASE="${ANDROID_BUILD_TOP}/out/host" DATA_DIR=/tmp -DEBUG_OPTS="-Xcheck:jni -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n" +DEBUG_OPTS="-Xcheck:jni" if [ ! -d $DATA_DIR/art-cache ]; then mkdir -p $DATA_DIR/art-cache @@ -84,7 +84,10 @@ exe="${ANDROID_ROOT}/bin/oatexecd" if [ "$DEBUG" = "y" ]; then PORT=8000 msg "Waiting for debugger to connect on localhost:$PORT" - DEX_DEBUG="-agentlib:jdwp=transport=dt_socket,addres=$PORT,server=y,suspend=y" + # This is for jdb: + DEX_DEBUG="-agentlib:jdwp=transport=dt_socket,address=$PORT,server=y,suspend=y" + # Connect thus: + # jdb -attach localhost:12345 fi if [ "$GDB" = "y" ]; then @@ -94,5 +97,5 @@ fi cd $ANDROID_BUILD_TOP $INVOKE_WITH $gdb $exe $gdbargs -Ximage:$ANDROID_ROOT/framework/core.art \ - $DEX_DEBUG ${DEBUG_OPTS} \ - -cp test.jar Main "$@" + $DEBUG_OPTS $DEX_DEBUG -verbose:log-to=$DEX_LOCATION/log.txt\ + -cp $DEX_LOCATION/$TEST_NAME.jar Main "$@" diff --git a/test/run-all-tests b/test/run-all-tests index 18ffa17f5a..3176f02d54 100755 --- a/test/run-all-tests +++ b/test/run-all-tests @@ -103,15 +103,19 @@ done # wait for all the tests, collecting the failures failure_count=0 +succeeded_count=0 failed_test_names="" for pid in ${test_pids[@]}; do wait $pid if [ "$?" != "0" ]; then let failure_count+=1 - failed_test_names="$failed_test_names $test_names[$pid]" + failed_test_names="$failed_test_names ${test_names[$pid]}[pid=$pid]" + else + let succeeded_count+=1 fi done +echo "succeeded tests: $succeeded_count" echo "failed tests: $failure_count" for i in $failed_test_names; do diff --git a/test/run-test b/test/run-test index 0c31c3179f..c3170b6f5b 100755 --- a/test/run-test +++ b/test/run-test @@ -32,10 +32,14 @@ progdir=`dirname "${prog}"` cd "${progdir}" progdir=`pwd` prog="${progdir}"/`basename "${prog}"` +tmp_dir="/tmp/test-$$" export JAVA="java" export JAVAC="javac -g -target 1.5" export RUN="${progdir}/etc/push-and-run-test-jar" +export IMAGE=${ANDROID_PRODUCT_OUT}/data/art-test/core.art +export DEX_LOCATION=/data/run-test +export DEX2OAT_ARGS="" info="info.txt" build="build" @@ -53,6 +57,9 @@ usage="no" while true; do if [ "x$1" = "x--host" ]; then RUN="${progdir}/etc/host-run-test-jar" + IMAGE=${ANDROID_BUILD_TOP}/out/host/linux-x86/framework/core.art + DEX_LOCATION=$tmp_dir + DEX2OAT_ARGS="--instruction-set=X86 --host-prefix=$ANDROID_BUILD_TOP/" shift elif [ "x$1" = "x--jvm" ]; then RUN="${progdir}/etc/reference-run-test-classes" @@ -164,8 +171,6 @@ test_dir=`pwd` td_info="${test_dir}/${info}" td_expected="${test_dir}/${expected}" -tmp_dir="/tmp/test-$$" - if [ '!' '(' -r "$td_info" -a -r "$td_expected" ')' ]; then echo "${test_dir}: missing files" 1>&2 exit 1 |