#!/bin/csh
# Motif
#
# Copyright (c) 1987-2012, The Open Group. All rights reserved.
#
# These libraries and programs are free software; you can
# redistribute them and/or modify them under the terms of the GNU
# Lesser General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# These libraries and programs are distributed in the hope that
# they 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 these librararies and programs; if not, write
# to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
# Floor, Boston, MA 02110-1301 USA
#
# HISTORY
#
# RUN.smoke
#
# Script to run nightly smoke tests
#
# a known restriction of this script is that the arguments to -xrm (or
# any other flag!) must contain no spaces.
#
# XFILESEARCHPATH mechanism for using the defaults file in each directory.
# First check to see if the variable is already set. If it is, save it.
# The, set XFILESEARCHPATH to $cwd/$cwd:t.defaults.
#
printenv XFILESEARCHPATH
if ($status == 0) then
Storepath = $XFILESEARCHPATH
pathExists = true
endif
setenv XFILESEARCHPATH $cwd/$cwd:t.defaults
# default vars
# The following are report generation related RUN variables.
# The format for specifying will be as follows:
#
# RUN.smoke -genrep <report_switch>
# -Dir - Generates a directory level report
# -test - Generates a test level report
# -panel - Generates a panel level report
#
#
setenv AUTOVPATH /net/pmin11/u1/automation/output/1.2.1/Toolkit/config
set tests_to_run = ""
set Reportrun = false
set reportInfo = "-dir"
set argcnt = $#argv
set argindex = 1
set in_list = "0"
while ($argcnt != 0)
switch ($argv[$argindex])
case -d*:
@ argcnt--
@ argindex++
setenv DISPLAY $argv[$argindex]
set in_list = "0"
breaksw
case -genrep:
set Reportrun = true
set argv[$argindex] = ""
@ argcnt--
@ argindex++
set reportInfo = $argv[$argindex]
set argv[$argindex] = ""
set in_list = "0"
breaksw
case -list*:
set argv[$argindex] = ""
set in_list = "1"
breaksw
case *:
if ( "$in_list" == "1" ) then
set tests_to_run = "$tests_to_run $argv[$argindex]"
set argv[$argindex] = ""
endif
breaksw
endsw
@ argcnt--
@ argindex++
end
#echo "Tests2run " $tests_to_run
if ("$tests_to_run" == "") then
echo "Usage: RUN.smoke -list <tests_to_run> [-d <display>] [-genrep <rep_type>]"
exit 1
endif
set arglist = "$argv"
# clean up from previous runs
if (-e ./RUN.smoke.failures) then
echo "backing up RUN.smoke.failures file"
mv RUN.smoke.failures RUN.smoke.failures.bak
endif
touch RUN.smoke.failures
if (-e ./RUN.smoke.output) then
echo "backing up output file"
mv RUN.smoke.output RUN.smoke.output.bak
endif
touch RUN.smoke.output
rm -f core
# set the path so that scripts for report generation can be read
set path = (/project/motif/qa/qauser/qatools/auto_rep $path)
# noglob is needed to handle special cases
set noglob
# special cases. Specify ALL flags for tests which require them.
# remember all arguments MUST be a single word (ie no spaces)
# use single quotes around the right side.
foreach test ($tests_to_run)
#echo "Current test " $test
set test =($test)
#echo "Current test1 " $test
foreach word ($test)
if ($?name_flag) then
set test_output = $word
unset name_flag
endif
if ("$word" =~ "-O") then
set name_flag = 1
endif
end
echo "" >> RUN.smoke.output
echo "Beginning test " $test[1] >> RUN.smoke.output
echo "Beginning test " $test[1]
if ($?test_output) then
echo "Output redirected to " $test_output
echo "Output redirected to " $test_output >> RUN.smoke.output
endif
# try to prevent the script from quitting if the test wasn't built
if (-e $test[1]) then
echo "Running " $test $arglist
$test $arglist
if ($status != 0) then
if (-e core) then
echo "backing up core to "$test[1]".core"
mv core $test[1].core
endif
echo "failure in test: "$test[1] >> RUN.smoke.failures
echo "FAILURE IN TEST: "$test[1] >> RUN.smoke.output
echo "FAILURE IN TEST: "$test[1]
endif
else
echo "Error - Test " $test " does not exist."
echo "Error - Test " $test " does not exist" >> RUN.smoke.output
echo "FAILURE IN TEST: "$test[1] >> RUN.smoke.output
echo "FAILURE IN TEST: "$test[1]
continue
endif
echo "Ending test "$test[1]"" >> RUN.smoke.output
echo "" >> RUN.smoke.output
echo "Ending test "$test[1]""
echo ""
unset test_output
end
unset noglob
echo "Automated run of directory" $cwd:t " complete" >> RUN.smoke.output
# if Reportrun is true, generate reports of the appropriate level.
if ($Reportrun == true) then
echo "This is a Report RUN" >> RUN.smoke.output
switch($reportInfo)
case -Dir:
run_dir $cwd -nodiff
breaksw
case -test:
foreach file ($cwd/*.prt)
run_test $file -nodiff
end
breaksw
case -panel:
foreach file ($cwd/*.prt)
run_panel $file -nodiff
end
breaksw
endsw
endif
# Reset XFILESEARCHPATH
if (pathExists == true) then
setenv XFILESEARCHPATH $Storepath
else
unsetenv XFILESEARCHPATH
endif
exit 0