run-all.sh 2.09 KB
Newer Older
1 2 3
#!/bin/bash

if [ "$#" -ne 3 ]; then
4 5
    echo "Usage: run-all.sh <darshan_install_path> <tmp_path> <platform>" 1>&2
    echo "Example: ./run-all.sh ~/darshan-install /tmp/test ws" 1>&2
6 7 8 9 10 11 12
    exit 1
fi

# set variables for use by other sub-scripts
export DARSHAN_PATH=$1
export DARSHAN_TMP=$2
export DARSHAN_PLATFORM=$3
Philip Carns's avatar
Philip Carns committed
13 14
# number of procs that most test jobs will use
export DARSHAN_DEFAULT_NPROCS=4
15

Philip Carns's avatar
Philip Carns committed
16 17
DARSHAN_TESTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
export DARSHAN_TESTDIR
Philip Carns's avatar
Philip Carns committed
18

19 20
# check darshan path
if [ ! -x $DARSHAN_PATH/bin/darshan-parser ]; then
21
    echo "Error: $DARSHAN_PATH doesn't contain a valid Darshan install." 1>&2
22 23 24 25 26 27 28 29 30
    exit 1
fi

# check and/or create tmp path
if [ ! -d $DARSHAN_TMP ]; then
    mkdir -p $DARSHAN_TMP
fi

if [ ! -d $DARSHAN_TMP ]; then
31
    echo "Error: unable to find or create $DARSHAN_TMP" 1>&2
32 33 34
    exit 1
fi
if [ ! -w $DARSHAN_TMP ]; then
35
    echo "Error: unable to write to $DARSHAN_TMP" 1>&2
36 37 38 39
    exit 1
fi

# make sure that we have sub-scripts for the specified platform
Philip Carns's avatar
Philip Carns committed
40
if [ ! -d $DARSHAN_TESTDIR/$DARSHAN_PLATFORM ]; then
41
    echo "Error: unable to find scripts for platform $DARSHAN_PLATFORM" 1>&2
42 43 44
    exit 1
fi

45
# set up c compiler for this platform
Philip Carns's avatar
Philip Carns committed
46
DARSHAN_CC=`$DARSHAN_TESTDIR/$DARSHAN_PLATFORM/setup-cc.sh`
Philip Carns's avatar
Philip Carns committed
47
if [ $? -ne 0 ]; then
48 49 50 51
    exit 1
fi
export DARSHAN_CC

Philip Carns's avatar
Philip Carns committed
52
# set up c++ compiler for this platform
Philip Carns's avatar
Philip Carns committed
53
DARSHAN_CXX=`$DARSHAN_TESTDIR/$DARSHAN_PLATFORM/setup-cxx.sh`
Philip Carns's avatar
Philip Carns committed
54 55 56 57 58
if [ $? -ne 0 ]; then
    exit 1
fi
export DARSHAN_CXX

Philip Carns's avatar
Philip Carns committed
59
# set up Fortran compilers for this platform
Philip Carns's avatar
Philip Carns committed
60
DARSHAN_F77=`$DARSHAN_TESTDIR/$DARSHAN_PLATFORM/setup-f77.sh`
Philip Carns's avatar
Philip Carns committed
61 62 63 64
if [ $? -ne 0 ]; then
    exit 1
fi
export DARSHAN_F77
Philip Carns's avatar
Philip Carns committed
65
DARSHAN_F90=`$DARSHAN_TESTDIR/$DARSHAN_PLATFORM/setup-f90.sh`
Philip Carns's avatar
Philip Carns committed
66 67 68 69 70
if [ $? -ne 0 ]; then
    exit 1
fi
export DARSHAN_F90

Philip Carns's avatar
Philip Carns committed
71
# set up job execution wrapper for this platform
Philip Carns's avatar
Philip Carns committed
72
DARSHAN_RUNJOB=`$DARSHAN_TESTDIR/$DARSHAN_PLATFORM/setup-runjob.sh`
Philip Carns's avatar
Philip Carns committed
73
if [ $? -ne 0 ]; then
Philip Carns's avatar
Philip Carns committed
74 75 76 77
    exit 1
fi
export DARSHAN_RUNJOB

Philip Carns's avatar
Philip Carns committed
78
for i in `ls $DARSHAN_TESTDIR/test-cases/*.sh`; do
Philip Carns's avatar
Philip Carns committed
79
    echo Running ${i}...
80
    $i
Philip Carns's avatar
Philip Carns committed
81
    if [ $? -ne 0 ]; then
82 83 84
        echo "Error: failed to execute test case $i"
        exit 1
    fi
Philip Carns's avatar
Philip Carns committed
85
    echo Done.
86 87
done

88
exit 0