Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Shane Snyder
darshan
Commits
76c86577
Commit
76c86577
authored
May 01, 2016
by
Philip Carns
Browse files
stub regression test for stdio module
parent
96247ec9
Changes
3
Hide whitespace changes
Inline
Side-by-side
darshan-runtime/lib/darshan-stdio.c
View file @
76c86577
...
...
@@ -421,6 +421,7 @@ static void stdio_get_output_data(
void
**
stdio_buf
,
int
*
stdio_buf_sz
)
{
/* TODO: implement reduction operator */
assert
(
stdio_runtime
);
...
...
darshan-test/regression/test-cases/src/stdio-test.c
0 → 100644
View file @
76c86577
/*
* (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:
*/
darshan-test/regression/test-cases/stdio-test.sh
0 → 100755
View file @
76c86577
#!/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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment