2001-05-24 06:37:54 +02:00
|
|
|
[= autogen5 template sh=check.sh =]
|
2000-05-09 18:21:08 +02:00
|
|
|
[=
|
|
|
|
#
|
sed portability fixes in fixincludes
fixincludes/:
PR testsuite/29737
PR bootstrap/35938
PR testsuite/39655
* check.tpl: Fix typos.
* README: Likewise. Also, document that 'select' uses ERE.
* mkheaders.in: Update copyright years in --version output.
* inclhack.def (sco_math): Add missing final newline in sed
script 'a', 'c', or 'i' commands, for BSD sed.
(sco_math): In the text of 'a', 'c', or 'i' sed
commands, prepend leading white space with a backslash to avoid
the whitespace to be removed by BSD sed.
(sco_math): Match plain 'C++' instead of 'C\+\+' in sed regex.
(x11_new): Fix sed expression, for BSD sed.
(glibc_mutex_init): Fix newlines in sed 's' command replacement
part, for GNU sed 3.02 and Solaris sed.
(glibc_mutex_init): Replace unportable \+ sed regex operator
with \{1,\}.
(glibc_c99_inline_2, glibc_mutex_init): Avoid unportable sed
alternation \| regex operator.
(solaris_complex): Remove superfluous backslashes from
replacement string. Replace \+ operator with \{1,\}.
* tests/base/Xm/Traversal.h: This is fixed for BSD sed now.
* fixincl.x: Regenerate.
From-SVN: r151518
2009-09-08 19:30:31 +02:00
|
|
|
# This file contains the shell template to run tests on the fixes
|
2000-05-09 18:21:08 +02:00
|
|
|
#
|
|
|
|
=]#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
2000-05-31 16:26:57 +02:00
|
|
|
TESTDIR=tests
|
2002-05-16 19:43:21 +02:00
|
|
|
TESTBASE=`cd $1;${PWDCMD-pwd}`
|
2000-05-31 16:26:57 +02:00
|
|
|
|
|
|
|
[ -d ${TESTDIR} ] || mkdir ${TESTDIR}
|
|
|
|
cd ${TESTDIR}
|
2002-05-16 19:43:21 +02:00
|
|
|
TESTDIR=`${PWDCMD-pwd}`
|
2000-05-09 18:21:08 +02:00
|
|
|
|
|
|
|
TARGET_MACHINE='*'
|
2002-05-16 19:43:21 +02:00
|
|
|
DESTDIR=`${PWDCMD-pwd}`/res
|
|
|
|
SRCDIR=`${PWDCMD-pwd}`/inc
|
2000-05-09 18:21:08 +02:00
|
|
|
FIND_BASE='.'
|
2003-03-22 22:51:04 +01:00
|
|
|
VERBOSE=[=` echo ${VERBOSE-1} `=]
|
2002-05-16 19:43:21 +02:00
|
|
|
INPUT=`${PWDCMD-pwd}`
|
2000-08-04 16:16:57 +02:00
|
|
|
ORIGDIR=${INPUT}
|
2000-05-09 18:21:08 +02:00
|
|
|
|
2000-08-04 16:16:57 +02:00
|
|
|
export TARGET_MACHINE DESTDIR SRCDIR FIND_BASE VERBOSE INPUT ORIGDIR
|
2000-05-09 18:21:08 +02:00
|
|
|
|
2000-05-31 16:26:57 +02:00
|
|
|
rm -rf ${DESTDIR} ${SRCDIR}
|
2000-05-09 18:21:08 +02:00
|
|
|
mkdir ${DESTDIR} ${SRCDIR}
|
2001-05-26 18:17:46 +02:00
|
|
|
(
|
|
|
|
[=
|
|
|
|
(shellf
|
|
|
|
"for f in %s
|
|
|
|
do case $f in
|
|
|
|
*/* ) echo $f | sed 's;/[^/]*$;;' ;;
|
|
|
|
esac
|
|
|
|
done | sort -u | \
|
|
|
|
while read g
|
|
|
|
do echo \" mkdir \\${SRCDIR}/$g || mkdir -p \\${SRCDIR}/$g || exit 1\"
|
|
|
|
done" (join " " (stack "fix.files")) ) =]
|
|
|
|
) 2> /dev/null[= # suppress 'No such file or directory' messages =]
|
2000-05-31 16:26:57 +02:00
|
|
|
cd inc
|
2000-05-09 18:21:08 +02:00
|
|
|
[=
|
2001-05-26 18:17:46 +02:00
|
|
|
(define sfile "")
|
2001-05-27 20:21:04 +02:00
|
|
|
(define HACK "")
|
2001-05-26 18:17:46 +02:00
|
|
|
(define dfile "") =][=
|
2000-05-09 18:21:08 +02:00
|
|
|
|
2001-05-26 18:17:46 +02:00
|
|
|
FOR fix =][=
|
2000-05-31 16:26:57 +02:00
|
|
|
|
2001-05-26 18:17:46 +02:00
|
|
|
IF (> (count "test_text") 1) =][=
|
2001-05-27 20:21:04 +02:00
|
|
|
(set! HACK (string-upcase! (get "hackname")))
|
2001-05-26 18:17:46 +02:00
|
|
|
(set! sfile (if (exist? "files") (get "files[]") "testing.h"))
|
|
|
|
(set! dfile (string-append
|
|
|
|
(if (*==* sfile "/")
|
|
|
|
(shellf "echo \"%s\"|sed 's,/[^/]*,/,'" sfile )
|
|
|
|
"" )
|
|
|
|
(string-tr! (get "hackname") "_A-Z" "-a-z")
|
|
|
|
) ) =][=
|
|
|
|
|
|
|
|
FOR test_text (for-from 1) =]
|
|
|
|
cat >> [=(. sfile)=] <<_HACK_EOF_
|
2000-05-31 16:26:57 +02:00
|
|
|
|
|
|
|
|
2001-05-27 20:21:04 +02:00
|
|
|
#if defined( [=(. HACK)=]_CHECK_[=(for-index)=] )
|
2000-05-31 16:26:57 +02:00
|
|
|
[=test_text=]
|
2001-05-27 20:21:04 +02:00
|
|
|
#endif /* [=(. HACK)=]_CHECK_[=(for-index)=] */
|
2000-05-31 16:26:57 +02:00
|
|
|
_HACK_EOF_
|
2001-05-26 18:17:46 +02:00
|
|
|
echo [=(. sfile)=] | ../../fixincl
|
|
|
|
mv -f [=(. sfile)=] [=(. dfile)=]-[=(for-index)=].h
|
|
|
|
[ -f ${DESTDIR}/[=(. sfile)=] ] && [=#
|
|
|
|
=]mv ${DESTDIR}/[=(. sfile)=] ${DESTDIR}/[=(. dfile)=]-[=(for-index)=].h[=
|
|
|
|
|
2001-05-24 06:37:54 +02:00
|
|
|
ENDFOR test_text =][=
|
2001-05-26 18:17:46 +02:00
|
|
|
|
|
|
|
ENDIF multi-test =][=
|
2000-05-31 16:26:57 +02:00
|
|
|
|
2001-05-24 06:37:54 +02:00
|
|
|
ENDFOR fix
|
2000-05-31 16:26:57 +02:00
|
|
|
|
|
|
|
=][=
|
|
|
|
|
2001-05-27 20:21:04 +02:00
|
|
|
FOR fix =][=
|
|
|
|
(set! HACK (string-upcase! (get "hackname"))) =][=
|
2000-05-09 18:21:08 +02:00
|
|
|
|
2001-05-24 06:37:54 +02:00
|
|
|
IF (not (exist? "test_text")) =][=
|
2001-05-27 20:21:04 +02:00
|
|
|
(if (not (exist? "replace"))
|
|
|
|
(error (sprintf "include fix '%s' has no test text"
|
|
|
|
(get "hackname") )) )
|
|
|
|
=][=
|
|
|
|
ELSE =]
|
2011-05-17 09:25:07 +02:00
|
|
|
cat >> [= (raw-shell-str (if (exist? "files") (get "files[0]") "testing.h"))
|
|
|
|
=] <<_HACK_EOF_
|
2000-05-09 18:21:08 +02:00
|
|
|
|
|
|
|
|
2001-05-27 20:21:04 +02:00
|
|
|
#if defined( [=(. HACK)=]_CHECK )
|
2000-05-31 16:26:57 +02:00
|
|
|
[=test_text=]
|
2001-05-27 20:21:04 +02:00
|
|
|
#endif /* [=(. HACK)=]_CHECK */
|
2000-05-09 18:21:08 +02:00
|
|
|
_HACK_EOF_
|
2001-05-24 06:37:54 +02:00
|
|
|
[=ENDIF =][=
|
2000-05-09 18:21:08 +02:00
|
|
|
|
2001-05-24 06:37:54 +02:00
|
|
|
ENDFOR fix
|
2000-05-09 18:21:08 +02:00
|
|
|
|
|
|
|
=]
|
|
|
|
|
2001-05-27 20:21:04 +02:00
|
|
|
find . -type f | sed 's;^\./;;' | sort | ../../fixincl
|
2000-05-31 16:26:57 +02:00
|
|
|
cd ${DESTDIR}
|
|
|
|
|
|
|
|
exitok=true
|
2000-05-11 15:41:12 +02:00
|
|
|
|
2000-05-31 16:26:57 +02:00
|
|
|
find * -type f -print > ${TESTDIR}/LIST
|
|
|
|
|
2000-07-20 15:29:29 +02:00
|
|
|
# Special hack for sys/types.h: the #define-d types for size_t,
|
|
|
|
# ptrdiff_t and wchar_t are different for each port. Therefore,
|
|
|
|
# strip off the defined-to type so that the test results are the
|
|
|
|
# same for all platforms.
|
|
|
|
#
|
|
|
|
sed 's/\(#define __[A-Z_]*_TYPE__\).*/\1/' sys/types.h > XX
|
|
|
|
mv -f XX sys/types.h
|
|
|
|
|
|
|
|
# The following subshell weirdness is for saving an exit
|
|
|
|
# status from within a while loop that reads input. If you can
|
|
|
|
# think of a cleaner way, suggest away, please...
|
|
|
|
#
|
2000-05-31 16:26:57 +02:00
|
|
|
exitok=`
|
|
|
|
exec < ${TESTDIR}/LIST
|
2000-05-11 15:41:12 +02:00
|
|
|
while read f
|
|
|
|
do
|
2000-05-31 16:26:57 +02:00
|
|
|
if [ ! -f ${TESTBASE}/$f ]
|
|
|
|
then
|
|
|
|
echo "Newly fixed header: $f" >&2
|
|
|
|
exitok=false
|
|
|
|
|
|
|
|
elif cmp $f ${TESTBASE}/$f >&2
|
2000-05-11 15:41:12 +02:00
|
|
|
then
|
2000-05-31 16:26:57 +02:00
|
|
|
:
|
|
|
|
|
2000-05-11 15:41:12 +02:00
|
|
|
else
|
2003-05-28 13:53:34 +02:00
|
|
|
${DIFF:-diff} -c $f ${TESTBASE}/$f >&2 || :
|
2000-05-31 16:26:57 +02:00
|
|
|
exitok=false
|
2000-05-11 15:41:12 +02:00
|
|
|
fi
|
2000-05-31 16:26:57 +02:00
|
|
|
done
|
|
|
|
echo $exitok`
|
2000-05-11 15:41:12 +02:00
|
|
|
|
2000-05-31 16:26:57 +02:00
|
|
|
cd $TESTBASE
|
2000-05-09 18:21:08 +02:00
|
|
|
|
2000-05-31 16:26:57 +02:00
|
|
|
find * -type f -print | \
|
2005-11-13 09:43:28 +01:00
|
|
|
fgrep -v 'CVS/' | \
|
2005-11-05 13:21:02 +01:00
|
|
|
fgrep -v '.svn/' > ${TESTDIR}/LIST
|
2000-05-09 18:21:08 +02:00
|
|
|
|
2000-05-31 16:26:57 +02:00
|
|
|
exitok=`
|
|
|
|
exec < ${TESTDIR}/LIST
|
|
|
|
while read f
|
|
|
|
do
|
|
|
|
if [ -s $f ] && [ ! -f ${DESTDIR}/$f ]
|
|
|
|
then
|
|
|
|
echo "Missing header fix: $f" >&2
|
|
|
|
exitok=false
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo $exitok`
|
2000-05-09 18:21:08 +02:00
|
|
|
|
2000-05-31 16:26:57 +02:00
|
|
|
echo
|
|
|
|
if $exitok
|
|
|
|
then
|
|
|
|
cd ${TESTDIR}
|
|
|
|
rm -rf inc res LIST
|
|
|
|
cd ..
|
|
|
|
rmdir ${TESTDIR} > /dev/null 2>&1 || :
|
|
|
|
echo All fixinclude tests pass >&2
|
|
|
|
else
|
|
|
|
echo There were fixinclude test FAILURES >&2
|
|
|
|
fi
|
|
|
|
$exitok[=
|
2000-05-09 18:21:08 +02:00
|
|
|
|
2002-05-02 07:18:08 +02:00
|
|
|
(if (defined? 'set-writable) (set-writable))
|
2000-05-31 16:26:57 +02:00
|
|
|
|
2000-05-09 18:21:08 +02:00
|
|
|
=]
|