1 [= autogen5 template sh=check.sh =]
4 # This file contains the shell template to run tests on the fixes
10 TESTBASE=`cd $1;${PWDCMD-pwd}`
12 [ -d ${TESTDIR} ] || mkdir ${TESTDIR}
14 TESTDIR=`${PWDCMD-pwd}`
17 DESTDIR=`${PWDCMD-pwd}`/res
18 SRCDIR=`${PWDCMD-pwd}`/inc
20 VERBOSE=[=` echo ${VERBOSE-1} `=]
24 export TARGET_MACHINE DESTDIR SRCDIR FIND_BASE VERBOSE INPUT ORIGDIR
26 rm -rf ${DESTDIR} ${SRCDIR}
27 mkdir ${DESTDIR} ${SRCDIR}
33 */* ) echo $f | sed 's;/[^/]*$;;' ;;
37 do echo \" mkdir \\${SRCDIR}/$g || mkdir -p \\${SRCDIR}/$g || exit 1\"
38 done" (join " " (stack "fix.files")) ) =]
39 ) 2> /dev/null[= # suppress 'No such file or directory' messages =]
44 (define dfile "") =][=
48 IF (> (count "test_text") 1) =][=
49 (set! HACK (string-upcase! (get "hackname")))
50 (set! sfile (if (exist? "files") (get "files[]") "testing.h"))
51 (set! dfile (string-append
53 (shellf "echo \"%s\"|sed 's,/[^/]*,/,'" sfile )
55 (string-tr! (get "hackname") "_A-Z" "-a-z")
58 FOR test_text (for-from 1) =]
59 cat >> [=(. sfile)=] <<_HACK_EOF_
62 #if defined( [=(. HACK)=]_CHECK_[=(for-index)=] )
64 #endif /* [=(. HACK)=]_CHECK_[=(for-index)=] */
66 echo [=(. sfile)=] | ../../fixincl
67 mv -f [=(. sfile)=] [=(. dfile)=]-[=(for-index)=].h
68 [ -f ${DESTDIR}/[=(. sfile)=] ] && [=#
69 =]mv ${DESTDIR}/[=(. sfile)=] ${DESTDIR}/[=(. dfile)=]-[=(for-index)=].h[=
80 (set! HACK (string-upcase! (get "hackname"))) =][=
82 IF (not (exist? "test_text")) =][=
83 (if (not (exist? "replace"))
84 (error (sprintf "include fix '%s' has no test text"
88 cat >> [= (raw-shell-str (if (exist? "files") (get "files[0]") "testing.h"))
92 #if defined( [=(. HACK)=]_CHECK )
94 #endif /* [=(. HACK)=]_CHECK */
102 find . -type f | sed 's;^\./;;' | sort | ../../fixincl
107 find * -type f -print > ${TESTDIR}/LIST
109 # Special hack for sys/types.h: the #define-d types for size_t,
110 # ptrdiff_t and wchar_t are different for each port. Therefore,
111 # strip off the defined-to type so that the test results are the
112 # same for all platforms.
114 sed 's/\(#define __[A-Z_]*_TYPE__\).*/\1/' sys/types.h > XX
117 # The following subshell weirdness is for saving an exit
118 # status from within a while loop that reads input. If you can
119 # think of a cleaner way, suggest away, please...
122 exec < ${TESTDIR}/LIST
125 if [ ! -f ${TESTBASE}/$f ]
127 echo "Newly fixed header: $f" >&2
130 elif cmp $f ${TESTBASE}/$f >&2
135 ${DIFF:-diff} -c $f ${TESTBASE}/$f >&2 || :
143 find * -type f -print | \
145 fgrep -v '.svn/' > ${TESTDIR}/LIST
148 exec < ${TESTDIR}/LIST
151 if [ -s $f ] && [ ! -f ${DESTDIR}/$f ]
153 echo "Missing header fix: $f" >&2
165 rmdir ${TESTDIR} > /dev/null 2>&1 || :
166 echo All fixinclude tests pass >&2
168 echo There were fixinclude test FAILURES >&2
172 (if (defined? 'set-writable) (set-writable))