Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: run_tests.sh

Issue 3041012: Remove support for old way of building and running unit tests (Closed) Base URL: ssh://git@chromiumos-git//crosutils.git
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build_tests.sh ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash
2
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
5 # found in the LICENSE file.
6
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.
9 . "$(dirname "$0")/common.sh"
10
11 # Script must be run inside the chroot
12 restart_in_chroot_if_needed $*
13 get_default_board
14
15 # Flags
16 DEFINE_string build_root "$DEFAULT_BUILD_ROOT" \
17 "Root of build output"
18 DEFINE_string board "$DEFAULT_BOARD" \
19 "Target board of which tests were built"
20
21 # Parse command line
22 FLAGS "$@" || exit 1
23 eval set -- "${FLAGS_ARGV}"
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
36 # Die on error; print commands
37 set -ex
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
52 # NOTE: We currently skip cryptohome_tests (which happens to have a different
53 # suffix than the other tests), because it doesn't work.
54 # NOTE: Removed explicit use of the target board's ld-linux.so.2 so that this
55 # will work on hardened builds (with PIE on by default). Tests pass on
56 # hardened and non-hardened builds without this explicit use, but we only
57 # disable this on hardened, since that is where the PIE conflict happens.
58 for i in ${TESTS_DIR}/*_{test,unittests}; do
59 if [[ "`file -b $i`" = "POSIX shell script text executable" ]]; then
60 LD_LIBRARY_PATH=$LD_LIBRARY_PATH /build/${FLAGS_board}/bin/bash $i
61 else
62 LD_LIBRARY_PATH=$LD_LIBRARY_PATH $i
63 fi
64 done
65
66
OLDNEW
« no previous file with comments | « build_tests.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698