blob: 5eb9331b39d119116e40f81a9131be145041f59c [file] [log] [blame]
Gilad Arnold744da572012-10-03 16:21:28 -07001#!/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
7# Runs the devserver unit test modules.
8
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
46 ./${unittest_script} || test ${force_all} || break
47done