run-all.sh 1.44 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 46
# set up environment for tests according to platform
source $DARSHAN_TESTDIR/$DARSHAN_PLATFORM/env.sh
Philip Carns's avatar
Philip Carns committed
47

Philip Carns's avatar
Philip Carns committed
48
for i in `ls $DARSHAN_TESTDIR/test-cases/*.sh`; do
Philip Carns's avatar
Philip Carns committed
49
    echo Running ${i}...
50
    $i
Philip Carns's avatar
Philip Carns committed
51
    if [ $? -ne 0 ]; then
52 53 54
        echo "Error: failed to execute test case $i"
        exit 1
    fi
Philip Carns's avatar
Philip Carns committed
55
    echo Done.
56 57
done

58
exit 0