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

Side by Side Diff: cros_run_unit_tests

Issue 6240018: This starts to fix the scripts so that they load from /usr/lib/crosutils (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: fixing bad merge Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « cros_mark_branch_as_stable ('k') | cros_show_stacks » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 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 # This script builds and runs Chromium OS unit tests. Note that this script 7 # This script builds and runs Chromium OS unit tests. Note that this script
8 # utilizes the src_test stanza in chromeos-base packages. These stanzas 8 # utilizes the src_test stanza in chromeos-base packages. These stanzas
9 # should both build and run the unit tests. 9 # should both build and run the unit tests.
10 10
11 # This script requires that you run build_packages first. 11 # This script requires that you run build_packages first.
12 12
13 . "$(dirname "$0")/common.sh" 13 # --- BEGIN COMMON.SH BOILERPLATE ---
14 # Load common CrOS utilities. Inside the chroot this file is installed in
15 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's
16 # location.
17 find_common_sh() {
18 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")"))
19 local path
20
21 SCRIPT_ROOT=
22 for path in "${common_paths[@]}"; do
23 if [ -r "${path}/common.sh" ]; then
24 SCRIPT_ROOT=${path}
25 break
26 fi
27 done
28 }
29
30 find_common_sh
31 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1)
32 # --- END COMMON.SH BOILERPLATE ---
14 33
15 get_default_board 34 get_default_board
16 35
17 # Flags 36 # Flags
18 DEFINE_string board "${DEFAULT_BOARD}" \ 37 DEFINE_string board "${DEFAULT_BOARD}" \
19 "Target board of which tests were built" 38 "Target board of which tests were built"
20 DEFINE_string build_root "${DEFAULT_BUILD_ROOT}" \ 39 DEFINE_string build_root "${DEFAULT_BUILD_ROOT}" \
21 "Root of build output" 40 "Root of build output"
22 DEFINE_string package_file "" \ 41 DEFINE_string package_file "" \
23 "File with space-separated list of packages to run unit tests" f 42 "File with space-separated list of packages to run unit tests" f
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 fi 88 fi
70 89
71 [ -n "${FLAGS_packages}" ] && PACKAGE_LIST="${PACKAGE_LIST} ${FLAGS_packages}" 90 [ -n "${FLAGS_packages}" ] && PACKAGE_LIST="${PACKAGE_LIST} ${FLAGS_packages}"
72 91
73 # If we didn't specify packages, find all packages. 92 # If we didn't specify packages, find all packages.
74 if [ -z "${FLAGS_package_file}" -a -z "${FLAGS_packages}" ]; then 93 if [ -z "${FLAGS_package_file}" -a -z "${FLAGS_packages}" ]; then
75 PACKAGE_LIST=$( ./get_package_list chromeos --board="${FLAGS_board}" | 94 PACKAGE_LIST=$( ./get_package_list chromeos --board="${FLAGS_board}" |
76 egrep '^chromeos-base' ) 95 egrep '^chromeos-base' )
77 fi 96 fi
78 97
79 BLACK_LIST_FILE="$(dirname "$0")/unit_test_black_list.txt" 98 BLACK_LIST_FILE="${SCRIPTS_DIR}/unit_test_black_list.txt"
80 99
81 if [ "${FLAGS_withdebug}" -eq "${FLAGS_FALSE}" ]; then 100 if [ "${FLAGS_withdebug}" -eq "${FLAGS_FALSE}" ]; then
82 export USE="${USE} -cros-debug" 101 export USE="${USE} -cros-debug"
83 fi 102 fi
84 103
85 for package in ${PACKAGE_LIST}; do 104 for package in ${PACKAGE_LIST}; do
86 if grep -xq "${package}" "${BLACK_LIST_FILE}"; then 105 if grep -xq "${package}" "${BLACK_LIST_FILE}"; then
87 warn "Skipping package ${package} since it is blacklisted." 106 warn "Skipping package ${package} since it is blacklisted."
88 continue 107 continue
89 fi 108 fi
(...skipping 14 matching lines...) Expand all
104 warn "${NO_UNITTESTS}" 123 warn "${NO_UNITTESTS}"
105 fi 124 fi
106 125
107 if [ ${TEST_FAILURES} -ne 0 ]; then 126 if [ ${TEST_FAILURES} -ne 0 ]; then
108 error "Run completed with ${TEST_FAILURES}/${TEST_COUNT} test failures." 127 error "Run completed with ${TEST_FAILURES}/${TEST_COUNT} test failures."
109 error "Following packages had failing tests:" 128 error "Following packages had failing tests:"
110 die "${FAILED_PACKAGES}" 129 die "${FAILED_PACKAGES}"
111 else 130 else
112 info "All unit tests passed." 131 info "All unit tests passed."
113 fi 132 fi
OLDNEW
« no previous file with comments | « cros_mark_branch_as_stable ('k') | cros_show_stacks » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698