blob: c95ea93e2c3fd15ca864534bfac4aa04d5fcb9e6 [file] [log] [blame]
Gilad Arnold744da572012-10-03 23:21:281#!/bin/bash
2
3# Copyright (c) 2012 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
Gilad Arnolda9cf3c52013-02-12 18:42:547# Runs *_unittest.py modules.
Gilad Arnold744da572012-10-03 23:21:288
9set -e
10
11# Display help/usage message.
12usage() {
13 cat <<EOF
14Usage: ${0##*/} [OPTION]...
15Options:
16 -f force running all unit test modules, regardless of failure
17 -h display this help and exit
18EOF
19}
20
21# Parse command-line options.
22while getopts ":fh" opt; do
23 case $opt in
24 f)
25 force_all=1
26 ;;
27 h)
28 usage
29 exit
30 ;;
31 \?)
32 echo "Invalid option: -$OPTARG" >&2
33 exit 1
34 ;;
35 esac
36done
37
38shift $((OPTIND-1))
39if [[ $# > 0 ]]; then
40 echo "Invalid argument: $1"
41 exit 1
42fi
43
44# Invoke unit test scripts.
45for unittest_script in *_unittest.py; do
Chris Sosa1885d032012-11-30 01:07:2746 echo "Running $unittest_script":
Gilad Arnold744da572012-10-03 23:21:2847 ./${unittest_script} || test ${force_all} || break
48done