run_all.sh

来自「用于进行gcc测试」· Shell 代码 · 共 315 行

SH
315
字号
#!/bin/sh# Run ACATS with the GNU Ada compiler# The following functions are to be customized if you run in cross# environment or want to change compilation flags.  Note that for# tests requiring checks not turned on by default, this script# automatically adds the needed flags to pass (ie: -gnato or -gnatE).# gccflags="-O3 -fomit-frame-pointer -funroll-all-loops -finline-functions"# gnatflags="-gnatN"gccflags="-O2"gnatflags="-gnatws"target_run () {$*}# End of customization section.display_noeol () {  printf "$@"  printf "$@" >> $dir/acats.sum  printf "$@" >> $dir/acats.log}display () {  echo "$@"  echo "$@" >> $dir/acats.sum  echo "$@" >> $dir/acats.log}log () {  echo "$@" >> $dir/acats.sum  echo "$@" >> $dir/acats.log}dir=`${PWDCMD-pwd}`if [ "$testdir" = "" ]; then   echo You must use make check or make check-ada   exit 1fiif [ "$dir" = "$testdir" ]; then  echo "error: srcdir must be different than objdir, exiting."  exit 1fitarget_gnatchop () {  gnatchop --GCC="$GCC_DRIVER" $*}target_gnatmake () {  echo gnatmake --GCC=\"$GCC\" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC=\"$GCC\"  gnatmake --GCC="$GCC" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC="$GCC"}target_gcc () {  $GCC $gccflags $*}clean_dir () {  rm -f "$binmain" *.o *.ali > /dev/null 2>&1}find_main () {  ls ${i}?.adb > ${i}.lst 2> /dev/null  ls ${i}*m.adb >> ${i}.lst 2> /dev/null  ls ${i}.adb >> ${i}.lst 2> /dev/null  main=`tail -1 ${i}.lst`}EXTERNAL_OBJECTS=""# Global variable to communicate external objects to link with.rm -f $dir/acats.sum $dir/acats.logdisplay "		=== acats configuration ==="target=`$GCC -dumpmachine`display target gcc is $GCCdisplay `$GCC -v 2>&1`display host=`gcc -dumpmachine`display target=$targetdisplay `type gnatmake`gnatls -v >> $dir/acats.logdisplay ""display "		=== acats support ==="display_noeol "Generating support files..."rm -rf $dir/supportmkdir -p $dir/supportcd $dir/supportcp $testdir/support/*.ada $testdir/support/*.a $testdir/support/*.tst $dir/support# Find out the size in bit of an address on the targettarget_gnatmake $testdir/support/impbit.adb >> $dir/acats.log 2>&1target_run $dir/support/impbit > $dir/support/impbit.out 2>&1target_bit=`cat $dir/support/impbit.out`echo target_bit="$target_bit" >> $dir/acats.log# Find out a suitable asm statement# Adapted from configure.ac gcc_cv_as_dwarf2_debug_linecase "$target" in  ia64*-*-* | s390*-*-*)    target_insn="nop 0"    ;;  mmix-*-*)    target_insn="swym 0"    ;;  *)    target_insn="nop"    ;;esacecho target_insn="$target_insn" >> $dir/acats.logsed -e "s,ACATS4GNATDIR,$dir,g" \  < $testdir/support/impdef.a > $dir/support/impdef.ased -e "s,ACATS4GNATDIR,$dir,g" \  -e "s,ACATS4GNATBIT,$target_bit,g" \  -e "s,ACATS4GNATINSN,$target_insn,g" \  < $testdir/support/macro.dfs > $dir/support/MACRO.DFSsed -e "s,ACATS4GNATDIR,$dir,g" \  < $testdir/support/tsttests.dat > $dir/support/TSTTESTS.DATcp $testdir/tests/cd/*.c $dir/supportcp $testdir/tests/cxb/*.c $dir/supportrm -rf $dir/runmv $dir/tests $dir/tests.$$ 2> /dev/nullrm -rf $dir/tests.$$ &mkdir -p $dir/runcp -pr $testdir/tests $dir/for i in $dir/support/*.ada $dir/support/*.a; do    host_gnatchop $i >> $dir/acats.log 2>&1done# These tools are used to preprocess some ACATS sources# they need to be compiled native on the host.host_gnatmake -q -gnatws macrosub.adbif [ $? -ne 0 ]; then   display "**** Failed to compile macrosub"   exit 1fi./macrosub > macrosub.out 2>&1gcc -c cd300051.chost_gnatmake -q -gnatws widechr.adbif [ $? -ne 0 ]; then   display "**** Failed to compile widechr"   exit 1fi./widechr > widechr.out 2>&1rm -f $dir/support/macrosubrm -f $dir/support/widechrrm -f $dir/support/*.alirm -f $dir/support/*.odisplay " done."# From here, all compilations will be made by the target compilerdisplay_noeol "Compiling support files..."target_gcc -c *.cif [ $? -ne 0 ]; then   display "**** Failed to compile C code"   exit 1fitarget_gnatchop *.adt >> $dir/acats.log 2>&1target_gnatmake -c -gnato -gnatE *.ads >> $dir/acats.log 2>&1target_gnatmake -c -gnato -gnatE *.adb >> $dir/acats.log 2>&1display " done."display ""display "		=== acats tests ==="if [ $# -eq 0 ]; then   chapters=`cd $dir/tests; echo [a-z]*`else   chapters=$*figlob_countn=0glob_countok=0glob_countu=0for chapter in $chapters; do   display Running chapter $chapter ...   if [ ! -d $dir/tests/$chapter ]; then      display "*** CHAPTER $chapter does not exist, skipping."      display ""      continue   fi   cd $dir/tests/$chapter   ls *.a *.ada *.adt *.am *.dep 2> /dev/null | sed -e 's/\(.*\)\..*/\1/g' | \   cut -c1-7 | sort | uniq | comm -23 - $testdir/norun.lst \     > $dir/tests/$chapter/${chapter}.lst    countn=`wc -l < $dir/tests/$chapter/${chapter}.lst`   glob_countn=`expr $glob_countn + $countn`   counti=0   for i in `cat $dir/tests/$chapter/${chapter}.lst`; do       counti=`expr $counti + 1`      extraflags=""      grep $i $testdir/overflow.lst > /dev/null 2>&1      if [ $? -eq 0 ]; then         extraflags="$extraflags -gnato"      fi      grep $i $testdir/elabd.lst > /dev/null 2>&1      if [ $? -eq 0 ]; then         extraflags="$extraflags -gnatE"      fi      grep $i $testdir/stackcheck.lst > /dev/null 2>&1      if [ $? -eq 0 ]; then         extraflags="$extraflags -fstack-check"      fi      grep $i $testdir/ada95.lst > /dev/null 2>&1      if [ $? -eq 0 ]; then         extraflags="$extraflags -gnat95"      fi      test=$dir/tests/$chapter/$i      mkdir $test && cd $test >> $dir/acats.log 2>&1      if [ $? -ne 0 ]; then         display "FAIL:	$i"         failed="${failed}${i} "         clean_dir         continue      fi      target_gnatchop -c -w `ls ${test}*.a ${test}*.ada ${test}*.adt ${test}*.am ${test}*.dep 2> /dev/null` >> $dir/acats.log 2>&1      main=""      find_main      if [ -z "$main" ]; then         sync         find_main      fi      binmain=`echo $main | sed -e 's/\(.*\)\..*/\1/g'`      echo "BUILD $main" >> $dir/acats.log      EXTERNAL_OBJECTS=""      case $i in        cxb30*) EXTERNAL_OBJECTS="$dir/support/cxb30040.o $dir/support/cxb30060.o $dir/support/cxb30130.o $dir/support/cxb30131.o";;        ca1020e) rm -f ca1020e_func1.adb ca1020e_func2.adb ca1020e_proc1.adb ca1020e_proc2.adb > /dev/null 2>&1;;        ca14028) rm -f ca14028_func2.ads ca14028_func3.ads ca14028_proc1.ads ca14028_proc3.ads > /dev/null 2>&1;;        cxh1001) extraflags="-a -f"; echo "pragma Normalize_Scalars;" > gnat.adc      esac      if [ "$main" = "" ]; then         display "FAIL:	$i"         failed="${failed}${i} "         clean_dir         continue      fi      target_gnatmake $extraflags -I$dir/support $main >> $dir/acats.log 2>&1      if [ $? -ne 0 ]; then         display "FAIL:	$i"         failed="${failed}${i} "         clean_dir         continue      fi      echo "RUN $binmain" >> $dir/acats.log      cd $dir/run      if [ ! -x $dir/tests/$chapter/$i/$binmain ]; then         sync      fi      target_run $dir/tests/$chapter/$i/$binmain > $dir/tests/$chapter/$i/${i}.log 2>&1      cd $dir/tests/$chapter/$i      cat ${i}.log >> $dir/acats.log      egrep -e '(==== |\+\+\+\+ |\!\!\!\! )' ${i}.log > /dev/null 2>&1      if [ $? -ne 0 ]; then         grep 'Tasking not implemented' ${i}.log > /dev/null 2>&1         if [ $? -ne 0 ]; then            display "FAIL:	$i"            failed="${failed}${i} "         else            log "UNSUPPORTED:	$i"            glob_countn=`expr $glob_countn - 1`            glob_countu=`expr $glob_countu + 1`         fi      else         log "PASS:	$i"         glob_countok=`expr $glob_countok + 1`      fi      clean_dir   donedonedisplay "		=== acats Summary ==="display "# of expected passes		$glob_countok"display "# of unexpected failures	`expr $glob_countn - $glob_countok`"if [ $glob_countu -ne 0 ]; then   display "# of unsupported tests		$glob_countu"fiif [ $glob_countok -ne $glob_countn ]; then   display "*** FAILURES: $failed"fiexit 0

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?