| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 # | 5 # |
| 6 #@ PNaCl Test Helper | 6 #@ PNaCl Test Helper |
| 7 #@------------------------------------------------------------------- | 7 #@------------------------------------------------------------------- |
| 8 #@ | 8 #@ |
| 9 #@ SCons Test Usage: | 9 #@ SCons Test Usage: |
| 10 #@ | 10 #@ |
| 11 #@ utman-test.sh test-<arch>-<mode> [extra_arguments_to_scons] | 11 #@ test.sh test-<arch>-<mode> [extra_arguments_to_scons] |
| 12 #@ | 12 #@ |
| 13 #@ Runs the SCons tests with selected arch and mode. | 13 #@ Runs the SCons tests with selected arch and mode. |
| 14 #@ Valid arches: | 14 #@ Valid arches: |
| 15 #@ x86-32 | 15 #@ x86-32 |
| 16 #@ x86-64 | 16 #@ x86-64 |
| 17 #@ arm | 17 #@ arm |
| 18 #@ Available modes: | 18 #@ Available modes: |
| 19 #@ newlib (same as omitting mode) | 19 #@ newlib (same as omitting mode) |
| 20 #@ pic | 20 #@ pic |
| 21 #@ sbtc | 21 #@ sbtc |
| 22 #@ glibc | 22 #@ glibc |
| 23 #@ browser | 23 #@ browser |
| 24 #@ browser-glibc | 24 #@ browser-glibc |
| 25 #@ | 25 #@ |
| 26 #@ For example: tools/llvm/utman-test.sh test-x86-32-glibc | 26 #@ For example: test.sh test-x86-32-glibc |
| 27 #@ | 27 #@ |
| 28 #@ The env variables: UTMAN_CONCURRENCY, UTMAN_BUILDBOT, UTMAN_DEBUG | 28 #@ The env variables: PNACL_CONCURRENCY, PNACL_BUILDBOT, PNACL_DEBUG |
| 29 #@ control behavior of this script | 29 #@ control behavior of this script |
| 30 #@ | 30 #@ |
| 31 #@ | 31 #@ |
| 32 | 32 |
| 33 ###################################################################### | 33 ###################################################################### |
| 34 # Config | 34 # Config |
| 35 ###################################################################### | 35 ###################################################################### |
| 36 | 36 |
| 37 set -o nounset | 37 set -o nounset |
| 38 set -o errexit | 38 set -o errexit |
| 39 | 39 |
| 40 # The script is located in "native_client/tools/llvm". | 40 # The script is located in "pnacl/". |
| 41 # Set pwd to native_client/ | 41 # Set pwd to native_client/ |
| 42 cd "$(dirname "$0")"/../.. | 42 cd "$(dirname "$0")"/.. |
| 43 if [[ $(basename "$(pwd)") != "native_client" ]] ; then | 43 if [[ $(basename "$(pwd)") != "native_client" ]] ; then |
| 44 echo "ERROR: cannot find native_client/ directory" | 44 echo "ERROR: cannot find native_client/ directory" |
| 45 exit -1 | 45 exit -1 |
| 46 fi | 46 fi |
| 47 readonly NACL_ROOT="$(pwd)" | 47 readonly NACL_ROOT="$(pwd)" |
| 48 | 48 |
| 49 readonly DRYRUN=${DRYRUN:-false} | 49 readonly DRYRUN=${DRYRUN:-false} |
| 50 | 50 |
| 51 # This is only used by Spec2K test scripts. | 51 # This is only used by Spec2K test scripts. |
| 52 readonly PNACL_LIBMODE=${LIBMODE:-newlib} | 52 readonly PNACL_LIBMODE=${LIBMODE:-newlib} |
| 53 export PNACL_LIBMODE | 53 export PNACL_LIBMODE |
| 54 | 54 |
| 55 source tools/llvm/common-tools.sh | 55 source pnacl/scripts/common-tools.sh |
| 56 SetScriptPath "${NACL_ROOT}/tools/llvm/utman-test.sh" | 56 SetScriptPath "${NACL_ROOT}/pnacl/test.sh" |
| 57 SetLogDirectory "${NACL_ROOT}/toolchain/test-log" | 57 SetLogDirectory "${NACL_ROOT}/toolchain/test-log" |
| 58 | 58 |
| 59 # For different levels of make parallelism change this in your env | 59 # For different levels of make parallelism change this in your env |
| 60 readonly UTMAN_CONCURRENCY=${UTMAN_CONCURRENCY:-8} | 60 readonly PNACL_CONCURRENCY=${PNACL_CONCURRENCY:-8} |
| 61 | 61 |
| 62 readonly OTHER_TEST_SCRIPT="${NACL_ROOT}/buildbot/buildbot_pnacl.sh" | 62 readonly OTHER_TEST_SCRIPT="${NACL_ROOT}/buildbot/buildbot_pnacl.sh" |
| 63 | 63 |
| 64 ###################################################################### | 64 ###################################################################### |
| 65 ###################################################################### | 65 ###################################################################### |
| 66 # | 66 # |
| 67 # < TESTING > | 67 # < TESTING > |
| 68 # | 68 # |
| 69 ###################################################################### | 69 ###################################################################### |
| 70 ###################################################################### | 70 ###################################################################### |
| 71 | 71 |
| 72 # TODO(robertm): figure out what to do about concurrency in debug mode. | 72 # TODO(robertm): figure out what to do about concurrency in debug mode. |
| 73 # Perhaps it is fine just tweaking that via UTMAN_CONCURRENCY. | 73 # Perhaps it is fine just tweaking that via PNACL_CONCURRENCY. |
| 74 if ${UTMAN_DEBUG} || ${UTMAN_BUILDBOT}; then | 74 if ${PNACL_DEBUG} || ${PNACL_BUILDBOT}; then |
| 75 readonly SCONS_ARGS=(MODE=nacl,opt-host | 75 readonly SCONS_ARGS=(MODE=nacl,opt-host |
| 76 bitcode=1 | 76 bitcode=1 |
| 77 --verbose | 77 --verbose |
| 78 -j${UTMAN_CONCURRENCY}) | 78 -j${PNACL_CONCURRENCY}) |
| 79 else | 79 else |
| 80 readonly SCONS_ARGS=(MODE=nacl,opt-host | 80 readonly SCONS_ARGS=(MODE=nacl,opt-host |
| 81 bitcode=1 | 81 bitcode=1 |
| 82 naclsdk_validate=0 | 82 naclsdk_validate=0 |
| 83 sysinfo=0 | 83 sysinfo=0 |
| 84 -j${UTMAN_CONCURRENCY}) | 84 -j${PNACL_CONCURRENCY}) |
| 85 fi | 85 fi |
| 86 | 86 |
| 87 #@ show-tests - see what tests can be run | 87 #@ show-tests - see what tests can be run |
| 88 show-tests() { | 88 show-tests() { |
| 89 StepBanner "SHOWING TESTS" | 89 StepBanner "SHOWING TESTS" |
| 90 cat $(find tests -name nacl.scons) | grep -o 'run_[A-Za-z_-]*' | sort | uniq | 90 cat $(find tests -name nacl.scons) | grep -o 'run_[A-Za-z_-]*' | sort | uniq |
| 91 } | 91 } |
| 92 | 92 |
| 93 Run() { | 93 Run() { |
| 94 if ${DRYRUN}; then | 94 if ${DRYRUN}; then |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 test-x86-64-browser-glibc() { browser-tests "x86-64" "--nacl_glibc" ; } | 223 test-x86-64-browser-glibc() { browser-tests "x86-64" "--nacl_glibc" ; } |
| 224 | 224 |
| 225 #@ | 225 #@ |
| 226 #@ test-all - Run arm, x86-32, and x86-64 tests. (all should pass) | 226 #@ test-all - Run arm, x86-32, and x86-64 tests. (all should pass) |
| 227 test-all() { | 227 test-all() { |
| 228 if [ $# -ne 0 ]; then | 228 if [ $# -ne 0 ]; then |
| 229 echo "test-all does not take any arguments" | 229 echo "test-all does not take any arguments" |
| 230 exit -1 | 230 exit -1 |
| 231 fi | 231 fi |
| 232 | 232 |
| 233 FAIL_FAST=true ${OTHER_TEST_SCRIPT} mode-test-all ${UTMAN_CONCURRENCY} | 233 FAIL_FAST=true ${OTHER_TEST_SCRIPT} mode-test-all ${PNACL_CONCURRENCY} |
| 234 } | 234 } |
| 235 | 235 |
| 236 #@ | 236 #@ |
| 237 #@ test-spec <official-spec-dir> <setup> [ref|train] [<benchmarks>]* | 237 #@ test-spec <official-spec-dir> <setup> [ref|train] [<benchmarks>]* |
| 238 #@ - run spec tests | 238 #@ - run spec tests |
| 239 test-spec() { | 239 test-spec() { |
| 240 if [[ $# -lt 2 ]]; then | 240 if [[ $# -lt 2 ]]; then |
| 241 echo "not enough arguments for test-spec" | 241 echo "not enough arguments for test-spec" |
| 242 exit 1 | 242 exit 1 |
| 243 fi; | 243 fi; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 [ $# = 0 ] && set -- help # Avoid reference to undefined $1. | 330 [ $# = 0 ] && set -- help # Avoid reference to undefined $1. |
| 331 if [ "$(type -t $1)" != "function" ]; then | 331 if [ "$(type -t $1)" != "function" ]; then |
| 332 #Usage | 332 #Usage |
| 333 echo "ERROR: unknown function '$1'." >&2 | 333 echo "ERROR: unknown function '$1'." >&2 |
| 334 echo "For help, try:" | 334 echo "For help, try:" |
| 335 echo " $0 help" | 335 echo " $0 help" |
| 336 exit 1 | 336 exit 1 |
| 337 fi | 337 fi |
| 338 | 338 |
| 339 "$@" | 339 "$@" |
| OLD | NEW |