#!/bin/csh
#
#   This does not work in the new nightly test system yet.  
#
# ************************************************************************
# 
#                 Amesos: Direct Sparse Solver Package
#                 Copyright (2004) Sandia Corporation
# 
# Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
# license for use of this work by or on behalf of the U.S. Government.
# 
# This library is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of the
# License, or (at your option) any later version.
#  
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#  
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
# Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
# 
# ************************************************************************
#
#  This test is enabled by --enable-coverage
#  It will only work if "-fprofile-arcs -ftest-coverage -O0" is added
#  to CFLAGS, FFLAGS and CXXFLAGS - the latter is typically done with 
#  --with-cxxflags="-DLAM_BUILDING -fprofile-arcs -ftest-coverage -O0" 
#
#  This test counts the numbers of source code lines which are covered by 
#  nightly tests.  If the number of source code lines which are covered by
#  the nightly tests performed on this run is smaller than a set number, 
#  given in the last line of this script, this test will fail.
#
#  This name of this test is prefixed by ZZZ_ so that it will execute after
#  all the other tests.
#
#  This test should be run only with all third party libraries included - to 
#  allow as many lines as possible to be executed by the tests.
#
#  This test is not compatible with --enable-valgrind
#
#

# $1 - Used only for automated testing.  No action required by script owner.
#      This parameter names the subdirectory from which the script is being
#      run.  This assists a developer in figuring out which tests failed.
# $2 - Indicates if the test is an automated nightly test.  No action required
#      by script owner.

set error = None
set AnError = False
set printexitvalue
if( "$2" == "True" ) then # $2 is an optional parameter indicating if 
			  # this is an automated test or not
    # file2 is the log that is created and put into a results email if 
    # errors occur.
    set file2 = ../../../../logMpiErrors.txt
    rm -f $file2
    # Echo some important information into the log file to help developers
    # figure out which tests failed.
    #'file' is a shorter log that is retained even if all tests pass.
    set file = ../../../../log`eval uname`.txt
    rm -f $file
## IMPORTANT: Specify the script owner(s) on the following line
## For one owner type "owner@abc.com", for multiple owners
## "owner1@abc.com, owner2@def.com"
    echo "kstanley@cs.utk.edu" >>& $file
    echo "Script owner(s) is listed on the previous line." >>& $file
else
    cd ../../../
    set file = log_mpi_`eval date +%d%b%Y_%H%M%S`
    rm -f $file
endif
echo $file
echo "Date: " `eval date` >>& $file
echo `uname -a` >>& $file
#
#  the number following the -m switch is the number of lines in the /src 
#  directory that we expect this test to cover.
#
Test_Basic/count_coverage -m 2978 -t test ../src >$file


