OLD | NEW |
---|---|
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 29 matching lines...) Expand all Loading... | |
40 | 40 |
41 function check_src_test() { | 41 function check_src_test() { |
42 egrep '^src_test()' "${1}" > /dev/null | 42 egrep '^src_test()' "${1}" > /dev/null |
43 } | 43 } |
44 | 44 |
45 function record_test_failure() { | 45 function record_test_failure() { |
46 TEST_FAILURES=$(( TEST_FAILURES + 1 )) | 46 TEST_FAILURES=$(( TEST_FAILURES + 1 )) |
47 FAILED_PACKAGES="${FAILED_PACKAGES} ${1}" | 47 FAILED_PACKAGES="${FAILED_PACKAGES} ${1}" |
48 } | 48 } |
49 | 49 |
50 # Run the unit test for the given package, via ebuild src_test() function | |
davidjames
2011/04/07 17:02:07
Could you add a trailing period?
mtennant
2011/04/07 20:01:43
Done.
| |
50 function run_unit_test() { | 51 function run_unit_test() { |
51 FEATURES="-buildpkg -digest noauto" \ | 52 FEATURES="-buildpkg -digest" \ |
52 ebuild-${FLAGS_board} "${1}" clean unpack prepare configure test | 53 ebuild-${FLAGS_board} "${1}" clean test clean |
53 } | 54 } |
54 | 55 |
55 # Parse command line and die if unexpected parameters given. | 56 # Parse command line and die if unexpected parameters given. |
56 FLAGS_HELP="usage: ${0} [flags]" | 57 FLAGS_HELP="usage: ${0} [flags]" |
57 FLAGS "${@}" || exit 1 | 58 FLAGS "${@}" || exit 1 |
58 eval set -- "${FLAGS_ARGV}" | 59 eval set -- "${FLAGS_ARGV}" |
59 check_flags_only_and_allow_null_arg "${@}" && set -- | 60 check_flags_only_and_allow_null_arg "${@}" && set -- |
60 | 61 |
61 set -e | 62 set -e |
62 | 63 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 warn "${NO_UNITTESTS}" | 109 warn "${NO_UNITTESTS}" |
109 fi | 110 fi |
110 | 111 |
111 if [ ${TEST_FAILURES} -ne 0 ]; then | 112 if [ ${TEST_FAILURES} -ne 0 ]; then |
112 error "Run completed with ${TEST_FAILURES}/${TEST_COUNT} test failures." | 113 error "Run completed with ${TEST_FAILURES}/${TEST_COUNT} test failures." |
113 error "Following packages had failing tests:" | 114 error "Following packages had failing tests:" |
114 die "${FAILED_PACKAGES}" | 115 die "${FAILED_PACKAGES}" |
115 else | 116 else |
116 info "All unit tests passed." | 117 info "All unit tests passed." |
117 fi | 118 fi |
OLD | NEW |