]>
git.ipfire.org Git - thirdparty/dhcp.git/blob - tests/unittest.sh.in
3 # Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
5 # Permission to use, copy, modify, and/or distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 # PERFORMANCE OF THIS SOFTWARE.
17 # Script used to execute unit tests described by the Atffile in the current
18 # directory. It exits with return value of atf-run, which will be 0 if all
19 # tests passed, non-zero otherwise.
22 # Add configured path to ATF tools, atf-run and atf-report
23 PATH
="@ATF_BIN@:${PATH}"
26 # colors if not outputting to a dumb terminal and stdout is a tty
27 if test "$TERM" != dumb
&& { test -t 1; } 2>/dev
/null
; then \
32 # if echo supports -e, we must use it to set colors
33 # (output will be "" if its supported)
40 header
="===================================================="
43 if [ -n "@ATF_BIN@" -a -f Atffile
]
46 echo "Running unit tests..."
50 # set color based on success/failure
58 # spit out the test report
59 # We print everything upto the summary in
60 # "no color". Print the summary in our
62 cat atf.out | atf-report |
while read line
64 cnt
=`echo $line | grep -c "Summary"`
67 echo $dash_e $color$header
71 echo $dash_e $header$noclr
73 # clean up unless there were test failures