Commit 5d7d28c2 by Bruce Korb Committed by Bruce Korb

rework "make check" for fixinc

From-SVN: r34298
parent 231a2828
2000-05-31 Bruce Korb <bkorb@gnu.org>
* check.tpl: rework to use test result tree
* fixincl.x: regenerate
* inclhack.def: add new tests
* tests/base/arch/i960/archI960.h: New test result
* tests/base/curses.h: modified test result
Wed May 31 13:17:20 2000 Philippe De Muyter <phdm@macqel.be>
* except.c (clear_function_eh_region): Do not free NULL.
......
......@@ -6,9 +6,12 @@
=]#!/bin/sh
set -e
[ -d testdir ] && rm -rf testdir
mkdir testdir
cd testdir
TESTDIR=tests
TESTBASE=`cd $1;pwd`
[ -d ${TESTDIR} ] || mkdir ${TESTDIR}
cd ${TESTDIR}
TESTDIR=`pwd`
TARGET_MACHINE='*'
DESTDIR=`pwd`/res
......@@ -18,6 +21,7 @@ VERBOSE=1
export TARGET_MACHINE DESTDIR SRCDIR FIND_BASE VERBOSE
rm -rf ${DESTDIR} ${SRCDIR}
mkdir ${DESTDIR} ${SRCDIR}
( cd ${SRCDIR}
......@@ -37,10 +41,41 @@ mkdir ${DESTDIR} ${SRCDIR}
mkdir $f || mkdir -p $f
done ) > /dev/null 2>&1
cd inc
[=
_FOR fix =][=
_IF test_text _count 1 > =]
#
# [=hackname=] has [=_EVAL test_text _count=] tests
#
sfile=[=
_IF files _exist =][=
files[0] =][=
_ELSE =]testing.h[=
_ENDIF =]
dfile=`dirname $sfile`/[=hackname "_A-Z" "-a-z" _tr=]-[=_EVAL _index=].h
fixnum=[=_EVAL _index=][=
_FOR test_text FROM 1 =]
cat >> $sfile <<_HACK_EOF_
#if defined( [=hackname _up=]_CHECK_[=_EVAL _index=] )
[=test_text=]
#endif /* [=hackname _up=]_CHECK_[=_EVAL _index=] */
_HACK_EOF_
echo $sfile | ../../fixincl
[ -f ${DESTDIR}/$sfile ] && mv ${DESTDIR}/$sfile ${DESTDIR}/$dfile[=
/test_text =][=
_ENDIF =][=
/fix
=][=
_FOR fix =][=
_IF test_text _exist ! =][=
_IF replace _exist ! =]
echo No test for [=hackname=] in inc/[=
......@@ -50,16 +85,16 @@ echo No test for [=hackname=] in inc/[=
_ENDIF =][=
_ENDIF =][=
_ELSE =]
cat >> inc/[=
cat >> [=
_IF files _exist =][=
files[0] =][=
_ELSE =]testing.h[=
_ENDIF =] <<- _HACK_EOF_
_ENDIF =] <<_HACK_EOF_
#if defined( [=hackname _up=]_CHECK )
[=test_text "\t" _prefix=]
#endif /* [=hackname _up=]_CHECK */
#if defined( [=hackname _up=]_CHECK )
[=test_text=]
#endif /* [=hackname _up=]_CHECK */
_HACK_EOF_
[=_ENDIF =][=
......@@ -67,40 +102,63 @@ _HACK_EOF_
=]
cd inc
find . -type f | sed 's;\./;;' | sort > ../LIST
../../fixincl < ../LIST
cd ..
find . -type f | sed 's;\./;;' | sort | ../../fixincl
cd ${DESTDIR}
exitok=true
find * -type f -print > ${TESTDIR}/LIST
exitok=`
exec < ${TESTDIR}/LIST
while read f
do
if [ ! -f res/$f ]
if [ ! -f ${TESTBASE}/$f ]
then
echo "Newly fixed header: $f" >&2
exitok=false
elif cmp $f ${TESTBASE}/$f >&2
then
echo "Only in inc: inc/$f"
:
else
diff -c inc/$f res/$f | \
sed -e '1,2s; .*;;' -e '/MACH_DIFF:/,/no uniform test,/d'
diff -c $f ${TESTBASE}/$f >&2
exitok=false
fi
done > NEWDIFF < LIST
done
echo $exitok`
echo
echo Test output check:
[=
cd $TESTBASE
_FOR fix =][=
find * -type f -print | \
fgrep -v 'CVS/' > ${TESTDIR}/LIST
_IF test_text _exist =]
fgrep [=hackname _up=]_CHECK NEWDIFF > /dev/null 2>&1 || \
echo "[=_eval hackname _get "#%32s test failed. See testdir/inc/"
_printf =][=
_IF files _exist =][=
files[0] =][=
_ELSE =]testing.h[=
_ENDIF =]"[=
_ENDIF =][=
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`
/fix
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[=
=][=
_eval _outfile "chmod +x %s" _printf _shell
=]
......@@ -1612,7 +1612,7 @@ fix = {
c_fix_arg = "__%0";
c_fix_arg = "reg(ex|off|match)_t[^;]";
test_text = "`touch inc/sys/lc_core.h`"
test_text = "`touch sys/lc_core.h`"
"typedef struct {\n int stuff, mo_suff;\n} regex_t;\n"
"extern regex_t re;\n"
"extern regoff_t ro;\n"
......@@ -2601,7 +2601,10 @@ fix = {
hackname = tinfo_cplusplus;
files = tinfo.h;
select = "[ \t]_cplusplus";
sed = "s/[ \t]_cplusplus/ __cplusplus/";
c_fix = format;
c_fix_arg = " __cplusplus";
test_text = "#ifdef _cplusplus\nint bogus;\n#endif";
};
......@@ -2621,21 +2624,43 @@ fix = {
* parameters not const on DECstation Ultrix V4.0 and OSF/1.
*/
fix = {
hackname = ultrix_const;
files = stdio.h;
hackname = ultrix_const;
files = stdio.h;
select = 'perror\( char \*';
c_fix = format;
c_fix_arg = "%1 const %3 *__";
c_fix_arg = "([ \t*](perror|fputs|fwrite|scanf|fscanf)\\(.*)"
"[ \t]+(char|void) \\*__";
test_text =
"extern void perror( char *__s );\n"
"extern int fputs( char *__s, FILE *);\n"
"extern size_t fwrite( void *__ptr, size_t, size_t, FILE *);\n"
"extern int fscanf( FILE *__stream, char *__format, ...);\n"
"extern int scanf( char *__format, ...);\n";
};
/*
* parameters not const on DECstation Ultrix V4.0 and OSF/1.
*/
fix = {
hackname = ultrix_const2;
files = stdio.h;
select = '\*fopen\( char \*';
c_fix = format;
c_fix_arg = "%1( const char *%3, const char *";
c_fix_arg = "([ \t*](fopen|sscanf|popen|tempnam))\\("
"[ \t]*char[ \t]*\\*([^,]*),"
"[ \t]*char[ \t]*\\*[ \t]*";
sed = 's@perror( char \*__s );@perror( const char *__s );@';
sed = 's@fputs( char \*__s,@fputs( const char *__s,@';
sed = 's@fopen( char \*__filename, char \*__type );@'
'fopen( const char *__filename, const char *__type );@';
sed = 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@';
sed = 's@fscanf( FILE \*__stream, char \*__format,@'
'fscanf( FILE *__stream, const char *__format,@';
sed = 's@scanf( char \*__format,@scanf( const char *__format,@';
sed = 's@sscanf( char \*__s, char \*__format,@'
'sscanf( const char *__s, const char *__format,@';
sed = 's@popen(char \*, char \*);@popen(const char *, const char *);@';
sed = 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@';
test_text =
"extern FILE *fopen( char *__filename, char *__type );\n"
"extern int sscanf( char *__s, char *__format, ...);\n"
"extern FILE *popen(char *, char *);\n"
"extern char *tempnam(char*,char*);\n";
};
......@@ -2649,6 +2674,9 @@ fix = {
select = ULTRIX;
sed = "/^[ \t]*extern[ \t]*int[ \t]*uname();$/i\\\n"
"struct utsname;\n";
test_text =
"/* ULTRIX's uname */\nextern\tint\tuname();";
};
......@@ -2657,9 +2685,12 @@ fix = {
*/
fix = {
hackname = ultrix_ifdef;
select = "#ifdef KERNEL[ \t]*[^ \t]";
select = "#ifdef KERNEL[ \t]+[^ \t]";
files = sys/file.h;
sed = "s/#ifdef KERNEL/#if defined(KERNEL)/";
test_text =
"#ifdef KERNEL\t&& defined( mumbojumbo )\nint oops;\n#endif";
};
......@@ -2721,13 +2752,18 @@ fix = {
* Fix definitions of macros used by va-i960.h in VxWorks header file.
*/
fix = {
hackname = va_i960_macro;
files = arch/i960/archI960.h;
select = "__(vsiz|vali|vpad|alignof__)";
sed = "s/__vsiz/__vxvsiz/";
sed = "s/__vali/__vxvali/";
sed = "s/__vpad/__vxvpad/";
sed = "s/__alignof__/__vxalignof__/";
hackname = va_i960_macro;
files = arch/i960/archI960.h;
select = "__(vsiz|vali|vpad|alignof__)";
c_fix = format;
c_fix_arg = "__vx%1";
test_text =
"extern int __vsiz vsiz;\n"
"extern int __vali vali;\n"
"extern int __vpad vpad;\n"
"#define __alignof__(x) ...";
};
......@@ -2736,21 +2772,22 @@ fix = {
* which is illegal in ANSI C++.
*/
fix = {
hackname = void_null;
files = curses.h;
files = dbm.h;
files = locale.h;
files = stdio.h;
files = stdlib.h;
files = string.h;
files = time.h;
files = unistd.h;
files = sys/dir.h;
files = sys/param.h;
files = sys/types.h;
select = "#[ \t]*define[ \t][ \t]*NULL[ \t].*void";
sed = "s/^#[ \t]*define[ \t]*NULL[ \t]*((void[ \t]*\\*)0)"
"/#define NULL 0/";
hackname = void_null;
files = curses.h;
files = dbm.h;
files = locale.h;
files = stdio.h;
files = stdlib.h;
files = string.h;
files = time.h;
files = unistd.h;
files = sys/dir.h;
files = sys/param.h;
files = sys/types.h;
select = "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)";
c_fix = format;
c_fix_arg = "#define NULL 0";
test_text = "# define\tNULL \t((void *)0) /* typed NULL */";
};
......@@ -2785,6 +2822,13 @@ fix = {
sed = "/[ \t]wchar_t/a\\\n"
"#endif\n";
test_text =
"#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__\n"
"typedef unsigned int size_t;\n"
"typedef long ptrdiff_t;\n"
"typedef unsigned short wchar_t;\n"
"#endif /* __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__ */\n";
};
......@@ -2792,10 +2836,11 @@ fix = {
* Fix VxWorks <time.h> to not require including <vxTypes.h>.
*/
fix = {
hackname = vxworks_needs_vxtypes;
files = time.h;
select = "uint_t[ \t][ \t]*_clocks_per_sec";
sed = "s/uint_t/unsigned int/";
hackname = vxworks_needs_vxtypes;
files = time.h;
select = "uint_t([ \t]+_clocks_per_sec)";
c_fix = format;
c_fix_arg = "unsigned int%1";
test_text = "uint_t\t_clocks_per_sec;";
};
......@@ -2809,10 +2854,14 @@ fix = {
test = " -r types/vxTypesOld.h";
test = " -n \"`egrep '#include' $file`\"";
test = " -n \"`egrep ULONG $file`\"";
select = "#[ \t]define[ \t][ \t]*__INCstath";
select = "#[ \t]define[ \t]+__INCstath";
sed = "/#[ \t]define[ \t][ \t]*__INCstath/a\\\n"
"#include <types/vxTypesOld.h>\n";
test_text = "`touch types/vxTypesOld.h`"
"#include </dev/null> /* ULONG */\n"
"# define\t__INCstath <sys/stat.h>";
};
......@@ -2822,19 +2871,24 @@ fix = {
fix = {
hackname = vxworks_time;
files = time.h;
select = "VOIDFUNCPTR";
test = " -r vxWorks.h";
sed = "/VOIDFUNCPTR/i\\\n"
"#ifndef __gcc_VOIDFUNCPTR_defined\\\n"
"#ifdef __cplusplus\\\n"
"typedef void (*__gcc_VOIDFUNCPTR) (...);\\\n"
"#else\\\n"
"typedef void (*__gcc_VOIDFUNCPTR) ();\\\n"
"#endif\\\n"
"#define __gcc_VOIDFUNCPTR_defined\\\n"
"#endif\n";
sed = "s/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g";
select = "#[ \t]*define[ \t]+VOIDFUNCPTR[ \t].*";
c_fix = format;
c_fix_arg =
"#ifndef __gcc_VOIDFUNCPTR_defined\n"
"#ifdef __cplusplus\n"
"typedef void (*__gcc_VOIDFUNCPTR) (...);\n"
"#else\n"
"typedef void (*__gcc_VOIDFUNCPTR) ();\n"
"#endif\n"
"#define __gcc_VOIDFUNCPTR_defined\n"
"#endif\n"
"#define VOIDFUNCPTR __gcc_VOIDFUNCPTR";
test_text = "`touch vxWorks.h`"
"#define VOIDFUNCPTR (void(*)())";
};
......@@ -2867,7 +2921,11 @@ fix = {
hackname = x11_class_usage;
files = Xm/BaseClassI.h;
bypass = "__cplusplus";
sed = "s/ class[)]/ c_class)/g";
select = " class\\)";
c_fix = format;
c_fix_arg = " c_class)";
test_text = "extern mumble (int class);\n";
};
......@@ -2903,11 +2961,11 @@ fix = {
hackname = x11_sprintf;
files = X11/Xmu.h;
files = X11/Xmu/Xmu.h;
select = 'sprintf\(\)';
select = "^extern char \\*\tsprintf\\(\\);$";
c_fix = format;
c_fix_arg = "#ifndef __STDC__\n%0\n#endif /* !defined __STDC__ */";
sed = "s,^extern char \\*\tsprintf();$,#ifndef __STDC__\\\n"
"extern char *\tsprintf();\\\n"
"#endif /* !defined __STDC__ */,";
test_text = "extern char *\tsprintf();";
};
......
#if defined( VA_I960_MACRO_CHECK )
extern int __vxvsiz vsiz;
extern int __vxvali vali;
extern int __vxvpad vpad;
#define __vxalignof__(x) ...
#endif /* VA_I960_MACRO_CHECK */
......@@ -23,3 +23,10 @@ struct term;
#if defined( LYNX_VOID_INT_CHECK )
/* curses foiled again */
#endif /* LYNX_VOID_INT_CHECK */
#if defined( VOID_NULL_CHECK )
#ifndef NULL
#define NULL 0 /* typed NULL */
#endif
#endif /* VOID_NULL_CHECK */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment