"Fossies" - the Fresh Open Source Software Archive

Member "mvapich2-2.3.2/maint/createcoverage" (9 Aug 2019, 11313 Bytes) of package /linux/misc/mvapich2-2.3.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "createcoverage": 2.3.1_vs_2.3.2.

    1 #! /bin/sh
    2 #
    3 # Get coverage information for mpich
    4 #
    5 #set -x
    6 # The default approach is to prepare the coverage for this MPICH 
    7 # distribution and to place the coverage web pages into a 
    8 # (mpichsrc)/www/coverage
    9 srcdir=/tmp/eQWZy4yujG/mvapich2-2.3.2
   10 tsuites=$srcdir/tests/mpi
   11 weblocbase=$srcdir/www/coverage
   12 weblocprefix=""
   13 blddir=/tmp/$LOGNAME/mpich-cov
   14 mpiinstalldir=/tmp/$LOGNAME/mpich-cinst
   15 
   16 logfile=""
   17 #pm=gforker
   18 pm=hydra
   19 # device and channel
   20 # (we'll also want this to be in the path)
   21 device="ch3:sock"
   22 
   23 test_intel=yes
   24 test_mpich=yes
   25 test_mpich1=yes
   26 test_cxx=yes
   27 test_io=yes
   28 testNames="intel mpich1 mpich cxx io"
   29 build_mpich=yes
   30 alltest=yes
   31 update_web=yes
   32 quiet=no
   33 #
   34 # Process args to see if we are running only a subset of the steps, 
   35 # for example, to rerun a test suite
   36 for arg ; do 
   37     # Extract option, if any
   38     case $arg in 
   39     *=*)
   40     option=`echo A$arg | sed -e 's/^[^=]*=//'`
   41     ;;
   42     *)
   43     option=""
   44     ;;
   45     esac
   46 
   47     case $arg in 
   48     -nobuild)
   49     build_mpich=no
   50     ;;
   51 
   52     -quiet)
   53     quiet=yes
   54     ;;
   55 
   56     -logfile=*)
   57     logfile=$option
   58     ;;
   59 
   60     -srcdir=*)
   61     srcdir=$option
   62     ;;
   63 
   64     -device=*)
   65     device=$option
   66     ;;
   67 
   68     -pm=*)
   69     pm=$option
   70     ;; 
   71 
   72     -test=*)
   73     if [ $alltest = yes ] ; then
   74         alltest=no
   75     test_intel=no
   76     test_mpich1=no
   77     test_mpich=no
   78     test_io=no
   79     test_cxx=no
   80     fi
   81     name=`echo A$arg | sed -e 's/A-test=//'`
   82     eval test_$name=yes
   83     ;;
   84 
   85     -notest=*)
   86     # Turn off just one test
   87     alltest=no
   88     name=`echo A$arg | sed -e 's/A-notest=//'`
   89     eval test_$name=no
   90     ;;
   91     
   92     -notest)
   93     alltest=no
   94     test_intel=no
   95     test_mpich1=no
   96     test_mpich=no
   97     test_io=no
   98     test_cxx=no
   99     ;;
  100 
  101     -blddir=*)
  102     blddir=`echo A$arg | sed -e 's/A-blddir=//'`
  103     ;;
  104 
  105     -noupdateweb)
  106     update_web=no
  107     ;;
  108     -updateweb)
  109     update_web=yes
  110     ;;
  111     -webdir)
  112     weblocbase=$option
  113     ;;
  114 
  115     -help)
  116     cat <<EOF
  117 createcoverage [ -srcdir=sourcedir ] [ -blddir=builddir ] 
  118                [ -test=onetest ] [ -notest=skiptest ]
  119                [ -device=device ] [ -nobuild ] [ -quiet ] [ -pm=pm ]
  120                [ -[no]updateweb ] [ -webdir=webdir ]
  121      sourcedir   - Directory containing the source  for MPICH.
  122                    Default is $srcdir
  123      blddir      - Directory where the coverage tests should be built.
  124                    Default is $blddir
  125      onetest     - Run only this test suite.  Available tests are
  126                    $testNames
  127      skiptest    - Skip this test suite.
  128      device      - Device to test.  Default is $device
  129      pm          - Select the process manager.  Default is $pm
  130      -updateweb  - Update the web page containing the single file listing
  131                    at $weblocbase/$device/coverage.txt
  132      webdir      - Directory into which to place the web pages.
  133                    The default is $weblocbase 
  134                    (the final directory is webdir/$device ).
  135 EOF
  136     exit 1;
  137     ;;
  138 
  139     *)
  140     echo "Argument $arg unrecognized"
  141     ;;
  142 
  143     esac
  144 done
  145 
  146 # Move everthing into a device-specific directory
  147 webloc="$weblocbase/$device"
  148 if [ "$update_web" = yes ] ; then
  149     if [ ! -d $webloc ] ; then mkdir -p $webloc ; fi
  150 fi
  151 #
  152 # Set the derived directories
  153 annotedir=$webloc
  154 if [ -n "$weblocprefix" ] ; then
  155     # Only add device to the location if we are not using relative paths
  156     # for the web pages
  157     annotewebprefix="$weblocprefix/$device"
  158 fi
  159 annoteindex=$webloc/index.htm
  160 # Locations of the test directories
  161 mpichsrcdir=$srcdir/Test/mpi
  162 intelsrcdir=$tsuites/IntelMPITEST
  163 mpich1srcdir=$tsuites/mpich1test
  164 cxxsrcdir=$tsuites/mpicxxtest
  165 iosrcdir=$tsuites/Testmpio
  166 
  167 # For each of the tests selected, turn off those for which the 
  168 # test source directories are not available
  169 for test in $testNames ; do
  170     eval t="test_$test"
  171     eval tval=\$$t
  172     if [ "$tval" = yes ] ; then
  173         eval tloc=\$${test}srcdir
  174         if [ ! -d "$tloc" ] ; then
  175             echo "Turning off test $test because test source directory $tloc is not available"
  176         eval $t=no
  177         fi
  178     fi
  179 done
  180 
  181 # Compute the appropriate device directories
  182 # Base directories
  183 case $device in
  184     ch3|ch3:nemesis)
  185     devsrcdirs="src/mpid/ch3/channels/nemesis/src src/mpid/ch3/src src/mpid/ch3/channels/nemesis/netmod/tcp src/mpid/ch3/channels/nemesis/netmod/none"
  186     extra_opts="$extra_opts --enable-nemesis-dbg-localoddeven"
  187     ;;
  188     ch3:sock)
  189     devsrcdirs="src/mpid/ch3/channels/sock/src src/mpid/ch3/src src/mpid/common/sock/poll src/mpid/ch3/util/sock"
  190     ;;
  191     ch3*)
  192     devsrcdirs="src/mpid/ch3/src"
  193     ;;
  194     *)
  195     if [ -d "$srcdir/src/mpid/$device" ] ; then
  196         devsrcdirs="src/mpid/$device"
  197     fi
  198     ;;
  199 esac
  200 
  201 # Set a timeout for mpiexec just in case
  202 MPIEXEC_TIMEOUT=180
  203 export MPIEXEC_TIMEOUT
  204 #
  205 # We use fd 6 to redirect output.  If we have selected "-quiet", this
  206 # sends stdout to /dev/null 
  207 if [ "$quiet" = yes ] ; then
  208     exec 6>/dev/null
  209 elif [ -n "$logfile" ] ; then
  210     exec 6>$logfile
  211 else
  212     set -x
  213     exec 6>&1
  214 fi
  215 
  216 if [ ! -d $blddir ] ; then
  217     # Try to build it
  218     mkdir $blddir
  219 fi
  220 if [ ! -d $blddir ] ; then
  221     echo "$blddir does not exist" 
  222     echo "Create it and rerun this script"
  223     exit 1
  224 fi
  225 
  226 # Build with the coverage options
  227 if [ $build_mpich = yes ] ; then
  228     echo "------ Build MPICH ------" >&6
  229     cd $blddir
  230     $srcdir/configure --enable-coverage --with-pm=$pm --enable-romio \
  231             --with-device=$device \
  232           -prefix=$mpiinstalldir $extra_opts >&6 2>&6
  233     rc=$?
  234     if [ "$rc" != 0 ] ; then 
  235     echo "$srcdir/configure failed with return code $rc"
  236     exit 1
  237     fi
  238     make clean >&6 2>&6
  239     # Make sure that we clean away any old results
  240     find . -name '*.bb' -o -name '*.bbg' -o -name '*.da' -print | \
  241     xargs -r rm -f
  242     find . -name '*.gcov' -print | xargs -r rm -f
  243     rm -f lib/*
  244     make >&6 2>&6
  245     rc=$?
  246     if [ "$rc" != 0 ] ; then
  247         echo "Make step failed with return code $rc"
  248     exit 1
  249     fi
  250     echo "------ Install MPICH ------" >&6
  251     make install >&6 2>&6
  252     rc=$?
  253     if [ "$rc" != 0 ] ; then
  254     echo "Make install step failed with return code $rc"
  255         exit 1
  256     fi
  257     echo "------ End of Install MPICH ------" >&6
  258 fi
  259 #
  260 # Run the tests
  261 if [ $test_mpich = yes ] ; then
  262     # The mpich tests are easy
  263     echo "------ Run MPICH Tests ------" >&6
  264     cd $blddir
  265     make testing >&6 2>&6
  266     echo "------ End Run MPICH Tests ------" >&6
  267 fi
  268 
  269 if [ ! -d $blddir/othertest ] ; then
  270     mkdir $blddir/othertest
  271 fi
  272 for dir in intel cxx mpich1 Testmpio ; do
  273     if [ ! -d $blddir/othertest/$dir ] ; then
  274         mkdir $blddir/othertest/$dir 
  275     fi
  276 done
  277 
  278 if [ $test_intel = yes ] ; then
  279     echo "------ Run Intel Tests ------" >&6
  280     # The intel tests aren't hard
  281 
  282     cd $blddir/othertest/intel
  283     $intelsrcdir/configure --enable-coverage \
  284     --with-mpich=$mpiinstalldir >&6 2>&6
  285     make clean >&6 2>&6
  286     make testing >&6 2>&6
  287     echo "------ End Run Intel Tests ------" >&6
  288 fi
  289 
  290 if [ $test_cxx = yes ] ; then
  291     echo "------ Run C++ Tests ------" >&6
  292     # Neither are the cxx test
  293     # Build mpicxxtest --enable-coverage (still need to implement)
  294     cd $blddir/othertest/cxx
  295     $cxxsrcdir/configure --enable-coverage --with-mpich=$mpiinstalldir \
  296     --enable-xml  >&6 2>&6
  297     make clean >&6 2>&6
  298     make testing >&6 2>&6
  299     echo "------ End Run C++ Tests ------" >&6
  300 fi
  301 
  302 if [ $test_io = yes ] ; then
  303     echo "------ Run MPI-IO Tests ------" >&6
  304     # These tests do not even have a configure or make!
  305     cd $blddir/othertest/Testmpio
  306     $mpiinstalldir/bin/mpicc -o testmpio $iosrcdir/testmpio.c >&6 2>&6
  307     if [ ! -x testmpio ] ; then
  308     echo "Unable to build MPI-IO test testmpio.  See log file $logfile for reason (build attempted in $blddir/othertest/Testmpio)"
  309     else
  310         if [ ! -d t1 ] ; then mkdir t1 ; fi
  311         MPIO_USER_PATH=`pwd`/t1
  312         export MPIO_USER_PATH
  313         $mpiinstalldir/bin/mpiexec -n 4 ./testmpio 1 >&6 2>&6
  314     fi
  315     echo "------ End Run MPI-IO Tests ------" >&6
  316 fi
  317 
  318 if [ $test_mpich1 = yes ] ; then
  319     echo "------ Run MPICH-1 Tests ------" >&6
  320     # Nor are the mpich1 tests
  321     # Build mpich tests --enable-coverage
  322     #   Need to provide a target that does not do the "runtest -check" step,
  323     #   since there may be output about "Can't read output file foo.da"
  324     cd $blddir/othertest/mpich1
  325     MPIRUN=$mpiinstalldir/bin/mpiexec
  326     export MPIRUN
  327     MPITEST_IGNORE_RUNTEST=yes
  328     export MPITEST_IGNORE_RUNTEST
  329     $mpich1srcdir/configure --enable-coverage -cc=$mpiinstalldir/bin/mpicc \
  330             -fc=$mpiinstalldir/bin/mpifort --enable-io \
  331             -mpilibname=mpich \
  332             -prefix=$mpiinstalldir >&6 2>&6
  333     make clean  >&6 2>&6
  334     make testing >&6 2>&6
  335     echo "------ End Run MPICH-1 Tests ------" >&6
  336 fi
  337 
  338 # Now create the summary
  339 echo "------ Collect Coverage Information ------" >&6
  340 cd $blddir
  341 # Ignore the output from gcov
  342 make coverage >/dev/null 2>&1
  343 rc=$?
  344 if [ "$rc" != 0 ] ; then
  345     echo "Make coverage step failed with return code $rc"
  346 fi
  347 #
  348 # The following list of directories gets the following:
  349 #  All of the top-level MPI routines (src/mpi and src/util/info)
  350 #  Support routines for nameservice using the file option (src/nameserv/file)
  351 #  Support routines for datatypes
  352 #  Basic implementation of the channel device.  This is included
  353 #  because some of the top-level MPI routines just push operations down
  354 #  to the device (e.g., MPI_Put).  src/mpid/ch3/src contains the "common"
  355 #  code for the channel devices, so it is reasonable to try for good
  356 #  coverage of this code as well.
  357 # annoteindex is not used with 
  358 rm -f coverage.txt
  359 if [ "$update_web" = yes ] ; then
  360     # Clean out the old annotated files
  361     if [ -d "$annotedir/src" ] ; then
  362     (cd $annotedir/src && \
  363         find . -name '*.c.htm' -ctime +2 -print | \
  364         xargs -r rm -f )
  365     fi
  366     $srcdir/maint/getcoverage -annote=$annotedir \
  367     -annoteweb=$annotewebprefix \
  368     -indexdir=$annotedir \
  369     src/mpi src/util/info src/nameserv/file \
  370     src/mpid/common/datatype \
  371         $devsrcdirs \
  372         src/pmi/simple src/binding/f77 src/binding/cxx > coverage.txt
  373 else 
  374     $srcdir/maint/getcoverage \
  375     src/mpi src/util/info src/nameserv/file \
  376     src/mpid/common/datatype \
  377     $devsrcdirs \
  378         src/pmi/simple src/binding/f77 src/binding/cxx > coverage.txt
  379 fi
  380 # The coverage data is in the build dir ($blddir).
  381 echo "------ End Collect Coverage Information ------" >&6
  382 if [ "$update_web" = yes ] ; then
  383     if [ -d $webloc ] ; then 
  384         rm -f $webloc/coverage.txt
  385         cp coverage.txt $webloc/coverage.txt
  386     else
  387         echo "Unable to access $webloc to install coverage output"
  388     fi
  389     # Make the logfile available on the web page
  390     if [ -n "$logfile" -a -s "$logfile" ] ; then
  391     rm -f $webloc/cov-logfile.txt
  392     cp $logfile $webloc/cov-logfile.txt
  393     fi
  394 fi
  395 #
  396 # From mpich build directory:
  397 # make coverage >/dev/null 2>&1
  398 #   The above step creates the *.gcov files
  399 # maint/getcoverage.in src/mpi/*.gcov src/util/info/*.gcov \
  400 #   src/mpid/ch3/src/*.gcov src/mpid/ch3/channels/sock/src/*.gcov etc. \
  401 #    > coverage.txt
  402 #
  403 # The above generates a file that shows each missed executable line, along
  404 # with some context (the two lines preceding the missed line).
  405 #
  406 # It doesn't get all of the files; for example, it misses others in util
  407 # (e.g., util/mem), and it misses all of ROMIO because of the file 
  408 # structure of ROMIO (src/mpi/romio/{adio|mpi-io}/*.gcov).