1 #!/bin/bash 2 # 3 # Copyright (C) 2008 The Android Open Source Project 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # Set up prog to be the path of this script, including following symlinks, 18 # and set up progdir to be the fully-qualified pathname of its directory. 19 prog="$0" 20 while [ -h "${prog}" ]; do 21 newProg=`/bin/ls -ld "${prog}"` 22 newProg=`expr "${newProg}" : ".* -> \(.*\)$"` 23 if expr "x${newProg}" : 'x/' >/dev/null; then 24 prog="${newProg}" 25 else 26 progdir=`dirname "${prog}"` 27 prog="${progdir}/${newProg}" 28 fi 29 done 30 oldwd=`pwd` 31 progdir=`dirname "${prog}"` 32 cd "${progdir}" 33 progdir=`pwd` 34 prog="${progdir}"/`basename "${prog}"` 35 cd "${oldwd}" 36 37 libdir=`dirname $progdir`/framework 38 39 # Parse the test type, by default it will run against all tests 40 # FIXME: 41 # This should be removed after vm-tests and core-tests have been integrated 42 # in CTS. 43 testType="all" 44 if [ ! -z $1 ]; then 45 if [ $1 == "all" -o $1 == "dalvik" -o $1 == "android" ]; then 46 testType=$1 47 shift 48 fi 49 fi 50 51 javaOpts="" 52 while expr "x$1" : 'x-J' >/dev/null; do 53 opt=`expr "$1" : '-J\(.*\)'` 54 javaOpts="${javaOpts} -${opt}" 55 shift 56 done 57 58 #exec java $javaOpts -jar $libdir/hat.jar "$@" 59 60 ####################################################################### 61 # Original content of invocation script follows. Uses values cleverly 62 # deduced by the above code. If you want to use this for a different 63 # set of packages, adjust both the list of source directories and the 64 # list of packages. 65 ####################################################################### 66 export CLASSES=$progdir/../framework/test-progress-new.jar 67 export INPUT=$ANDROID_BUILD_TOP 68 export OUTPUT=$ANDROID_BUILD_TOP/out/target/common/cts/test-progress-new 69 70 TESTCOVERAGE_FLAGS="countdisabled,acceptcandx" 71 72 if [[ ("$1" == "-f") && ("$2" != "") ]]; then 73 TESTCOVERAGE_FLAGS=$2 74 echo "running with flag '$TESTCOVERAGE_FLAGS'" 75 else 76 if [ "$1" != "" ]; then 77 export OUTPUT=$1 78 fi 79 fi 80 81 DALVIK_SOURCE_PATH="\ 82 $INPUT/dalvik/libcore/annotation/src/main/java:\ 83 $INPUT/dalvik/libcore/archive/src/main/java:\ 84 $INPUT/dalvik/libcore/auth/src/main/java:\ 85 $INPUT/dalvik/libcore/awt-kernel/src/main/java:\ 86 $INPUT/dalvik/libcore/concurrent/src/main/java:\ 87 $INPUT/dalvik/libcore/crypto/src/main/java:\ 88 $INPUT/dalvik/libcore/dalvik/src/main/java:\ 89 $INPUT/dalvik/libcore/icu/src/main/java:\ 90 $INPUT/dalvik/libcore/json/src/main/java:\ 91 $INPUT/dalvik/libcore/junit/src/main/java:\ 92 $INPUT/dalvik/libcore/logging/src/main/java:\ 93 $INPUT/dalvik/libcore/luni-kernel/src/main/java:\ 94 $INPUT/dalvik/libcore/luni/src/main/java:\ 95 $INPUT/dalvik/libcore/math/src/main/java:\ 96 $INPUT/dalvik/libcore/nio_char/src/main/java:\ 97 $INPUT/dalvik/libcore/nio/src/main/java:\ 98 $INPUT/dalvik/libcore/openssl/src/main/java:\ 99 $INPUT/dalvik/libcore/prefs/src/main/java:\ 100 $INPUT/dalvik/libcore/regex/src/main/java:\ 101 $INPUT/dalvik/libcore/security-kernel/src/main/java:\ 102 $INPUT/dalvik/libcore/security/src/main/java:\ 103 $INPUT/dalvik/libcore/sql/src/main/java:\ 104 $INPUT/dalvik/libcore/suncompat/src/main/java:\ 105 $INPUT/dalvik/libcore/text/src/main/java:\ 106 $INPUT/dalvik/libcore/xml/src/main/java:\ 107 $INPUT/dalvik/libcore/x-net/src/main/java:\ 108 $INPUT/tests/HttpClient:\ 109 $INPUT/dalvik/libcore/annotation/src/test/java:\ 110 $INPUT/dalvik/libcore/archive/src/test/java:\ 111 $INPUT/dalvik/libcore/crypto/src/test/java:\ 112 $INPUT/dalvik/libcore/crypto/src/test/java/support/common/java:\ 113 $INPUT/dalvik/libcore/dalvik/src/test/java:\ 114 $INPUT/dalvik/libcore/logging/src/test/java:\ 115 $INPUT/dalvik/libcore/luni-kernel/src/test/java:\ 116 $INPUT/dalvik/libcore/luni/src/test/java:\ 117 $INPUT/dalvik/libcore/math/src/test/java:\ 118 $INPUT/dalvik/libcore/nio_char/src/test/java:\ 119 $INPUT/dalvik/libcore/nio/src/test/java:\ 120 $INPUT/dalvik/libcore/prefs/src/test/java:\ 121 $INPUT/dalvik/libcore/regex/src/test/java:\ 122 $INPUT/dalvik/libcore/security/src/test/java:\ 123 $INPUT/dalvik/libcore/sql/src/test/java:\ 124 $INPUT/dalvik/libcore/support/src/test/java:\ 125 $INPUT/dalvik/libcore/text/src/test/java:\ 126 $INPUT/dalvik/libcore/xml/src/test/java:\ 127 $INPUT/dalvik/libcore/x-net/src/test/java" 128 129 DALVIK_PACKAGE="\ 130 junit.framework \ 131 org.apache.harmony.annotation.tests.java.lang.annotation \ 132 org.apache.harmony.archive.tests.java.util.jar \ 133 org.apache.harmony.archive.tests.java.util.zip \ 134 org.apache.harmony.crypto.tests.javax.crypto \ 135 org.apache.harmony.crypto.tests.javax.crypto.spec \ 136 org.apache.harmony.crypto.tests.javax.crypto.interfaces \ 137 org.apache.harmony.logging.tests.java.util.logging \ 138 org.apache.harmony.luni.tests.internal.net.www.protocol.http \ 139 org.apache.harmony.luni.tests.internal.net.www.protocol.https \ 140 org.apache.harmony.luni.tests.java.io \ 141 org.apache.harmony.luni.tests.java.lang \ 142 org.apache.harmony.luni.tests.java.net \ 143 org.apache.harmony.luni.tests.java.util \ 144 org.apache.harmony.luni.tests.util \ 145 org.apache.harmony.math.tests.java.math \ 146 org.apache.harmony.nio_char.tests.java.nio.charset \ 147 org.apache.harmony.nio_char.tests.java.nio.charset.spi \ 148 org.apache.harmony.nio.tests.java.nio \ 149 org.apache.harmony.nio.tests.java.nio.channels \ 150 org.apache.harmony.nio.tests.java.nio.channels.spi \ 151 org.apache.harmony.prefs.tests.java.util.prefs \ 152 org.apache.harmony.regex.tests.java.util.regex \ 153 org.apache.harmony.security.tests.java.security \ 154 org.apache.harmony.sql.tests.java.sql \ 155 org.apache.harmony.sql.tests.javax.sql \ 156 tests.SQLite \ 157 org.apache.harmony.testframework.serialization \ 158 org.apache.harmony.text.tests.java.text \ 159 targets \ 160 tests.api.java.io \ 161 tests.api.java.lang \ 162 tests.api.java.lang.ref \ 163 tests.api.java.lang.reflect \ 164 tests.api.java.math \ 165 tests.api.java.net \ 166 tests.api.java.nio.charset \ 167 tests.api.java.security \ 168 tests.api.java.util \ 169 tests.api.javax.net \ 170 tests.api.javax.net.ssl \ 171 tests.api.javax.security.auth \ 172 tests.api.javax.security.cert \ 173 tests.api.javax.xml.parsers \ 174 tests.api.org.xml.sax \ 175 tests.api.org.xml.sax.ext \ 176 tests.api.org.xml.sax.helpers \ 177 tests.api.org.apache.harmony.kernel.dalvik \ 178 tests.java.security \ 179 tests.java.sql \ 180 tests.javax.sql \ 181 tests.org.w3c.dom \ 182 tests.security \ 183 tests.security.acl \ 184 tests.security.cert \ 185 tests.security.interfaces \ 186 tests.security.permissions \ 187 tests.security.spec \ 188 tests.sql \ 189 tests.support \ 190 tests.targets.security \ 191 tests.targets.security.cert \ 192 tests.xml \ 193 java.io \ 194 java.lang \ 195 java.lang.annotation \ 196 java.lang.ref \ 197 java.lang.reflect \ 198 java.math \ 199 java.net \ 200 java.nio \ 201 java.nio.channels \ 202 java.nio.channels.spi \ 203 java.nio.charset \ 204 java.nio.charset.spi \ 205 java.security \ 206 java.security.acl \ 207 java.security.cert \ 208 java.security.interfaces \ 209 java.security.spec \ 210 java.sql \ 211 java.text \ 212 java.util \ 213 java.util.jar \ 214 java.util.logging \ 215 java.util.prefs \ 216 java.util.regex \ 217 java.util.zip \ 218 javax.crypto \ 219 javax.crypto.interfaces \ 220 javax.crypto.spec \ 221 javax.net \ 222 javax.net.ssl \ 223 javax.security.auth \ 224 javax.security.auth.callback \ 225 javax.security.auth.login \ 226 javax.security.auth.x500 \ 227 javax.security.cert \ 228 javax.sql \ 229 javax.xml.parsers \ 230 org.xml.sax \ 231 org.xml.sax.ext \ 232 org.xml.sax.helpers" 233 234 ANDROID_SOURCE_PATH="\ 235 ${INPUT}/frameworks/base/core/java:\ 236 ${INPUT}/frameworks/base/graphics/java:\ 237 ${INPUT}/frameworks/base/location/java:\ 238 ${INPUT}/frameworks/base/media/java:\ 239 ${INPUT}/frameworks/base/opengl/java:\ 240 ${INPUT}/frameworks/base/sax/java:\ 241 ${INPUT}/frameworks/base/telephony/java:\ 242 ${INPUT}/frameworks/base/wifi/java:\ 243 ${INPUT}/cts/tests/tests/app/src:\ 244 ${INPUT}/cts/tests/tests/content/src:\ 245 ${INPUT}/cts/tests/tests/database/src:\ 246 ${INPUT}/cts/tests/tests/graphics/src:\ 247 ${INPUT}/cts/tests/tests/hardware/src:\ 248 ${INPUT}/cts/tests/tests/location/src:\ 249 ${INPUT}/cts/tests/tests/media/src:\ 250 ${INPUT}/cts/tests/tests/net/src:\ 251 ${INPUT}/cts/tests/tests/opengl/src:\ 252 ${INPUT}/cts/tests/tests/os/src:\ 253 ${INPUT}/cts/tests/tests/preference/src:\ 254 ${INPUT}/cts/tests/tests/provider/src:\ 255 ${INPUT}/cts/tests/tests/sax/src:\ 256 ${INPUT}/cts/tests/tests/security/src:\ 257 ${INPUT}/cts/tests/tests/speech/src:\ 258 ${INPUT}/cts/tests/tests/telephony/src:\ 259 ${INPUT}/cts/tests/tests/text/src:\ 260 ${INPUT}/cts/tests/tests/util/src:\ 261 ${INPUT}/cts/tests/tests/view/src:\ 262 ${INPUT}/cts/tests/tests/webkit/src:\ 263 ${INPUT}/cts/tests/tests/widget/src:\ 264 ${INPUT}/cts/tests/src:\ 265 ${INPUT}/frameworks/base/test-runner:\ 266 ${INPUT}/dalvik/libcore/dalvik/src/main/java:\ 267 ${INPUT}/dalvik/libcore/xml/src/main/java:\ 268 ${INPUT}/dalvik/libcore/junit/src/main/java:" 269 270 ANDROID_PACKAGE="\ 271 android.accessibilityservice \ 272 android.accessibilityservice.cts \ 273 android.accounts \ 274 android.accounts.cts \ 275 android.app \ 276 android.app.cts \ 277 android.bluetooth \ 278 android.content \ 279 android.content.cts \ 280 android.content.pm \ 281 android.content.pm.cts \ 282 android.content.res \ 283 android.content.res.cts \ 284 android.database \ 285 android.database.cts \ 286 android.database.sqlite \ 287 android.database.sqlite.cts \ 288 android.gesture \ 289 android.gesture.cts \ 290 android.graphics \ 291 android.graphics.cts \ 292 android.graphics.drawable \ 293 android.graphics.drawable.cts \ 294 android.graphics.drawable.shapes \ 295 android.graphics.drawable.shapes.cts \ 296 android.hardware \ 297 android.hardware.cts \ 298 android.location \ 299 android.location.cts \ 300 android.media \ 301 android.media.cts \ 302 android.net \ 303 android.net.cts \ 304 android.net.http \ 305 android.net.http.cts \ 306 android.net.wifi \ 307 android.net.wifi.cts \ 308 android.opengl \ 309 android.opengl.cts \ 310 android.os \ 311 android.os.cts \ 312 android.preference \ 313 android.preference.cts \ 314 android.provider \ 315 android.provider.cts \ 316 android.sax \ 317 android.sax.cts \ 318 android.security \ 319 android.security.cts \ 320 android.speech.srec \ 321 android.speech.srec.cts \ 322 android.speech.tts \ 323 android.speech.tts.cts \ 324 android.telephony \ 325 android.telephony.cdma \ 326 android.telephony.cts \ 327 android.telephony.gsm \ 328 android.telephony.gsm.cts \ 329 android.text \ 330 android.text.cts \ 331 android.text.format \ 332 android.text.format.cts \ 333 android.text.method \ 334 android.text.method.cts \ 335 android.text.style \ 336 android.text.style.cts \ 337 android.text.util \ 338 android.text.util.cts \ 339 android.util \ 340 android.util.cts \ 341 android.view \ 342 android.view.cts \ 343 android.view.accessibility \ 344 android.view.accessibility.cts \ 345 android.view.animation \ 346 android.view.animation.cts \ 347 android.view.inputmethod \ 348 android.view.inputmethod.cts \ 349 android.webkit \ 350 android.webkit.cts \ 351 android.widget \ 352 android.widget.cts" 353 354 ALL_SOURCE_PATH="${DALVIK_SOURCE_PATH}:${ANDROID_SOURCE_PATH}" 355 ALL_PACKAGE="${DALVIK_PACKAGE} ${ANDROID_PACKAGE}" 356 357 SOURCE_PATH="" 358 if [ ${testType} == "all" ]; then 359 SOURCE_PATH="${ALL_SOURCE_PATH} ${ALL_PACKAGE}" 360 elif [ ${testType} == "dalvik" ]; then 361 SOURCE_PATH="${DALVIK_SOURCE_PATH} ${DALVIK_PACKAGE}" 362 elif [ ${testType} == "android" ]; then 363 SOURCE_PATH="${ANDROID_SOURCE_PATH} ${ANDROID_PACKAGE}" 364 fi 365 366 javadoc -J-Xmx1024M -docletpath $CLASSES -doclet testprogress2.TestCoverageDoclet -f $TESTCOVERAGE_FLAGS -d $OUTPUT -sourcepath $SOURCE_PATH 367 368 # left out on purpose: 369 # org.w3c.dom packages: the tests in the xml module are superseded by the 370 # official w3c test suite located in the dom module. 371 # 372 373 # left out on purpose: 374 # concurrent packages: a full test suite exists (JCP JSR166 test suite) and it located at 375 # device/dalvik/libcore/concurrent/src/test/java/tests/api/java/util/concurrent 376 # 377 #java.util.concurrent \ 378 #java.util.concurrent.atomic \ 379 #java.util.concurrent.locks \ 380 # 381 382 # left out on purpose: (100% coverage/jsr) 383 # tests/api/java/util/concurrent 384 # tests.api.java.util.concurrent 385 386 387 # all test source path found by: 388 # find . -type d | sed -e '/.svn/d' | grep "src/test/java" | sed -e 's/test\/java.*/test\/java/g' | sort -u 389 390 # the list of packages (test only) was taken from: 391 # egrep -R "[ \.]TestCase" dalvik/* | sed -e '/.svn/d' | cut -d':' -f 1 | cut -d'.' -f1 | sed -e's/.*src\/test\/java\///g;s/\/[^\/]*$//g' | sort -u 392 393 394