run-all.sh 1.57 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
# check darshan path
20
if [ ! -x $DARSHAN_PATH/bin/darshan-posix-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

48 49
failure_count=0

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

60 61 62 63 64 65
if [ "$failure_count" -eq 0 ]; then
	exit 0
else
	echo $failure_count tests failed
	exit 1
fi