5 ########################################################################
8 # Author: Janis Johnson
11 # For each of a list of patches, invoke separate tools to update
12 # sources, do a build, and run one or more tests.
14 # Define these in a file whose name is the argument to this script:
15 # REG_IDLIST: List of patch identifiers.
16 # REG_UPDATE: Pathname of script to update the source tree.
17 # REG_BUILD: Pathname of script to build enough of the product to run
19 # REG_TEST: Pathname of script to run one or more tests.
21 # VERBOSITY: Default is 0, to print only errors and final message.
22 # DATE_IN_MSG If set to anything but 0, include the time and date in
24 # REG_STOP Pathname of a file whose existence says to quit; default
25 # is STOP in the current directory.
28 # Copyright (c) 2002, 2003, 2005 Free Software Foundation, Inc.
30 # This file is free software; you can redistribute it and/or modify
31 # it under the terms of the GNU General Public License as published by
32 # the Free Software Foundation; either version 3 of the License, or
33 # (at your option) any later version.
35 # This program is distributed in the hope that it will be useful,
36 # but WITHOUT ANY WARRANTY; without even the implied warranty of
37 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38 # GNU General Public License for more details.
40 # For a copy of the GNU General Public License, write the the
41 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
42 # Boston, MA 02111-1301, USA.
44 ########################################################################
46 ########################################################################
48 ########################################################################
50 # Issue a message if its verbosity level is high enough.
53 test ${1} -gt ${VERBOSITY} && return
55 if [ "x${DATE_IN_MSG}" = "x" ]; then
62 # Issue an error message and exit with a nonzero status.
69 # Build the components to test using sources as of a particular patch
70 # and run a test case. Pass each of the scripts the patch identifier
71 # that we're testing; the first one needs it, the others can ignore it
77 ${REG_UPDATE} ${TEST_ID}
79 msg
0 "source update failed for id ${TEST_ID}"
82 ${REG_BUILD} ${TEST_ID}
84 msg
0 "build failed for id ${TEST_ID}"
87 ${REG_TEST} "${TEST_ID}"
90 ########################################################################
91 # Main program (so to speak)
92 ########################################################################
94 # If DATE isn't defined, use the default date command; the configuration
95 # file can override this.
97 if [ "x${DATE}" = "x" ]; then
101 # Process the configuration file.
103 if [ $# -ne 1 ]; then
104 echo Usage
: $0 config_file
109 if [ ! -f ${CONFIG} ]; then
110 error
"configuration file ${CONFIG} does not exist"
113 # OK, the config file exists. Source it, make sure required parameters
114 # are defined and their files exist, and give default values to optional
119 test "x${REG_IDLIST}" = "x" && error
"REG_IDLIST is not defined"
120 test "x${REG_UPDATE}" = "x" && error
"REG_UPDATE is not defined"
121 test "x${REG_BUILD}" = "x" && error
"REG_BUILD is not defined"
122 test "x${REG_TEST}" = "x" && error
"REG_TEST is not defined"
123 test -x ${REG_TEST} || error
"REG_TEST is not an executable file"
124 test "x${VERBOSITY}" = "x" && VERBOSITY
=0
125 test "x${REG_STOP}" = "x" && REG_STOP
="STOP"
127 msg
2 "REG_IDLIST = ${REG_IDLIST}"
128 msg
2 "REG_UPDATE = ${REG_UPDATE}"
129 msg
2 "REG_BUILD = ${REG_BUILD}"
130 msg
2 "REG_TEST = ${REG_TEST}"
131 msg
2 "VERBOSITY = ${VERBOSITY}"
133 # Process each patch identifier in the list.
135 for TEST_ID
in $REG_IDLIST; do
137 # If a file called STOP appears, stop; this allows a clean way to
138 # interrupt a search.
140 if [ -f ${REG_STOP} ]; then
141 msg
0 "STOP file detected"
146 # Process the new patch.
148 msg
2 "process id ${TEST_ID}"
149 process_patch
${TEST_ID}