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 |
(...skipping 18 matching lines...) Expand all Loading... |
29 fi | 29 fi |
30 | 30 |
31 TESTS_DIR="/build/${FLAGS_board}/tests" | 31 TESTS_DIR="/build/${FLAGS_board}/tests" |
32 LD_LIBRARY_PATH=/build/${FLAGS_board}/lib:/build/${FLAGS_board}/usr/lib:\ | 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/:\ | 33 /build/${FLAGS_board}/usr/lib/gcc/i686-pc-linux-gnu/4.4.1/:\ |
34 /build/${FLAGS_board}/usr/lib/opengl/xorg-x11/lib | 34 /build/${FLAGS_board}/usr/lib/opengl/xorg-x11/lib |
35 | 35 |
36 # Die on error; print commands | 36 # Die on error; print commands |
37 set -ex | 37 set -ex |
38 | 38 |
| 39 # Change to a test directory to make it easier for tests to write |
| 40 # to and clean up temporary files. |
| 41 TEST_CWD=$(mktemp -d /tmp/run_tests.XXXX) |
| 42 cd $TEST_CWD |
| 43 |
| 44 function cleanup() { |
| 45 cd - |
| 46 rm -rf $TEST_CWD |
| 47 trap - 0 |
| 48 } |
| 49 |
| 50 trap cleanup ERR 0 |
| 51 |
39 # NOTE: We currently skip cryptohome_tests (which happens to have a different | 52 # NOTE: We currently skip cryptohome_tests (which happens to have a different |
40 # suffix than the other tests), because it doesn't work. | 53 # suffix than the other tests), because it doesn't work. |
41 for i in /build/${FLAGS_board}/tests/*_{test,unittests}; do | 54 for i in ${TESTS_DIR}/*_{test,unittests}; do |
42 if [[ "`file -b $i`" = "POSIX shell script text executable" ]]; then | 55 if [[ "`file -b $i`" = "POSIX shell script text executable" ]]; then |
43 LD_LIBRARY_PATH=$LD_LIBRARY_PATH /build/${FLAGS_board}/lib/ld-linux.so.2 /bu
ild/${FLAGS_board}/bin/bash $i | 56 LD_LIBRARY_PATH=$LD_LIBRARY_PATH /build/${FLAGS_board}/lib/ld-linux.so.2 /bu
ild/${FLAGS_board}/bin/bash $i |
44 else | 57 else |
45 LD_LIBRARY_PATH=$LD_LIBRARY_PATH /build/${FLAGS_board}/lib/ld-linux.so.2 $i | 58 LD_LIBRARY_PATH=$LD_LIBRARY_PATH /build/${FLAGS_board}/lib/ld-linux.so.2 $i |
46 fi | 59 fi |
47 done | 60 done |
48 | |
OLD | NEW |