Commit 76c86577 authored by Philip Carns's avatar Philip Carns

stub regression test for stdio module

parent 96247ec9
......@@ -421,6 +421,7 @@ static void stdio_get_output_data(
void **stdio_buf,
int *stdio_buf_sz)
{
/* TODO: implement reduction operator */
assert(stdio_runtime);
......
/*
* (C) 1995-2001 Clemson University and Argonne National Laboratory.
*
* See COPYING in top-level directory.
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/time.h>
#include <mpi.h>
#include <errno.h>
#include <getopt.h>
/* DEFAULT VALUES FOR OPTIONS */
static char opt_file[256] = "test.out";
/* function prototypes */
static int parse_args(int argc, char **argv);
static void usage(void);
/* global vars */
static int mynod = 0;
static int nprocs = 1;
int main(int argc, char **argv)
{
int namelen;
char processor_name[MPI_MAX_PROCESSOR_NAME];
FILE *file;
/* startup MPI and determine the rank of this process */
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &mynod);
MPI_Get_processor_name(processor_name, &namelen);
/* parse the command line arguments */
parse_args(argc, argv);
if (mynod == 0) printf("# Using stdio calls.\n");
file = fopen(opt_file, "w");
if(!file)
{
perror("fopen");
return(-1);
}
fclose(file);
MPI_Finalize();
return(0);
}
static int parse_args(int argc, char **argv)
{
int c;
while ((c = getopt(argc, argv, "f:")) != EOF) {
switch (c) {
case 'f': /* filename */
strncpy(opt_file, optarg, 255);
break;
case '?': /* unknown */
if (mynod == 0)
usage();
exit(1);
default:
break;
}
}
return(0);
}
static void usage(void)
{
printf("Usage: stdio-test [<OPTIONS>...]\n");
printf("\n<OPTIONS> is one of\n");
printf(" -f filename [default: /foo/test.out]\n");
printf(" -h print this help\n");
}
/*
* Local variables:
* c-indent-level: 3
* c-basic-offset: 3
* tab-width: 3
*
* vim: ts=3
* End:
*/
#!/bin/bash
PROG=stdio-test
# set log file path; remove previous log if present
export DARSHAN_LOGFILE=$DARSHAN_TMP/${PROG}.darshan
rm -f ${DARSHAN_LOGFILE}
# compile
$DARSHAN_CC $DARSHAN_TESTDIR/test-cases/src/${PROG}.c -o $DARSHAN_TMP/${PROG}
if [ $? -ne 0 ]; then
echo "Error: failed to compile ${PROG}" 1>&2
exit 1
fi
# execute
$DARSHAN_RUNJOB $DARSHAN_TMP/${PROG} -f $DARSHAN_TMP/${PROG}.tmp.dat
if [ $? -ne 0 ]; then
echo "Error: failed to execute ${PROG}" 1>&2
exit 1
fi
# parse log
$DARSHAN_PATH/bin/darshan-parser $DARSHAN_LOGFILE > $DARSHAN_TMP/${PROG}.darshan.txt
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 STDIO counters were triggered
# TODO: change this to check aggregate counters; for now we tail -n 1 to get
# one counter because there is no reduction operator for the stdio module yet
STDIO_OPENS=`grep STDIO_FOPENS $DARSHAN_TMP/${PROG}.darshan.txt |tail -n 1 |cut -f 5`
if [ ! "$STDIO_OPENS" -gt 0 ]; then
echo "Error: STDIO open count of $STDIO_FOPENS is incorrect" 1>&2
exit 1
fi
exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment