| 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 24 matching lines...) Expand all Loading... |
| 35 egrep '^src_test()' "${1}" > /dev/null | 35 egrep '^src_test()' "${1}" > /dev/null |
| 36 } | 36 } |
| 37 | 37 |
| 38 function record_test_failure() { | 38 function record_test_failure() { |
| 39 TEST_FAILURES=$(( TEST_FAILURES + 1 )) | 39 TEST_FAILURES=$(( TEST_FAILURES + 1 )) |
| 40 FAILED_PACKAGES="${FAILED_PACKAGES} ${1}" | 40 FAILED_PACKAGES="${FAILED_PACKAGES} ${1}" |
| 41 } | 41 } |
| 42 | 42 |
| 43 function run_unit_test() { | 43 function run_unit_test() { |
| 44 FEATURES="-buildpkg -digest noauto" \ | 44 FEATURES="-buildpkg -digest noauto" \ |
| 45 ebuild-${FLAGS_board} "${1}" clean unpack configure test | 45 ebuild-${FLAGS_board} "${1}" clean unpack prepare configure test |
| 46 } | 46 } |
| 47 | 47 |
| 48 # Parse command line and die if unexpected paramters given. | 48 # Parse command line and die if unexpected parameters given. |
| 49 FLAGS_HELP="usage: ${0} [flags]" | 49 FLAGS_HELP="usage: ${0} [flags]" |
| 50 FLAGS "${@}" || exit 1 | 50 FLAGS "${@}" || exit 1 |
| 51 eval set -- "${FLAGS_ARGV}" | 51 eval set -- "${FLAGS_ARGV}" |
| 52 check_flags_only_and_allow_null_arg "${@}" && set -- | 52 check_flags_only_and_allow_null_arg "${@}" && set -- |
| 53 | 53 |
| 54 set -e | 54 set -e |
| 55 | 55 |
| 56 [ -z "${FLAGS_board}" ] && die "--board required" | 56 [ -z "${FLAGS_board}" ] && die "--board required" |
| 57 | 57 |
| 58 # If no packages are specified we run all unit tests for chromeos-base | 58 # If no packages are specified we run all unit tests for chromeos-base |
| (...skipping 28 matching lines...) Expand all Loading... |
| 87 warn "${NO_UNITTESTS}" | 87 warn "${NO_UNITTESTS}" |
| 88 fi | 88 fi |
| 89 | 89 |
| 90 if [ ${TEST_FAILURES} -ne 0 ]; then | 90 if [ ${TEST_FAILURES} -ne 0 ]; then |
| 91 error "Run completed with ${TEST_FAILURES}/${TEST_COUNT} test failures." | 91 error "Run completed with ${TEST_FAILURES}/${TEST_COUNT} test failures." |
| 92 error "Following packages had failing tests:" | 92 error "Following packages had failing tests:" |
| 93 die "${FAILED_PACKAGES}" | 93 die "${FAILED_PACKAGES}" |
| 94 else | 94 else |
| 95 info "All unit tests passed." | 95 info "All unit tests passed." |
| 96 fi | 96 fi |
| OLD | NEW |