ia64/xen-unstable

view tools/check/chk @ 7238:971e7c7411b3

Raise an exception if an error appears on the pipes to our children, and make
sure that the child's pipes are closed even under that exception. Move the
handling of POLLHUP to the end of the loop, so that we guarantee to read any
remaining data from the child if POLLHUP and POLLIN appear at the same time.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@ewan
date Thu Oct 06 10:13:11 2005 +0100 (2005-10-06)
parents 06d84bf87159
children 0e22ecd169a0
line source
1 #!/bin/bash
3 function usage {
4 echo "Usage:"
5 echo "\t$0 [build|install|clean]"
6 echo
7 echo "Check suitability for Xen build or install."
8 echo "Exit with 0 if OK, 1 if not."
9 echo "Prints only failed tests."
10 echo
11 echo "Calling with 'clean' removes generated files."
12 exit 1
13 }
15 export PATH=${PATH}:/sbin:/usr/sbin
17 case $1 in
18 build)
19 check="CHECK-BUILD"
20 ;;
21 install)
22 check="CHECK-INSTALL"
23 ;;
24 clean)
25 exit 0
26 ;;
27 *)
28 usage
29 ;;
30 esac
32 failed=0
34 echo "Xen ${check} " $(date)
35 for f in check_* ; do
36 case $f in
37 *~)
38 continue
39 ;;
40 *)
41 ;;
42 esac
43 if ! [ -x $f ] ; then
44 continue
45 fi
46 if ! grep -q ${check} $f ; then
47 continue
48 fi
49 echo -n "Checking $f: "
50 if ./$f 2>&1 ; then
51 echo OK
52 else
53 failed=1
54 fi
55 done
57 exit $failed