OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [fixincludes/] [check.tpl] - Diff between revs 154 and 816

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 154 Rev 816
[= autogen5 template sh=check.sh =]
[= autogen5 template sh=check.sh =]
[=
[=
#
#
#  This file contanes the shell template to run tests on the fixes
#  This file contanes the shell template to run tests on the fixes
#
#
=]#!/bin/sh
=]#!/bin/sh
set -e
set -e
TESTDIR=tests
TESTDIR=tests
TESTBASE=`cd $1;${PWDCMD-pwd}`
TESTBASE=`cd $1;${PWDCMD-pwd}`
[ -d ${TESTDIR} ] || mkdir ${TESTDIR}
[ -d ${TESTDIR} ] || mkdir ${TESTDIR}
cd ${TESTDIR}
cd ${TESTDIR}
TESTDIR=`${PWDCMD-pwd}`
TESTDIR=`${PWDCMD-pwd}`
TARGET_MACHINE='*'
TARGET_MACHINE='*'
DESTDIR=`${PWDCMD-pwd}`/res
DESTDIR=`${PWDCMD-pwd}`/res
SRCDIR=`${PWDCMD-pwd}`/inc
SRCDIR=`${PWDCMD-pwd}`/inc
FIND_BASE='.'
FIND_BASE='.'
VERBOSE=[=` echo ${VERBOSE-1} `=]
VERBOSE=[=` echo ${VERBOSE-1} `=]
INPUT=`${PWDCMD-pwd}`
INPUT=`${PWDCMD-pwd}`
ORIGDIR=${INPUT}
ORIGDIR=${INPUT}
export TARGET_MACHINE DESTDIR SRCDIR FIND_BASE VERBOSE INPUT ORIGDIR
export TARGET_MACHINE DESTDIR SRCDIR FIND_BASE VERBOSE INPUT ORIGDIR
rm -rf ${DESTDIR} ${SRCDIR}
rm -rf ${DESTDIR} ${SRCDIR}
mkdir ${DESTDIR} ${SRCDIR}
mkdir ${DESTDIR} ${SRCDIR}
(
(
[=
[=
  (shellf
  (shellf
    "for f in %s
    "for f in %s
     do case $f in
     do case $f in
        */* ) echo $f | sed 's;/[^/]*$;;' ;;
        */* ) echo $f | sed 's;/[^/]*$;;' ;;
        esac
        esac
     done | sort -u | \
     done | sort -u | \
     while read g
     while read g
     do echo \"  mkdir \\${SRCDIR}/$g || mkdir -p \\${SRCDIR}/$g || exit 1\"
     do echo \"  mkdir \\${SRCDIR}/$g || mkdir -p \\${SRCDIR}/$g || exit 1\"
     done" (join " " (stack "fix.files"))  ) =]
     done" (join " " (stack "fix.files"))  ) =]
) 2> /dev/null[= # suppress 'No such file or directory' messages =]
) 2> /dev/null[= # suppress 'No such file or directory' messages =]
cd inc
cd inc
[=
[=
(define sfile "")
(define sfile "")
(define HACK  "")
(define HACK  "")
(define dfile "")              =][=
(define dfile "")              =][=
FOR fix                        =][=
FOR fix                        =][=
  IF (> (count "test_text") 1) =][=
  IF (> (count "test_text") 1) =][=
    (set! HACK (string-upcase! (get "hackname")))
    (set! HACK (string-upcase! (get "hackname")))
    (set! sfile (if (exist? "files") (get "files[]") "testing.h"))
    (set! sfile (if (exist? "files") (get "files[]") "testing.h"))
    (set! dfile (string-append
    (set! dfile (string-append
          (if (*==* sfile "/")
          (if (*==* sfile "/")
              (shellf "echo \"%s\"|sed 's,/[^/]*,/,'" sfile )
              (shellf "echo \"%s\"|sed 's,/[^/]*,/,'" sfile )
              "" )
              "" )
          (string-tr! (get "hackname") "_A-Z" "-a-z")
          (string-tr! (get "hackname") "_A-Z" "-a-z")
    )           )              =][=
    )           )              =][=
    FOR test_text (for-from 1) =]
    FOR test_text (for-from 1) =]
cat >> [=(. sfile)=] <<_HACK_EOF_
cat >> [=(. sfile)=] <<_HACK_EOF_
#if defined( [=(. HACK)=]_CHECK_[=(for-index)=] )
#if defined( [=(. HACK)=]_CHECK_[=(for-index)=] )
[=test_text=]
[=test_text=]
#endif  /* [=(. HACK)=]_CHECK_[=(for-index)=] */
#endif  /* [=(. HACK)=]_CHECK_[=(for-index)=] */
_HACK_EOF_
_HACK_EOF_
echo [=(. sfile)=] | ../../fixincl
echo [=(. sfile)=] | ../../fixincl
mv -f [=(. sfile)=] [=(. dfile)=]-[=(for-index)=].h
mv -f [=(. sfile)=] [=(. dfile)=]-[=(for-index)=].h
[ -f ${DESTDIR}/[=(. sfile)=] ] && [=#
[ -f ${DESTDIR}/[=(. sfile)=] ] && [=#
   =]mv ${DESTDIR}/[=(. sfile)=] ${DESTDIR}/[=(. dfile)=]-[=(for-index)=].h[=
   =]mv ${DESTDIR}/[=(. sfile)=] ${DESTDIR}/[=(. dfile)=]-[=(for-index)=].h[=
    ENDFOR  test_text =][=
    ENDFOR  test_text =][=
  ENDIF  multi-test   =][=
  ENDIF  multi-test   =][=
ENDFOR  fix
ENDFOR  fix
=][=
=][=
FOR fix  =][=
FOR fix  =][=
  (set! HACK (string-upcase! (get "hackname")))  =][=
  (set! HACK (string-upcase! (get "hackname")))  =][=
  IF (not (exist? "test_text")) =][=
  IF (not (exist? "test_text")) =][=
    (if (not (exist? "replace"))
    (if (not (exist? "replace"))
        (error (sprintf "include fix '%s' has no test text"
        (error (sprintf "include fix '%s' has no test text"
                        (get "hackname") )) )
                        (get "hackname") )) )
         =][=
         =][=
  ELSE   =]
  ELSE   =]
cat >> [=
cat >> [=
    IF (exist? "files") =][=
    IF (exist? "files") =][=
      files[0] =][=
      files[0] =][=
    ELSE =]testing.h[=
    ELSE =]testing.h[=
    ENDIF =] <<_HACK_EOF_
    ENDIF =] <<_HACK_EOF_
#if defined( [=(. HACK)=]_CHECK )
#if defined( [=(. HACK)=]_CHECK )
[=test_text=]
[=test_text=]
#endif  /* [=(. HACK)=]_CHECK */
#endif  /* [=(. HACK)=]_CHECK */
_HACK_EOF_
_HACK_EOF_
[=ENDIF =][=
[=ENDIF =][=
ENDFOR  fix
ENDFOR  fix
=]
=]
find . -type f | sed 's;^\./;;' | sort | ../../fixincl
find . -type f | sed 's;^\./;;' | sort | ../../fixincl
cd ${DESTDIR}
cd ${DESTDIR}
exitok=true
exitok=true
find * -type f -print > ${TESTDIR}/LIST
find * -type f -print > ${TESTDIR}/LIST
#  Special hack for sys/types.h:  the #define-d types for size_t,
#  Special hack for sys/types.h:  the #define-d types for size_t,
#  ptrdiff_t and wchar_t are different for each port.  Therefore,
#  ptrdiff_t and wchar_t are different for each port.  Therefore,
#  strip off the defined-to type so that the test results are the
#  strip off the defined-to type so that the test results are the
#  same for all platforms.
#  same for all platforms.
#
#
sed 's/\(#define __[A-Z_]*_TYPE__\).*/\1/' sys/types.h > XX
sed 's/\(#define __[A-Z_]*_TYPE__\).*/\1/' sys/types.h > XX
mv -f XX sys/types.h
mv -f XX sys/types.h
#  The following subshell weirdness is for saving an exit
#  The following subshell weirdness is for saving an exit
#  status from within a while loop that reads input.  If you can
#  status from within a while loop that reads input.  If you can
#  think of a cleaner way, suggest away, please...
#  think of a cleaner way, suggest away, please...
#
#
exitok=`
exitok=`
exec < ${TESTDIR}/LIST
exec < ${TESTDIR}/LIST
while read f
while read f
do
do
  if [ ! -f ${TESTBASE}/$f ]
  if [ ! -f ${TESTBASE}/$f ]
  then
  then
    echo "Newly fixed header:  $f" >&2
    echo "Newly fixed header:  $f" >&2
    exitok=false
    exitok=false
  elif cmp $f ${TESTBASE}/$f >&2
  elif cmp $f ${TESTBASE}/$f >&2
  then
  then
    :
    :
  else
  else
    ${DIFF:-diff} -c $f ${TESTBASE}/$f >&2 || :
    ${DIFF:-diff} -c $f ${TESTBASE}/$f >&2 || :
    exitok=false
    exitok=false
  fi
  fi
done
done
echo $exitok`
echo $exitok`
cd $TESTBASE
cd $TESTBASE
find * -type f -print | \
find * -type f -print | \
fgrep -v 'CVS/' | \
fgrep -v 'CVS/' | \
fgrep -v '.svn/' > ${TESTDIR}/LIST
fgrep -v '.svn/' > ${TESTDIR}/LIST
exitok=`
exitok=`
exec < ${TESTDIR}/LIST
exec < ${TESTDIR}/LIST
while read f
while read f
do
do
  if [ -s $f ] && [ ! -f ${DESTDIR}/$f ]
  if [ -s $f ] && [ ! -f ${DESTDIR}/$f ]
  then
  then
    echo "Missing header fix:  $f" >&2
    echo "Missing header fix:  $f" >&2
    exitok=false
    exitok=false
  fi
  fi
done
done
echo $exitok`
echo $exitok`
echo
echo
if $exitok
if $exitok
then
then
  cd ${TESTDIR}
  cd ${TESTDIR}
  rm -rf inc res LIST
  rm -rf inc res LIST
  cd ..
  cd ..
  rmdir ${TESTDIR} > /dev/null 2>&1 || :
  rmdir ${TESTDIR} > /dev/null 2>&1 || :
  echo All fixinclude tests pass >&2
  echo All fixinclude tests pass >&2
else
else
  echo There were fixinclude test FAILURES  >&2
  echo There were fixinclude test FAILURES  >&2
fi
fi
$exitok[=
$exitok[=
(if (defined? 'set-writable) (set-writable))
(if (defined? 'set-writable) (set-writable))
=]
=]
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.