OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Load common constants. This should be the first executable line. | 7 # Load common constants. This should be the first executable line. |
8 # The path to common.sh should be relative to your script's location. | 8 # The path to common.sh should be relative to your script's location. |
9 . "$(dirname "$0")/common.sh" | 9 . "$(dirname "$0")/common.sh" |
10 | 10 |
| 11 # Script must be run inside the chroot |
| 12 assert_inside_chroot |
| 13 get_default_board |
| 14 |
11 # Flags | 15 # Flags |
12 DEFINE_string build_root "$DEFAULT_BUILD_ROOT" \ | 16 DEFINE_string build_root "$DEFAULT_BUILD_ROOT" \ |
13 "Root of build output" | 17 "Root of build output" |
14 DEFINE_string board "" \ | 18 DEFINE_string board "$DEFAULT_BOARD" \ |
15 "Target board of which tests were built" | 19 "Target board of which tests were built" |
16 | 20 |
17 # Parse command line | 21 # Parse command line |
18 FLAGS "$@" || exit 1 | 22 FLAGS "$@" || exit 1 |
19 eval set -- "${FLAGS_ARGV}" | 23 eval set -- "${FLAGS_ARGV}" |
20 | 24 |
| 25 # Run tests |
| 26 if [ -z "$FLAGS_board" ]; then |
| 27 echo Error: --board required |
| 28 exit 1 |
| 29 fi |
| 30 |
| 31 TESTS_DIR="/build/${FLAGS_board}/tests" |
| 32 LD_LIBRARY_PATH=/build/${FLAGS_board}/lib:/build/${FLAGS_board}/usr/lib:\ |
| 33 /build/${FLAGS_board}/usr/lib/gcc/i686-pc-linux-gnu/4.4.1/:\ |
| 34 /build/${FLAGS_board}/usr/lib/opengl/xorg-x11/lib |
| 35 |
21 # Die on error; print commands | 36 # Die on error; print commands |
22 set -ex | 37 set -ex |
23 | 38 |
24 # Run tests | 39 # NOTE: We currently skip cryptohome_tests (which happens to have a different |
25 if [ -n "$FLAGS_board" ] | 40 # suffix than the other tests), because it doesn't work. |
26 then | 41 for i in /build/${FLAGS_board}/tests/*_{test,unittests}; do |
27 TESTS_DIR="/build/${FLAGS_board}/tests" | 42 if [[ "`file -b $i`" = "POSIX shell script text executable" ]]; then |
28 echo "Not implemented" >&2 | 43 LD_LIBRARY_PATH=$LD_LIBRARY_PATH /build/${FLAGS_board}/lib/ld-linux.so.2 /bu
ild/${FLAGS_board}/bin/bash $i |
29 exit 1 | 44 else |
30 | 45 LD_LIBRARY_PATH=$LD_LIBRARY_PATH /build/${FLAGS_board}/lib/ld-linux.so.2 $i |
31 # TODO(sosa@chromium.org) - Call autotest job to run tests from TESTS_DIR | 46 fi |
32 # using run_remote_tests | 47 done |
33 else | 48 |
34 TESTS_DIR="$FLAGS_build_root/x86/tests" | |
35 cd "$TESTS_DIR" | |
36 | |
37 # TODO: standardize test names - should all end in "_test" | |
38 for i in *_test *_tests *_unittests; do ! ./${i}; done | |
39 | |
40 cd - | |
41 echo "All tests passed." | |
42 fi | |
OLD | NEW |