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

Side by Side Diff: cros_run_unit_tests

Issue 5281001: Ignore packages that cannot be found for the target. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Add logic Created 10 years 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 | « no previous file | 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
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
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 FLAGS_HELP="usage: ${0} [flags]" 51 FLAGS_HELP="usage: ${0} [flags]"
52 FLAGS "${@}" || exit 1 52 FLAGS "${@}" || exit 1
53 eval set -- "${FLAGS_ARGV}" 53 eval set -- "${FLAGS_ARGV}"
54 check_flags_only_and_allow_null_arg "${@}" && set -- 54 check_flags_only_and_allow_null_arg "${@}" && set --
55 55
56 set -e 56 set -e
57 57
58 [ -z "${FLAGS_board}" ] && die "--board required" 58 [ -z "${FLAGS_board}" ] && die "--board required"
59 59
60 # Create package list from package file and list of packages. 60 # Create package list from package file and list of packages.
61 [ -n "${FLAGS_package_file}" ] && PACKAGE_LIST="$(cat ${FLAGS_package_file})" 61 if [ -n "${FLAGS_package_file}" ]; then
62 if [ -f "${FLAGS_package_file}" ]; then
63 PACKAGE_LIST="$(cat ${FLAGS_package_file})"
64 else
65 warn "Missing package file."
66 fi
67 fi
68
62 [ -n "${FLAGS_packages}" ] && PACKAGE_LIST="${PACKAGE_LIST} ${FLAGS_packages}" 69 [ -n "${FLAGS_packages}" ] && PACKAGE_LIST="${PACKAGE_LIST} ${FLAGS_packages}"
63 70
64 # If we didn't specify packages, find all packages. 71 # If we didn't specify packages, find all packages.
65 if [ -z "${FLAGS_package_file}" -a -z "${FLAGS_packages}" ]; then 72 if [ -z "${FLAGS_package_file}" -a -z "${FLAGS_packages}" ]; then
66 PACKAGE_LIST=$( ./get_package_list chromeos --board="${FLAGS_board}" | 73 PACKAGE_LIST=$( ./get_package_list chromeos --board="${FLAGS_board}" |
67 egrep '^chromeos-base' ) 74 egrep '^chromeos-base' )
68 fi 75 fi
69 76
70 BLACK_LIST_FILE="$(dirname "$0")/unit_test_black_list.txt" 77 BLACK_LIST_FILE="$(dirname "$0")/unit_test_black_list.txt"
71 78
72 for package in ${PACKAGE_LIST}; do 79 for package in ${PACKAGE_LIST}; do
73 if grep -xq "${package}" "${BLACK_LIST_FILE}"; then 80 if grep -xq "${package}" "${BLACK_LIST_FILE}"; then
74 warn "Skipping package ${package} since it is blacklisted." 81 warn "Skipping package ${package} since it is blacklisted."
75 continue 82 continue
76 fi 83 fi
77 EBUILD_PATH=$( equery-${FLAGS_board} which ${package} 2> /dev/null ) 84 EBUILD_PATH=$( equery-${FLAGS_board} which ${package} 2> /dev/null ) || \
85 warn "${package} not found"
78 if [ -n "${EBUILD_PATH}" ]; then 86 if [ -n "${EBUILD_PATH}" ]; then
79 if check_src_test "${EBUILD_PATH}"; then 87 if check_src_test "${EBUILD_PATH}"; then
80 run_unit_test "${EBUILD_PATH}" || record_test_failure "${package}" 88 run_unit_test "${EBUILD_PATH}" || record_test_failure "${package}"
81 else 89 else
82 NO_UNITTESTS="${NO_UNITTESTS} ${package}" 90 NO_UNITTESTS="${NO_UNITTESTS} ${package}"
83 fi 91 fi
84 TEST_COUNT=$(( TEST_COUNT + 1 )) 92 TEST_COUNT=$(( TEST_COUNT + 1 ))
85 fi 93 fi
86 done 94 done
87 95
88 if [ -n "${NO_UNITTESTS}" ]; then 96 if [ -n "${NO_UNITTESTS}" ]; then
89 warn "The following packages have no unit tests:" 97 warn "The following packages have no unit tests:"
90 warn "${NO_UNITTESTS}" 98 warn "${NO_UNITTESTS}"
91 fi 99 fi
92 100
93 if [ ${TEST_FAILURES} -ne 0 ]; then 101 if [ ${TEST_FAILURES} -ne 0 ]; then
94 error "Run completed with ${TEST_FAILURES}/${TEST_COUNT} test failures." 102 error "Run completed with ${TEST_FAILURES}/${TEST_COUNT} test failures."
95 error "Following packages had failing tests:" 103 error "Following packages had failing tests:"
96 die "${FAILED_PACKAGES}" 104 die "${FAILED_PACKAGES}"
97 else 105 else
98 info "All unit tests passed." 106 info "All unit tests passed."
99 fi 107 fi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698