mirror of https://gitlab.com/QEF/q-e.git
66 lines
1.6 KiB
Bash
Executable File
66 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# check directories given as arguments, current directory if none
|
|
if test $# = 0 ; then args="." ; else args="$@"; fi
|
|
|
|
# pwdiff.sh must be in the same directory as this script
|
|
dir=`echo $0 | sed 's/\(.*\)\/.*/\1/'` # extract pathname
|
|
pwdiff=$dir/pwdiff.sh
|
|
if test ! -x "$pwdiff"
|
|
then
|
|
echo error: file pwdiff.sh not found or not executable
|
|
exit -1
|
|
fi
|
|
|
|
n_wrong=0
|
|
for dir in $args
|
|
do
|
|
# check working directory
|
|
if test -d "$dir"
|
|
then
|
|
EXAMPLEDIR=`cd $dir; pwd`
|
|
else
|
|
echo error: directory $dir not found
|
|
exit -1
|
|
fi
|
|
echo checking directory $EXAMPLEDIR...
|
|
|
|
# look for output files in reference
|
|
if test ! -d $EXAMPLEDIR/reference
|
|
then
|
|
echo error: reference directory not found in $EXAMPLEDIR
|
|
exit -1
|
|
fi
|
|
output=`ls $EXAMPLEDIR/reference | grep ".out\$"`
|
|
|
|
# check output files
|
|
wrong=""
|
|
for file in $output
|
|
do
|
|
echo " "checking $file...
|
|
if ! $pwdiff $EXAMPLEDIR/reference/$file $EXAMPLEDIR/results/$file
|
|
then
|
|
wrong="$wrong $file"
|
|
let n_wrong=n_wrong+1
|
|
fi
|
|
done
|
|
|
|
# print statistics
|
|
if test "$wrong" = ""
|
|
then
|
|
echo directory $EXAMPLEDIR: success
|
|
else
|
|
echo ------------------------------------------------------------
|
|
echo WARNING: in directory $EXAMPLEDIR:
|
|
echo WARNING: the following files do not match reference outputs:
|
|
( cd $EXAMPLEDIR/reference; ls $wrong ) # use ls' paging ability
|
|
fi
|
|
done
|
|
|
|
if test "$n_wrong" -gt 0
|
|
then
|
|
echo ------------------------------------------------------------
|
|
echo WARNING: total number of non-matching files: $n_wrong
|
|
fi
|
|
exit $n_wrong
|