<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>
GitLab
</title>

</head>
<body>
<style type="text/css">
img {
max-width: 100%; height: auto;
}
</style>
<div class="content">
<h3>
Philip Carns pushed to branch dev-stdio
at <a href="https://xgitlab.cels.anl.gov/darshan/darshan">darshan / darshan</a>
</h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/76c86577231f54e29a9eace34bf026f4038f61c7">76c86577</a></strong>
<div>
<span>by Phil Carns</span>
<i>at 2016-05-01T08:20:31-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap">stub regression test for stdio module</pre>
</li>
</ul>
<h4>3 changed files:</h4>
<ul>
<li class="file-stats">
<a href="#620f2ecad2bb6f74b2fcd0134963a841" style="text-decoration: none">
darshan-runtime/lib/darshan-stdio.c
</a>
</li>
<li class="file-stats">
<a href="#ad29afc395839758d41094872298bd0d" style="text-decoration: none">
<span class="new-file" style="color: #090">
+
darshan-test/regression/test-cases/src/stdio-test.c
</span>
</a>
</li>
<li class="file-stats">
<a href="#c0b0bf6d71bc5fc7e6d50d69c8aa2413" style="text-decoration: none">
<span class="new-file" style="color: #090">
+
darshan-test/regression/test-cases/stdio-test.sh
</span>
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id="620f2ecad2bb6f74b2fcd0134963a841">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/76c86577231f54e29a9eace34bf026f4038f61c7#diff-0">
<strong>
darshan-runtime/lib/darshan-stdio.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-runtime/lib/darshan-stdio.c
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-runtime/lib/darshan-stdio.c
</span><span style="color: #aaaaaa">@@ -421,6 +421,7 @@ static void stdio_get_output_data(
</span>     void **stdio_buf,
     int *stdio_buf_sz)
 {
<span style="background: #ddffdd; color: #000000">+    /* TODO: implement reduction operator */
</span> 
     assert(stdio_runtime);
 
</code></pre>

<br>
</li>
<li id="ad29afc395839758d41094872298bd0d">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/76c86577231f54e29a9eace34bf026f4038f61c7#diff-1">
<strong>
darshan-test/regression/test-cases/src/stdio-test.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- /dev/null
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-test/regression/test-cases/src/stdio-test.c
</span><span style="color: #aaaaaa">@@ -0,0 +1,97 @@
</span><span style="background: #ddffdd; color: #000000">+/*
+ * (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:
+ */ 
+
+
</span></code></pre>

<br>
</li>
<li id="c0b0bf6d71bc5fc7e6d50d69c8aa2413">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/76c86577231f54e29a9eace34bf026f4038f61c7#diff-2">
<strong>
darshan-test/regression/test-cases/stdio-test.sh
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- /dev/null
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-test/regression/test-cases/stdio-test.sh
</span><span style="color: #aaaaaa">@@ -0,0 +1,40 @@
</span><span style="background: #ddffdd; color: #000000">+#!/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
</span></code></pre>

<br>
</li>

</div>
<div class="footer" style="margin-top: 10px">
<p style="color: #777; font-size: small">

<br>
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/76c86577231f54e29a9eace34bf026f4038f61c7">View it on GitLab</a>.
<br>
You're receiving this email because of your account on xgitlab.cels.anl.gov.
If you'd like to receive fewer emails, you can
adjust your notification settings.

</p>
</div>
</body>
</html>