OSDN Git Service

merging FRF15 for dalvik-dev
[android-x86/dalvik.git] / run-core-tests.sh
1 #!/bin/sh
2 #
3 # Runs the core library tests on the Linux host.
4 #
5 # To build:
6 #  source build/envsetup.sh
7 #  lunch sim-eng
8 #  make -j14
9 #  mmm dalvik  # this builds the tests themselves
10 #  ./dalvik/run-core-tests.sh
11 #
12 # Note: You may also specify a specific test as an argument to this script.
13
14 datadir=/tmp/${USER}
15 base=$OUT
16 framework=$base/system/framework
17 apps=$base/data/app
18
19 export ANDROID_PRINTF_LOG=tag
20 export ANDROID_LOG_TAGS='*:w' # was: jdwp:i dalvikvm:i dalvikvmi:i'
21 export ANDROID_DATA=$datadir
22 export ANDROID_ROOT=$base/system
23
24 debug_opts=-Xcheck:jni
25
26 OPTS=`getopt -o dl: --long debug,log:,help -n $0 -- "$@"`
27
28 if [ $? != 0 ]; then echo "Terminating..." >&2; exit 1; fi
29
30 eval set -- "$OPTS"
31
32 while true; do
33     case "$1" in
34         -d|--debug) debug_opts="$debug_opts -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y"; shift ;;
35         -l) export ANDROID_LOG_TAGS='*:'$2; shift 2 ;;
36         --log) export ANDROID_LOG_TAGS="$2"; shift 2 ;;
37         --help)
38             echo usage: $0 [-d\|--debug] [-l\|--log] test.class.name;
39             printf "\t%-15s%s\n" "-d|--debug" "wait for the debugger";
40             printf "\t%-15s%s\n" "-l" "set the global logging level";
41             printf "\t%-15s%s\n" "--log" "set the logging TAG";
42             printf "\t%-15s%s\n" "--help" "this message";
43             exit 1;
44         ;;
45         --) shift; break ;;
46         *) echo "Internal Error!" >&2; exit 1 ;;
47     esac
48 done
49
50 export LD_LIBRARY_PATH=$base/system/lib
51 export DYLD_LIBRARY_PATH=$base/system/lib
52
53 exe=$base/system/bin/dalvikvm
54 bpath=$framework/core.jar:$framework/ext.jar:$framework/framework.jar
55
56 # Build the classpath by putting together the jar file for each module.
57 classpath="$framework/sqlite-jdbc.jar" # Bonus item for jdbc testing.
58 modules="annotation archive concurrent crypto dom icu json \
59         logging luni-kernel luni math nio nio_char prefs regex security sql \
60         suncompat support text x-net xml"
61 for module in $modules; do
62     classpath="$classpath:$framework/core-tests-$module.jar"
63 done
64
65 # Notes:
66 # (1) The IO tests create lots of files in the current directory, so we change
67 #     to /tmp first.
68 # (2) Some of the core tests need a hell of a lot of memory, so we use a
69 #     large value for both heap and stack. 
70
71 rm -rf ${datadir}/xml_source
72 mkdir -p ${datadir}/xml_source
73 mkdir -p ${datadir}/dalvik-cache
74 cd $ANDROID_BUILD_TOP/dalvik
75 cp -R libcore/xml/src/test/resources/* ${datadir}/xml_source
76
77 cd $datadir
78 echo $ANDROID_DATA
79 echo $valgrind $exe \
80     -Duser.name=root \
81     -Duser.language=en \
82     -Duser.region=US \
83     -Duser.language=en \
84     -Duser.dir=$datadir \
85     -Duser.home=$datadir \
86     -Djava.io.tmpdir=$datadir \
87     -Djavax.net.ssl.trustStore=$base/system/etc/security/cacerts.bks \
88     -Xbootclasspath:$bpath \
89     -classpath $classpath \
90     $debug_opts \
91     -Xmx512M -Xss32K \
92     com.google.coretests.Main "$@"