cxxpi.sh 1.17 KB
Newer Older
Philip Carns's avatar
Philip Carns committed
1 2 3 4 5 6 7 8 9
#!/bin/bash

PROG=cxxpi

# set log file path; remove previous log if present
export DARSHAN_LOGFILE=$DARSHAN_TMP/${PROG}.darshan.gz
rm -f ${DARSHAN_LOGFILE}

# compile
10
$DARSHAN_CXX $DARSHAN_TESTDIR/test-cases/src/${PROG}.cxx -o $DARSHAN_TMP/${PROG}
Philip Carns's avatar
Philip Carns committed
11 12 13 14 15 16
if [ $? -ne 0 ]; then
    echo "Error: failed to compile ${PROG}" 1>&2
    exit 1
fi

# execute
Philip Carns's avatar
Philip Carns committed
17
$DARSHAN_RUNJOB $DARSHAN_TMP/${PROG}
Philip Carns's avatar
Philip Carns committed
18 19 20 21 22 23
if [ $? -ne 0 ]; then
    echo "Error: failed to execute ${PROG}" 1>&2
    exit 1
fi

# parse log
24
$DARSHAN_PATH/bin/darshan-posix-parser $DARSHAN_LOGFILE > $DARSHAN_TMP/${PROG}.darshan.txt
Philip Carns's avatar
Philip Carns committed
25 26 27 28 29 30 31
if [ $? -ne 0 ]; then
    echo "Error: failed to parse ${DARSHAN_LOGFILE}" 1>&2
    exit 1
fi

# check results
# in this case we want to confirm that the open counts are zero; cxxpi does not do any IO
32 33 34 35 36 37
#POSIX_OPENS=`grep CP_POSIX_OPENS $DARSHAN_TMP/${PROG}.darshan.txt |cut -f 4`
#if [ "$POSIX_OPENS"x != ""x ]; then
#    echo "Error: Found unexpected POSIX open count of $POSIX_OPENS" 1>&2
#    exit 1
#fi
POSIX_OPENS=`grep POSIX_OPENS $DARSHAN_TMP/${PROG}.darshan.txt |cut -d : -f 2 |xargs`
Philip Carns's avatar
Philip Carns committed
38
if [ "$POSIX_OPENS"x != ""x ]; then
Philip Carns's avatar
Philip Carns committed
39 40 41 42
    echo "Error: Found unexpected POSIX open count of $POSIX_OPENS" 1>&2
    exit 1
fi

43

Philip Carns's avatar
Philip Carns committed
44
exit 0