diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2021-08-17 19:55:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-17 19:55:18 (GMT) |
commit | c0ef1fd6de3ff20cc8fc49c05ca71254c784bea6 (patch) | |
tree | fb2bdf05e276e3614b3b5c343447cd82f4e6718b /tools/test | |
parent | 2bca2ca6f1ef1b60bb8541413c5f2e68ff5549d3 (diff) | |
download | hdf5-c0ef1fd6de3ff20cc8fc49c05ca71254c784bea6.zip hdf5-c0ef1fd6de3ff20cc8fc49c05ca71254c784bea6.tar.gz hdf5-c0ef1fd6de3ff20cc8fc49c05ca71254c784bea6.tar.bz2 |
Reverts PR 906 and 907 due to binary compatibility issues (#918)
Diffstat (limited to 'tools/test')
-rw-r--r-- | tools/test/h5jam/getub.c | 16 | ||||
-rw-r--r-- | tools/test/h5jam/h5jamgentest.c | 75 | ||||
-rw-r--r-- | tools/test/h5jam/tellub.c | 12 | ||||
-rw-r--r-- | tools/test/perform/chunk.c | 2 | ||||
-rw-r--r-- | tools/test/perform/direct_write_perf.c | 5 | ||||
-rw-r--r-- | tools/test/perform/overhead.c | 6 | ||||
-rw-r--r-- | tools/test/perform/perf.c | 2 | ||||
-rw-r--r-- | tools/test/perform/pio_engine.c | 2 | ||||
-rw-r--r-- | tools/test/perform/pio_perf.c | 296 | ||||
-rw-r--r-- | tools/test/perform/pio_standalone.c | 57 | ||||
-rw-r--r-- | tools/test/perform/pio_standalone.h | 28 | ||||
-rw-r--r-- | tools/test/perform/sio_engine.c | 10 | ||||
-rw-r--r-- | tools/test/perform/sio_perf.c | 356 | ||||
-rw-r--r-- | tools/test/perform/sio_standalone.c | 57 | ||||
-rw-r--r-- | tools/test/perform/sio_standalone.h | 28 | ||||
-rw-r--r-- | tools/test/perform/zip_perf.c | 132 |
16 files changed, 601 insertions, 483 deletions
diff --git a/tools/test/h5jam/getub.c b/tools/test/h5jam/getub.c index eae7f15..a9b4437 100644 --- a/tools/test/h5jam/getub.c +++ b/tools/test/h5jam/getub.c @@ -21,9 +21,9 @@ void parse_command_line(int argc, const char *argv[]); #define PROGRAM_NAME "getub" char *nbytes = NULL; -static const char * s_opts = "c:"; /* add more later ? */ -static struct h5_long_options l_opts[] = {{"c", require_arg, 'c'}, /* input file */ - {NULL, 0, '\0'}}; +static const char * s_opts = "c:"; /* add more later ? */ +static struct long_options l_opts[] = {{"c", require_arg, 'c'}, /* input file */ + {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: usage @@ -57,10 +57,10 @@ parse_command_line(int argc, const char *argv[]) int opt; /* parse command line options */ - while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'c': - nbytes = HDstrdup(H5_optarg); + nbytes = HDstrdup(opt_arg); break; case '?': default: @@ -69,7 +69,7 @@ parse_command_line(int argc, const char *argv[]) } /* end switch */ } /* end while */ - if (argc <= H5_optind) { + if (argc <= opt_ind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); HDexit(EXIT_FAILURE); @@ -100,13 +100,13 @@ main(int argc, const char *argv[]) goto error; } /* end if */ - if (argc <= (H5_optind)) { + if (argc <= (opt_ind)) { error_msg("missing file name\n"); usage(h5tools_getprogname()); goto error; } /* end if */ - filename = HDstrdup(argv[H5_optind]); + filename = HDstrdup(argv[opt_ind]); size = 0; if (EOF == (res = sscanf(nbytes, "%u", &size))) { diff --git a/tools/test/h5jam/h5jamgentest.c b/tools/test/h5jam/h5jamgentest.c index f616c82..1da6b63 100644 --- a/tools/test/h5jam/h5jamgentest.c +++ b/tools/test/h5jam/h5jamgentest.c @@ -31,7 +31,24 @@ #define UBTXT3 "u511.txt" #define UBTXT4 "u512.txt" #define UBTXT5 "u513.txt" +/* not used yet +#define UBTXT6 "u1023.txt" +#define UBTXT7 "u1024.txt" +#define UBTXT8 "u1025.txt" +#define UBTXT9 "u2047.txt" +#define UBTXT10 "u2048.txt" +#define UBTXT11 "u2049.txt" +#define UBBIN1 "u0.dat" +#define UBBIN2 "u10.dat" +#define UBBIN3 "u511.dat" +#define UBBIN4 "u512.dat" +#define UBBIN5 "u513.dat" +*/ +/* not used yet +#define FILE1 "tnull.h5" +#define FILE2 "tnullwithub.h5" +*/ /* tall is same as dumper test */ #define FILE7 "tall.h5" #define FILE8 "twithub.h5" @@ -49,6 +66,17 @@ char pattern[11] = "abcdefghij"; #define BUF_SIZE 1024 +/* Element selection information */ + +typedef enum { RED, GREEN, BLUE, WHITE, BLACK } enumtype; + +/* Compound datatype */ +typedef struct s1_t { + unsigned int a; + unsigned int b; + float c; +} s1_t; + /* A UD link traversal function. Shouldn't actually be called. */ static hid_t UD_traverse(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED cur_group, @@ -280,18 +308,65 @@ create_textfile(const char *name, size_t size) HDclose(fd); } +#ifdef notdef +/* not used yet */ +void +create_binfile(char *name, off_t size) +{ + char *buf; + int fd; + int i; + char *bp; + + fd = creat(name, 0777); + HDassert(fd >= 0); + + buf = HDcalloc(size, 1); + HDassert(buf); + + /* fill buf with pattern */ + bp = buf; + for (i = 0; i < size; i++) + *bp++ = (char)i & 0xff; + + (void)HDwrite(fd, buf, size); + + HDclose(fd); +} +#endif + /*------------------------------------------------------------------------- * Function: main * *------------------------------------------------------------------------- */ + int main(void) { + + /* + create_textfile(UBTXT1, (size_t)0); + */ create_textfile(UBTXT2, (size_t)10); create_textfile(UBTXT3, (size_t)511); create_textfile(UBTXT4, (size_t)512); create_textfile(UBTXT5, (size_t)513); + /* + create_textfile(UBTXT6, (size_t)1023); + create_textfile(UBTXT7, (size_t)1024); + create_textfile(UBTXT8, (size_t)1025); + create_textfile(UBTXT9, (size_t)2047); + create_textfile(UBTXT10, (size_t)2048); + create_textfile(UBTXT11, (size_t)2049); + + create_binfile(UBBIN1, (off_t)0); + create_binfile(UBBIN2, (off_t)10); + create_binfile(UBBIN3, (off_t)511); + create_binfile(UBBIN4, (off_t)512); + create_binfile(UBBIN5, (off_t)513); + + */ gent_ub(FILE7, (size_t)0, (size_t)0); gent_ub(FILE8, (size_t)512, HDstrlen(pattern)); gent_ub(FILE9, (size_t)1024, (size_t)513); diff --git a/tools/test/h5jam/tellub.c b/tools/test/h5jam/tellub.c index e6769ec..45d4af4 100644 --- a/tools/test/h5jam/tellub.c +++ b/tools/test/h5jam/tellub.c @@ -24,8 +24,8 @@ * parameters. The long-named ones can be partially spelled. When * adding more, make sure that they don't clash with each other. */ -static const char * s_opts = "h"; -static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, {NULL, 0, '\0'}}; +static const char * s_opts = "h"; +static struct long_options l_opts[] = {{"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: usage @@ -61,7 +61,7 @@ parse_command_line(int argc, const char *argv[]) int opt; /* parse command line options */ - while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'h': usage(h5tools_getprogname()); @@ -75,7 +75,7 @@ parse_command_line(int argc, const char *argv[]) } /* check for file name to be processed */ - if (argc <= H5_optind) { + if (argc <= opt_ind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); h5tools_setstatus(EXIT_FAILURE); @@ -118,14 +118,14 @@ main(int argc, const char *argv[]) /* enable error reporting if command line option */ h5tools_error_report(); - if (argc <= (H5_optind)) { + if (argc <= (opt_ind)) { error_msg("missing file name\n"); usage(h5tools_getprogname()); h5tools_setstatus(EXIT_FAILURE); goto done; } - ifname = HDstrdup(argv[H5_optind]); + ifname = HDstrdup(argv[opt_ind]); testval = H5Fis_accessible(ifname, H5P_DEFAULT); diff --git a/tools/test/perform/chunk.c b/tools/test/perform/chunk.c index 1b08e95..1b6793a 100644 --- a/tools/test/perform/chunk.c +++ b/tools/test/perform/chunk.c @@ -24,10 +24,12 @@ #undef NDEBUG #include "hdf5.h" +#ifdef H5_STDC_HEADERS #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#endif /* Solaris Studio defines attribute, but for the attributes we need */ #if !defined(H5_HAVE_ATTRIBUTE) || defined __cplusplus || defined(__SUNPRO_C) diff --git a/tools/test/perform/direct_write_perf.c b/tools/test/perform/direct_write_perf.c index 6537215..b3ae54d 100644 --- a/tools/test/perform/direct_write_perf.c +++ b/tools/test/perform/direct_write_perf.c @@ -23,11 +23,14 @@ #if !defined(WIN32) && !defined(__MINGW32__) +#include <math.h> + +#ifdef H5_STDC_HEADERS #include <errno.h> #include <fcntl.h> -#include <math.h> #include <stdio.h> #include <stdlib.h> +#endif #ifdef H5_HAVE_UNISTD_H #include <sys/types.h> diff --git a/tools/test/perform/overhead.c b/tools/test/perform/overhead.c index 60ec8d8..dba8220 100644 --- a/tools/test/perform/overhead.c +++ b/tools/test/perform/overhead.c @@ -23,11 +23,17 @@ #include "hdf5.h" #include "H5private.h" +#ifdef H5_STDC_HEADERS #include <ctype.h> #include <fcntl.h> #include <stdlib.h> #include <sys/stat.h> #include <string.h> +#endif + +#ifdef H5_HAVE_IO_H +#include <io.h> +#endif #ifdef H5_HAVE_UNISTD_H #include <sys/types.h> diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c index a06fb77..bf4b2a9 100644 --- a/tools/test/perform/perf.c +++ b/tools/test/perform/perf.c @@ -26,11 +26,13 @@ #ifdef H5_HAVE_PARALLEL +#ifdef H5_STDC_HEADERS #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#endif #ifdef H5_HAVE_UNISTD_H #include <sys/types.h> diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c index cac36d7..65194b0 100644 --- a/tools/test/perform/pio_engine.c +++ b/tools/test/perform/pio_engine.c @@ -16,10 +16,12 @@ #include "hdf5.h" +#ifdef H5_STDC_HEADERS #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> +#endif #ifdef H5_HAVE_UNISTD_H #include <sys/types.h> diff --git a/tools/test/perform/pio_perf.c b/tools/test/perform/pio_perf.c index d38c574..6fb5043 100644 --- a/tools/test/perform/pio_perf.c +++ b/tools/test/perform/pio_perf.c @@ -123,12 +123,12 @@ static const char *s_opts = "a:A:B:cCd:D:e:F:ghi:Imno:p:P:stT:wx:X:"; #else static const char *s_opts = "a:A:bB:cCd:D:e:F:ghi:Imno:p:P:stT:wx:X:"; #endif /* 1 */ -static struct h5_long_options l_opts[] = {{"align", require_arg, 'a'}, - {"alig", require_arg, 'a'}, - {"ali", require_arg, 'a'}, - {"al", require_arg, 'a'}, - {"api", require_arg, 'A'}, - {"ap", require_arg, 'A'}, +static struct long_options l_opts[] = {{"align", require_arg, 'a'}, + {"alig", require_arg, 'a'}, + {"ali", require_arg, 'a'}, + {"al", require_arg, 'a'}, + {"api", require_arg, 'A'}, + {"ap", require_arg, 'A'}, #if 0 /* a sighting of the elusive binary option */ { "binary", no_arg, 'b' }, @@ -137,133 +137,133 @@ static struct h5_long_options l_opts[] = {{"align", require_arg, 'a'}, { "bin", no_arg, 'b' }, { "bi", no_arg, 'b' }, #endif /* 0 */ - {"block-size", require_arg, 'B'}, - {"block-siz", require_arg, 'B'}, - {"block-si", require_arg, 'B'}, - {"block-s", require_arg, 'B'}, - {"block-", require_arg, 'B'}, - {"block", require_arg, 'B'}, - {"bloc", require_arg, 'B'}, - {"blo", require_arg, 'B'}, - {"bl", require_arg, 'B'}, - {"chunk", no_arg, 'c'}, - {"chun", no_arg, 'c'}, - {"chu", no_arg, 'c'}, - {"ch", no_arg, 'c'}, - {"collective", no_arg, 'C'}, - {"collectiv", no_arg, 'C'}, - {"collecti", no_arg, 'C'}, - {"collect", no_arg, 'C'}, - {"collec", no_arg, 'C'}, - {"colle", no_arg, 'C'}, - {"coll", no_arg, 'C'}, - {"col", no_arg, 'C'}, - {"co", no_arg, 'C'}, - {"debug", require_arg, 'D'}, - {"debu", require_arg, 'D'}, - {"deb", require_arg, 'D'}, - {"de", require_arg, 'D'}, - {"geometry", no_arg, 'g'}, - {"geometr", no_arg, 'g'}, - {"geomet", no_arg, 'g'}, - {"geome", no_arg, 'g'}, - {"geom", no_arg, 'g'}, - {"geo", no_arg, 'g'}, - {"ge", no_arg, 'g'}, - {"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {"he", no_arg, 'h'}, - {"interleaved", require_arg, 'I'}, - {"interleave", require_arg, 'I'}, - {"interleav", require_arg, 'I'}, - {"interlea", require_arg, 'I'}, - {"interle", require_arg, 'I'}, - {"interl", require_arg, 'I'}, - {"inter", require_arg, 'I'}, - {"inte", require_arg, 'I'}, - {"int", require_arg, 'I'}, - {"in", require_arg, 'I'}, - {"max-num-processes", require_arg, 'P'}, - {"max-num-processe", require_arg, 'P'}, - {"max-num-process", require_arg, 'P'}, - {"max-num-proces", require_arg, 'P'}, - {"max-num-proce", require_arg, 'P'}, - {"max-num-proc", require_arg, 'P'}, - {"max-num-pro", require_arg, 'P'}, - {"max-num-pr", require_arg, 'P'}, - {"max-num-p", require_arg, 'P'}, - {"min-num-processes", require_arg, 'p'}, - {"min-num-processe", require_arg, 'p'}, - {"min-num-process", require_arg, 'p'}, - {"min-num-proces", require_arg, 'p'}, - {"min-num-proce", require_arg, 'p'}, - {"min-num-proc", require_arg, 'p'}, - {"min-num-pro", require_arg, 'p'}, - {"min-num-pr", require_arg, 'p'}, - {"min-num-p", require_arg, 'p'}, - {"max-xfer-size", require_arg, 'X'}, - {"max-xfer-siz", require_arg, 'X'}, - {"max-xfer-si", require_arg, 'X'}, - {"max-xfer-s", require_arg, 'X'}, - {"max-xfer", require_arg, 'X'}, - {"max-xfe", require_arg, 'X'}, - {"max-xf", require_arg, 'X'}, - {"max-x", require_arg, 'X'}, - {"min-xfer-size", require_arg, 'x'}, - {"min-xfer-siz", require_arg, 'x'}, - {"min-xfer-si", require_arg, 'x'}, - {"min-xfer-s", require_arg, 'x'}, - {"min-xfer", require_arg, 'x'}, - {"min-xfe", require_arg, 'x'}, - {"min-xf", require_arg, 'x'}, - {"min-x", require_arg, 'x'}, - {"num-bytes", require_arg, 'e'}, - {"num-byte", require_arg, 'e'}, - {"num-byt", require_arg, 'e'}, - {"num-by", require_arg, 'e'}, - {"num-b", require_arg, 'e'}, - {"num-dsets", require_arg, 'd'}, - {"num-dset", require_arg, 'd'}, - {"num-dse", require_arg, 'd'}, - {"num-ds", require_arg, 'd'}, - {"num-d", require_arg, 'd'}, - {"num-files", require_arg, 'F'}, - {"num-file", require_arg, 'F'}, - {"num-fil", require_arg, 'F'}, - {"num-fi", require_arg, 'F'}, - {"num-f", require_arg, 'F'}, - {"num-iterations", require_arg, 'i'}, - {"num-iteration", require_arg, 'i'}, - {"num-iteratio", require_arg, 'i'}, - {"num-iterati", require_arg, 'i'}, - {"num-iterat", require_arg, 'i'}, - {"num-itera", require_arg, 'i'}, - {"num-iter", require_arg, 'i'}, - {"num-ite", require_arg, 'i'}, - {"num-it", require_arg, 'i'}, - {"num-i", require_arg, 'i'}, - {"output", require_arg, 'o'}, - {"outpu", require_arg, 'o'}, - {"outp", require_arg, 'o'}, - {"out", require_arg, 'o'}, - {"ou", require_arg, 'o'}, - {"threshold", require_arg, 'T'}, - {"threshol", require_arg, 'T'}, - {"thresho", require_arg, 'T'}, - {"thresh", require_arg, 'T'}, - {"thres", require_arg, 'T'}, - {"thre", require_arg, 'T'}, - {"thr", require_arg, 'T'}, - {"th", require_arg, 'T'}, - {"write-only", require_arg, 'w'}, - {"write-onl", require_arg, 'w'}, - {"write-on", require_arg, 'w'}, - {"write-o", require_arg, 'w'}, - {"write", require_arg, 'w'}, - {"writ", require_arg, 'w'}, - {"wri", require_arg, 'w'}, - {"wr", require_arg, 'w'}, - {NULL, 0, '\0'}}; + {"block-size", require_arg, 'B'}, + {"block-siz", require_arg, 'B'}, + {"block-si", require_arg, 'B'}, + {"block-s", require_arg, 'B'}, + {"block-", require_arg, 'B'}, + {"block", require_arg, 'B'}, + {"bloc", require_arg, 'B'}, + {"blo", require_arg, 'B'}, + {"bl", require_arg, 'B'}, + {"chunk", no_arg, 'c'}, + {"chun", no_arg, 'c'}, + {"chu", no_arg, 'c'}, + {"ch", no_arg, 'c'}, + {"collective", no_arg, 'C'}, + {"collectiv", no_arg, 'C'}, + {"collecti", no_arg, 'C'}, + {"collect", no_arg, 'C'}, + {"collec", no_arg, 'C'}, + {"colle", no_arg, 'C'}, + {"coll", no_arg, 'C'}, + {"col", no_arg, 'C'}, + {"co", no_arg, 'C'}, + {"debug", require_arg, 'D'}, + {"debu", require_arg, 'D'}, + {"deb", require_arg, 'D'}, + {"de", require_arg, 'D'}, + {"geometry", no_arg, 'g'}, + {"geometr", no_arg, 'g'}, + {"geomet", no_arg, 'g'}, + {"geome", no_arg, 'g'}, + {"geom", no_arg, 'g'}, + {"geo", no_arg, 'g'}, + {"ge", no_arg, 'g'}, + {"help", no_arg, 'h'}, + {"hel", no_arg, 'h'}, + {"he", no_arg, 'h'}, + {"interleaved", require_arg, 'I'}, + {"interleave", require_arg, 'I'}, + {"interleav", require_arg, 'I'}, + {"interlea", require_arg, 'I'}, + {"interle", require_arg, 'I'}, + {"interl", require_arg, 'I'}, + {"inter", require_arg, 'I'}, + {"inte", require_arg, 'I'}, + {"int", require_arg, 'I'}, + {"in", require_arg, 'I'}, + {"max-num-processes", require_arg, 'P'}, + {"max-num-processe", require_arg, 'P'}, + {"max-num-process", require_arg, 'P'}, + {"max-num-proces", require_arg, 'P'}, + {"max-num-proce", require_arg, 'P'}, + {"max-num-proc", require_arg, 'P'}, + {"max-num-pro", require_arg, 'P'}, + {"max-num-pr", require_arg, 'P'}, + {"max-num-p", require_arg, 'P'}, + {"min-num-processes", require_arg, 'p'}, + {"min-num-processe", require_arg, 'p'}, + {"min-num-process", require_arg, 'p'}, + {"min-num-proces", require_arg, 'p'}, + {"min-num-proce", require_arg, 'p'}, + {"min-num-proc", require_arg, 'p'}, + {"min-num-pro", require_arg, 'p'}, + {"min-num-pr", require_arg, 'p'}, + {"min-num-p", require_arg, 'p'}, + {"max-xfer-size", require_arg, 'X'}, + {"max-xfer-siz", require_arg, 'X'}, + {"max-xfer-si", require_arg, 'X'}, + {"max-xfer-s", require_arg, 'X'}, + {"max-xfer", require_arg, 'X'}, + {"max-xfe", require_arg, 'X'}, + {"max-xf", require_arg, 'X'}, + {"max-x", require_arg, 'X'}, + {"min-xfer-size", require_arg, 'x'}, + {"min-xfer-siz", require_arg, 'x'}, + {"min-xfer-si", require_arg, 'x'}, + {"min-xfer-s", require_arg, 'x'}, + {"min-xfer", require_arg, 'x'}, + {"min-xfe", require_arg, 'x'}, + {"min-xf", require_arg, 'x'}, + {"min-x", require_arg, 'x'}, + {"num-bytes", require_arg, 'e'}, + {"num-byte", require_arg, 'e'}, + {"num-byt", require_arg, 'e'}, + {"num-by", require_arg, 'e'}, + {"num-b", require_arg, 'e'}, + {"num-dsets", require_arg, 'd'}, + {"num-dset", require_arg, 'd'}, + {"num-dse", require_arg, 'd'}, + {"num-ds", require_arg, 'd'}, + {"num-d", require_arg, 'd'}, + {"num-files", require_arg, 'F'}, + {"num-file", require_arg, 'F'}, + {"num-fil", require_arg, 'F'}, + {"num-fi", require_arg, 'F'}, + {"num-f", require_arg, 'F'}, + {"num-iterations", require_arg, 'i'}, + {"num-iteration", require_arg, 'i'}, + {"num-iteratio", require_arg, 'i'}, + {"num-iterati", require_arg, 'i'}, + {"num-iterat", require_arg, 'i'}, + {"num-itera", require_arg, 'i'}, + {"num-iter", require_arg, 'i'}, + {"num-ite", require_arg, 'i'}, + {"num-it", require_arg, 'i'}, + {"num-i", require_arg, 'i'}, + {"output", require_arg, 'o'}, + {"outpu", require_arg, 'o'}, + {"outp", require_arg, 'o'}, + {"out", require_arg, 'o'}, + {"ou", require_arg, 'o'}, + {"threshold", require_arg, 'T'}, + {"threshol", require_arg, 'T'}, + {"thresho", require_arg, 'T'}, + {"thresh", require_arg, 'T'}, + {"thres", require_arg, 'T'}, + {"thre", require_arg, 'T'}, + {"thr", require_arg, 'T'}, + {"th", require_arg, 'T'}, + {"write-only", require_arg, 'w'}, + {"write-onl", require_arg, 'w'}, + {"write-on", require_arg, 'w'}, + {"write-o", require_arg, 'w'}, + {"write", require_arg, 'w'}, + {"writ", require_arg, 'w'}, + {"wri", require_arg, 'w'}, + {"wr", require_arg, 'w'}, + {NULL, 0, '\0'}}; struct options { long io_types; /* bitmask of which I/O types to test */ @@ -1286,13 +1286,13 @@ parse_command_line(int argc, char *argv[]) cl_opts->h5_write_only = FALSE; /* Do both read and write by default */ cl_opts->verify = FALSE; /* No Verify data correctness by default */ - while ((opt = H5_get_option(argc, (const char **)argv, s_opts, l_opts)) != EOF) { + while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'a': - cl_opts->h5_alignment = parse_size_directive(H5_optarg); + cl_opts->h5_alignment = parse_size_directive(opt_arg); break; case 'A': { - const char *end = H5_optarg; + const char *end = opt_arg; while (end && *end != '\0') { char buf[10]; @@ -1332,7 +1332,7 @@ parse_command_line(int argc, char *argv[]) break; #endif /* 0 */ case 'B': - cl_opts->blk_size = (size_t)parse_size_directive(H5_optarg); + cl_opts->blk_size = (size_t)parse_size_directive(opt_arg); break; case 'c': /* Turn on chunked HDF5 dataset creation */ @@ -1342,10 +1342,10 @@ parse_command_line(int argc, char *argv[]) cl_opts->collective = 1; break; case 'd': - cl_opts->num_dsets = atoi(H5_optarg); + cl_opts->num_dsets = atoi(opt_arg); break; case 'D': { - const char *end = H5_optarg; + const char *end = opt_arg; while (end && *end != '\0') { char buf[10]; @@ -1402,40 +1402,40 @@ parse_command_line(int argc, char *argv[]) break; case 'e': - cl_opts->num_bpp = parse_size_directive(H5_optarg); + cl_opts->num_bpp = parse_size_directive(opt_arg); break; case 'F': - cl_opts->num_files = HDatoi(H5_optarg); + cl_opts->num_files = HDatoi(opt_arg); break; case 'g': cl_opts->dim2d = 1; break; case 'i': - cl_opts->num_iters = HDatoi(H5_optarg); + cl_opts->num_iters = HDatoi(opt_arg); break; case 'I': cl_opts->interleaved = 1; break; case 'o': - cl_opts->output_file = H5_optarg; + cl_opts->output_file = opt_arg; break; case 'p': - cl_opts->min_num_procs = HDatoi(H5_optarg); + cl_opts->min_num_procs = HDatoi(opt_arg); break; case 'P': - cl_opts->max_num_procs = HDatoi(H5_optarg); + cl_opts->max_num_procs = HDatoi(opt_arg); break; case 'T': - cl_opts->h5_threshold = parse_size_directive(H5_optarg); + cl_opts->h5_threshold = parse_size_directive(opt_arg); break; case 'w': cl_opts->h5_write_only = TRUE; break; case 'x': - cl_opts->min_xfer_size = (size_t)parse_size_directive(H5_optarg); + cl_opts->min_xfer_size = (size_t)parse_size_directive(opt_arg); break; case 'X': - cl_opts->max_xfer_size = (size_t)parse_size_directive(H5_optarg); + cl_opts->max_xfer_size = (size_t)parse_size_directive(opt_arg); break; case 'h': case '?': diff --git a/tools/test/perform/pio_standalone.c b/tools/test/perform/pio_standalone.c index ded15a4..0a9bfc0 100644 --- a/tools/test/perform/pio_standalone.c +++ b/tools/test/perform/pio_standalone.c @@ -26,26 +26,31 @@ MPI_Info h5_io_info_g = MPI_INFO_NULL; /* MPI INFO object for IO */ /* global variables */ int nCols = 80; +/* ``get_option'' variables */ +int opt_err = 1; /*get_option prints errors if this is on */ +int opt_ind = 1; /*token pointer */ +const char *opt_arg; /*flag argument (or value) */ + int -get_option(int argc, const char **argv, const char *opts, const struct h5_long_options *l_opts) +get_option(int argc, const char **argv, const char *opts, const struct long_options *l_opts) { static int sp = 1; /* character index in current token */ int opt_opt = '?'; /* option character passed back to user */ if (sp == 1) { /* check for more flag-like tokens */ - if (H5_optind >= argc || argv[H5_optind][0] != '-' || argv[H5_optind][1] == '\0') { + if (opt_ind >= argc || argv[opt_ind][0] != '-' || argv[opt_ind][1] == '\0') { return EOF; } - else if (HDstrcmp(argv[H5_optind], "--") == 0) { - H5_optind++; + else if (HDstrcmp(argv[opt_ind], "--") == 0) { + opt_ind++; return EOF; } } - if (sp == 1 && argv[H5_optind][0] == '-' && argv[H5_optind][1] == '-') { + if (sp == 1 && argv[opt_ind][0] == '-' && argv[opt_ind][1] == '-') { /* long command line option */ - const char *arg = &argv[H5_optind][2]; + const char *arg = &argv[opt_ind][2]; int i; for (i = 0; l_opts && l_opts[i].name; i++) { @@ -57,13 +62,13 @@ get_option(int argc, const char **argv, const char *opts, const struct h5_long_o if (l_opts[i].has_arg != no_arg) { if (arg[len] == '=') { - H5_optarg = &arg[len + 1]; + opt_arg = &arg[len + 1]; } - else if (H5_optind < (argc - 1) && argv[H5_optind + 1][0] != '-') { - H5_optarg = argv[++H5_optind]; + else if (opt_ind < (argc - 1) && argv[opt_ind + 1][0] != '-') { + opt_arg = argv[++opt_ind]; } else if (l_opts[i].has_arg == require_arg) { - if (H5_opterr) + if (opt_err) HDfprintf(stderr, "%s: option required for \"--%s\" flag\n", argv[0], arg); opt_opt = '?'; @@ -71,13 +76,13 @@ get_option(int argc, const char **argv, const char *opts, const struct h5_long_o } else { if (arg[len] == '=') { - if (H5_opterr) + if (opt_err) HDfprintf(stderr, "%s: no option required for \"%s\" flag\n", argv[0], arg); opt_opt = '?'; } - H5_optarg = NULL; + opt_arg = NULL; } break; @@ -86,29 +91,29 @@ get_option(int argc, const char **argv, const char *opts, const struct h5_long_o if (l_opts[i].name == NULL) { /* exhausted all of the l_opts we have and still didn't match */ - if (H5_opterr) + if (opt_err) HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg); opt_opt = '?'; } - H5_optind++; + opt_ind++; sp = 1; } else { register char *cp; /* pointer into current token */ /* short command line option */ - opt_opt = argv[H5_optind][sp]; + opt_opt = argv[opt_ind][sp]; if (opt_opt == ':' || (cp = strchr(opts, opt_opt)) == 0) { - if (H5_opterr) + if (opt_err) HDfprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], opt_opt); /* if no chars left in this token, move to next token */ - if (argv[H5_optind][++sp] == '\0') { - H5_optind++; + if (argv[opt_ind][++sp] == '\0') { + opt_ind++; sp = 1; } @@ -117,32 +122,32 @@ get_option(int argc, const char **argv, const char *opts, const struct h5_long_o if (*++cp == ':') { /* if a value is expected, get it */ - if (argv[H5_optind][sp + 1] != '\0') { + if (argv[opt_ind][sp + 1] != '\0') { /* flag value is rest of current token */ - H5_optarg = &argv[H5_optind++][sp + 1]; + opt_arg = &argv[opt_ind++][sp + 1]; } - else if (++H5_optind >= argc) { - if (H5_opterr) + else if (++opt_ind >= argc) { + if (opt_err) HDfprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], opt_opt); opt_opt = '?'; } else { /* flag value is next token */ - H5_optarg = argv[H5_optind++]; + opt_arg = argv[opt_ind++]; } sp = 1; } else { /* set up to look at next char in token, next time */ - if (argv[H5_optind][++sp] == '\0') { + if (argv[opt_ind][++sp] == '\0') { /* no more in current token, so setup next token */ - H5_optind++; + opt_ind++; sp = 1; } - H5_optarg = NULL; + opt_arg = NULL; } } diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h index 813ad2d..35a5217 100644 --- a/tools/test/perform/pio_standalone.h +++ b/tools/test/perform/pio_standalone.h @@ -21,6 +21,10 @@ #include "H5public.h" /* Include Public Definitions */ +/* + * Include ANSI-C header files. + */ +#ifdef H5_STDC_HEADERS #include <assert.h> #include <ctype.h> #include <errno.h> @@ -33,6 +37,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#endif /* * Redefine all the POSIX functions. We should never see a POSIX @@ -471,25 +476,24 @@ void h5_dump_info_object(MPI_Info info); /** From h5tools_utils.h **/ -H5_DLLVAR int H5_opterr; /* getoption prints errors if this is on */ -H5_DLLVAR int H5_optind; /* token pointer */ -H5_DLLVAR const char *H5_optarg; /* flag argument (or value) */ +extern int opt_err; /* getoption prints errors if this is on */ +extern int opt_ind; /* token pointer */ +extern const char *opt_arg; /* flag argument (or value) */ -enum h5_arg_level { +enum { no_arg = 0, /* doesn't take an argument */ require_arg, /* requires an argument */ optional_arg /* argument is optional */ }; -struct h5_long_options { - const char * name; /* Name of the long option */ - enum h5_arg_level has_arg; /* Whether we should look for an arg */ - char shortval; /* The shortname equivalent of long arg - * this gets returned from get_option - */ -}; +typedef struct long_options { + const char *name; /* name of the long option */ + int has_arg; /* whether we should look for an arg */ + char shortval; /* the shortname equivalent of long arg + * this gets returned from get_option */ +} long_options; -extern int H5_get_option(int argc, const char **argv, const char *opt, const struct h5_long_options *l_opt); +extern int get_option(int argc, const char **argv, const char *opt, const struct long_options *l_opt); extern int nCols; /*max number of columns for outputting */ diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c index 1af2318..e5a0ec8 100644 --- a/tools/test/perform/sio_engine.c +++ b/tools/test/perform/sio_engine.c @@ -16,10 +16,12 @@ #include "hdf5.h" +#ifdef H5_STDC_HEADERS #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> +#endif #ifdef H5_HAVE_UNISTD_H #include <sys/types.h> @@ -1264,6 +1266,13 @@ done: * Programmer: Albert Cheng 2001/12/12 * Modifications: Support for file drivers. Christian Chilan, April, 2008 */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * 'temp' in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +H5_GCC_DIAG_OFF("format-nonliteral") static void do_cleanupfile(iotype iot, char *filename) { @@ -1326,3 +1335,4 @@ do_cleanupfile(iotype iot, char *filename) } } } +H5_GCC_DIAG_ON("format-nonliteral") diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c index 51a7825..fe4e7e7 100644 --- a/tools/test/perform/sio_perf.c +++ b/tools/test/perform/sio_perf.c @@ -97,13 +97,13 @@ static const char *progname = "h5perf_serial"; * It seems that only the options that accept additional information * such as dataset size (-e) require the colon next to it. */ -static const char * s_opts = "a:A:B:c:Cd:D:e:F:ghi:Imno:p:P:r:stT:v:wx:X:"; -static struct h5_long_options l_opts[] = {{"align", require_arg, 'a'}, - {"alig", require_arg, 'a'}, - {"ali", require_arg, 'a'}, - {"al", require_arg, 'a'}, - {"api", require_arg, 'A'}, - {"ap", require_arg, 'A'}, +static const char * s_opts = "a:A:B:c:Cd:D:e:F:ghi:Imno:p:P:r:stT:v:wx:X:"; +static struct long_options l_opts[] = {{"align", require_arg, 'a'}, + {"alig", require_arg, 'a'}, + {"ali", require_arg, 'a'}, + {"al", require_arg, 'a'}, + {"api", require_arg, 'A'}, + {"ap", require_arg, 'A'}, #if 0 /* a sighting of the elusive binary option */ { "binary", no_arg, 'b' }, @@ -112,156 +112,156 @@ static struct h5_long_options l_opts[] = {{"align", require_arg, 'a'}, { "bin", no_arg, 'b' }, { "bi", no_arg, 'b' }, #endif /* 0 */ - {"block-size", require_arg, 'B'}, - {"block-siz", require_arg, 'B'}, - {"block-si", require_arg, 'B'}, - {"block-s", require_arg, 'B'}, - {"block-", require_arg, 'B'}, - {"block", require_arg, 'B'}, - {"bloc", require_arg, 'B'}, - {"blo", require_arg, 'B'}, - {"bl", require_arg, 'B'}, - {"chunk", no_arg, 'c'}, - {"chun", no_arg, 'c'}, - {"chu", no_arg, 'c'}, - {"ch", no_arg, 'c'}, - {"collective", no_arg, 'C'}, - {"collectiv", no_arg, 'C'}, - {"collecti", no_arg, 'C'}, - {"collect", no_arg, 'C'}, - {"collec", no_arg, 'C'}, - {"colle", no_arg, 'C'}, - {"coll", no_arg, 'C'}, - {"col", no_arg, 'C'}, - {"co", no_arg, 'C'}, - {"debug", require_arg, 'D'}, - {"debu", require_arg, 'D'}, - {"deb", require_arg, 'D'}, - {"de", require_arg, 'D'}, - {"file-driver", require_arg, 'v'}, - {"file-drive", require_arg, 'v'}, - {"file-driv", require_arg, 'v'}, - {"file-dri", require_arg, 'v'}, - {"file-dr", require_arg, 'v'}, - {"file-d", require_arg, 'v'}, - {"file-", require_arg, 'v'}, - {"file", require_arg, 'v'}, - {"fil", require_arg, 'v'}, - {"fi", require_arg, 'v'}, - {"geometry", no_arg, 'g'}, - {"geometr", no_arg, 'g'}, - {"geomet", no_arg, 'g'}, - {"geome", no_arg, 'g'}, - {"geom", no_arg, 'g'}, - {"geo", no_arg, 'g'}, - {"ge", no_arg, 'g'}, - {"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {"he", no_arg, 'h'}, - {"interleaved", require_arg, 'I'}, - {"interleave", require_arg, 'I'}, - {"interleav", require_arg, 'I'}, - {"interlea", require_arg, 'I'}, - {"interle", require_arg, 'I'}, - {"interl", require_arg, 'I'}, - {"inter", require_arg, 'I'}, - {"inte", require_arg, 'I'}, - {"int", require_arg, 'I'}, - {"in", require_arg, 'I'}, - {"max-num-processes", require_arg, 'P'}, - {"max-num-processe", require_arg, 'P'}, - {"max-num-process", require_arg, 'P'}, - {"max-num-proces", require_arg, 'P'}, - {"max-num-proce", require_arg, 'P'}, - {"max-num-proc", require_arg, 'P'}, - {"max-num-pro", require_arg, 'P'}, - {"max-num-pr", require_arg, 'P'}, - {"max-num-p", require_arg, 'P'}, - {"min-num-processes", require_arg, 'p'}, - {"min-num-processe", require_arg, 'p'}, - {"min-num-process", require_arg, 'p'}, - {"min-num-proces", require_arg, 'p'}, - {"min-num-proce", require_arg, 'p'}, - {"min-num-proc", require_arg, 'p'}, - {"min-num-pro", require_arg, 'p'}, - {"min-num-pr", require_arg, 'p'}, - {"min-num-p", require_arg, 'p'}, - {"max-xfer-size", require_arg, 'X'}, - {"max-xfer-siz", require_arg, 'X'}, - {"max-xfer-si", require_arg, 'X'}, - {"max-xfer-s", require_arg, 'X'}, - {"max-xfer", require_arg, 'X'}, - {"max-xfe", require_arg, 'X'}, - {"max-xf", require_arg, 'X'}, - {"max-x", require_arg, 'X'}, - {"min-xfer-size", require_arg, 'x'}, - {"min-xfer-siz", require_arg, 'x'}, - {"min-xfer-si", require_arg, 'x'}, - {"min-xfer-s", require_arg, 'x'}, - {"min-xfer", require_arg, 'x'}, - {"min-xfe", require_arg, 'x'}, - {"min-xf", require_arg, 'x'}, - {"min-x", require_arg, 'x'}, - {"num-bytes", require_arg, 'e'}, - {"num-byte", require_arg, 'e'}, - {"num-byt", require_arg, 'e'}, - {"num-by", require_arg, 'e'}, - {"num-b", require_arg, 'e'}, - {"num-dsets", require_arg, 'd'}, - {"num-dset", require_arg, 'd'}, - {"num-dse", require_arg, 'd'}, - {"num-ds", require_arg, 'd'}, - {"num-d", require_arg, 'd'}, - {"num-files", require_arg, 'F'}, - {"num-file", require_arg, 'F'}, - {"num-fil", require_arg, 'F'}, - {"num-fi", require_arg, 'F'}, - {"num-f", require_arg, 'F'}, - {"num-iterations", require_arg, 'i'}, - {"num-iteration", require_arg, 'i'}, - {"num-iteratio", require_arg, 'i'}, - {"num-iterati", require_arg, 'i'}, - {"num-iterat", require_arg, 'i'}, - {"num-itera", require_arg, 'i'}, - {"num-iter", require_arg, 'i'}, - {"num-ite", require_arg, 'i'}, - {"num-it", require_arg, 'i'}, - {"num-i", require_arg, 'i'}, - {"order", require_arg, 'r'}, - {"orde", require_arg, 'r'}, - {"ord", require_arg, 'r'}, - {"or", require_arg, 'r'}, - {"output", require_arg, 'o'}, - {"outpu", require_arg, 'o'}, - {"outp", require_arg, 'o'}, - {"out", require_arg, 'o'}, - {"ou", require_arg, 'o'}, - {"extendable", no_arg, 't'}, - {"extendabl", no_arg, 't'}, - {"extendab", no_arg, 't'}, - {"extenda", no_arg, 't'}, - {"extend", no_arg, 't'}, - {"exten", no_arg, 't'}, - {"exte", no_arg, 't'}, - {"ext", no_arg, 't'}, - {"ex", no_arg, 't'}, - {"threshold", require_arg, 'T'}, - {"threshol", require_arg, 'T'}, - {"thresho", require_arg, 'T'}, - {"thresh", require_arg, 'T'}, - {"thres", require_arg, 'T'}, - {"thre", require_arg, 'T'}, - {"thr", require_arg, 'T'}, - {"th", require_arg, 'T'}, - {"write-only", require_arg, 'w'}, - {"write-onl", require_arg, 'w'}, - {"write-on", require_arg, 'w'}, - {"write-o", require_arg, 'w'}, - {"write", require_arg, 'w'}, - {"writ", require_arg, 'w'}, - {"wri", require_arg, 'w'}, - {"wr", require_arg, 'w'}, - {NULL, 0, '\0'}}; + {"block-size", require_arg, 'B'}, + {"block-siz", require_arg, 'B'}, + {"block-si", require_arg, 'B'}, + {"block-s", require_arg, 'B'}, + {"block-", require_arg, 'B'}, + {"block", require_arg, 'B'}, + {"bloc", require_arg, 'B'}, + {"blo", require_arg, 'B'}, + {"bl", require_arg, 'B'}, + {"chunk", no_arg, 'c'}, + {"chun", no_arg, 'c'}, + {"chu", no_arg, 'c'}, + {"ch", no_arg, 'c'}, + {"collective", no_arg, 'C'}, + {"collectiv", no_arg, 'C'}, + {"collecti", no_arg, 'C'}, + {"collect", no_arg, 'C'}, + {"collec", no_arg, 'C'}, + {"colle", no_arg, 'C'}, + {"coll", no_arg, 'C'}, + {"col", no_arg, 'C'}, + {"co", no_arg, 'C'}, + {"debug", require_arg, 'D'}, + {"debu", require_arg, 'D'}, + {"deb", require_arg, 'D'}, + {"de", require_arg, 'D'}, + {"file-driver", require_arg, 'v'}, + {"file-drive", require_arg, 'v'}, + {"file-driv", require_arg, 'v'}, + {"file-dri", require_arg, 'v'}, + {"file-dr", require_arg, 'v'}, + {"file-d", require_arg, 'v'}, + {"file-", require_arg, 'v'}, + {"file", require_arg, 'v'}, + {"fil", require_arg, 'v'}, + {"fi", require_arg, 'v'}, + {"geometry", no_arg, 'g'}, + {"geometr", no_arg, 'g'}, + {"geomet", no_arg, 'g'}, + {"geome", no_arg, 'g'}, + {"geom", no_arg, 'g'}, + {"geo", no_arg, 'g'}, + {"ge", no_arg, 'g'}, + {"help", no_arg, 'h'}, + {"hel", no_arg, 'h'}, + {"he", no_arg, 'h'}, + {"interleaved", require_arg, 'I'}, + {"interleave", require_arg, 'I'}, + {"interleav", require_arg, 'I'}, + {"interlea", require_arg, 'I'}, + {"interle", require_arg, 'I'}, + {"interl", require_arg, 'I'}, + {"inter", require_arg, 'I'}, + {"inte", require_arg, 'I'}, + {"int", require_arg, 'I'}, + {"in", require_arg, 'I'}, + {"max-num-processes", require_arg, 'P'}, + {"max-num-processe", require_arg, 'P'}, + {"max-num-process", require_arg, 'P'}, + {"max-num-proces", require_arg, 'P'}, + {"max-num-proce", require_arg, 'P'}, + {"max-num-proc", require_arg, 'P'}, + {"max-num-pro", require_arg, 'P'}, + {"max-num-pr", require_arg, 'P'}, + {"max-num-p", require_arg, 'P'}, + {"min-num-processes", require_arg, 'p'}, + {"min-num-processe", require_arg, 'p'}, + {"min-num-process", require_arg, 'p'}, + {"min-num-proces", require_arg, 'p'}, + {"min-num-proce", require_arg, 'p'}, + {"min-num-proc", require_arg, 'p'}, + {"min-num-pro", require_arg, 'p'}, + {"min-num-pr", require_arg, 'p'}, + {"min-num-p", require_arg, 'p'}, + {"max-xfer-size", require_arg, 'X'}, + {"max-xfer-siz", require_arg, 'X'}, + {"max-xfer-si", require_arg, 'X'}, + {"max-xfer-s", require_arg, 'X'}, + {"max-xfer", require_arg, 'X'}, + {"max-xfe", require_arg, 'X'}, + {"max-xf", require_arg, 'X'}, + {"max-x", require_arg, 'X'}, + {"min-xfer-size", require_arg, 'x'}, + {"min-xfer-siz", require_arg, 'x'}, + {"min-xfer-si", require_arg, 'x'}, + {"min-xfer-s", require_arg, 'x'}, + {"min-xfer", require_arg, 'x'}, + {"min-xfe", require_arg, 'x'}, + {"min-xf", require_arg, 'x'}, + {"min-x", require_arg, 'x'}, + {"num-bytes", require_arg, 'e'}, + {"num-byte", require_arg, 'e'}, + {"num-byt", require_arg, 'e'}, + {"num-by", require_arg, 'e'}, + {"num-b", require_arg, 'e'}, + {"num-dsets", require_arg, 'd'}, + {"num-dset", require_arg, 'd'}, + {"num-dse", require_arg, 'd'}, + {"num-ds", require_arg, 'd'}, + {"num-d", require_arg, 'd'}, + {"num-files", require_arg, 'F'}, + {"num-file", require_arg, 'F'}, + {"num-fil", require_arg, 'F'}, + {"num-fi", require_arg, 'F'}, + {"num-f", require_arg, 'F'}, + {"num-iterations", require_arg, 'i'}, + {"num-iteration", require_arg, 'i'}, + {"num-iteratio", require_arg, 'i'}, + {"num-iterati", require_arg, 'i'}, + {"num-iterat", require_arg, 'i'}, + {"num-itera", require_arg, 'i'}, + {"num-iter", require_arg, 'i'}, + {"num-ite", require_arg, 'i'}, + {"num-it", require_arg, 'i'}, + {"num-i", require_arg, 'i'}, + {"order", require_arg, 'r'}, + {"orde", require_arg, 'r'}, + {"ord", require_arg, 'r'}, + {"or", require_arg, 'r'}, + {"output", require_arg, 'o'}, + {"outpu", require_arg, 'o'}, + {"outp", require_arg, 'o'}, + {"out", require_arg, 'o'}, + {"ou", require_arg, 'o'}, + {"extendable", no_arg, 't'}, + {"extendabl", no_arg, 't'}, + {"extendab", no_arg, 't'}, + {"extenda", no_arg, 't'}, + {"extend", no_arg, 't'}, + {"exten", no_arg, 't'}, + {"exte", no_arg, 't'}, + {"ext", no_arg, 't'}, + {"ex", no_arg, 't'}, + {"threshold", require_arg, 'T'}, + {"threshol", require_arg, 'T'}, + {"thresho", require_arg, 'T'}, + {"thresh", require_arg, 'T'}, + {"thres", require_arg, 'T'}, + {"thre", require_arg, 'T'}, + {"thr", require_arg, 'T'}, + {"th", require_arg, 'T'}, + {"write-only", require_arg, 'w'}, + {"write-onl", require_arg, 'w'}, + {"write-on", require_arg, 'w'}, + {"write-o", require_arg, 'w'}, + {"write", require_arg, 'w'}, + {"writ", require_arg, 'w'}, + {"wri", require_arg, 'w'}, + {"wr", require_arg, 'w'}, + {NULL, 0, '\0'}}; struct options { long io_types; /* bitmask of which I/O types to test */ @@ -993,19 +993,19 @@ parse_command_line(int argc, const char *argv[]) cl_opts->h5_extendable = FALSE; /* Use extendable dataset */ cl_opts->verify = FALSE; /* No Verify data correctness by default */ - while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'a': - cl_opts->h5_alignment = parse_size_directive(H5_optarg); + cl_opts->h5_alignment = parse_size_directive(opt_arg); break; case 'G': - cl_opts->page_size = parse_size_directive(H5_optarg); + cl_opts->page_size = parse_size_directive(opt_arg); break; case 'b': - cl_opts->page_buffer_size = parse_size_directive(H5_optarg); + cl_opts->page_buffer_size = parse_size_directive(opt_arg); break; case 'A': { - const char *end = H5_optarg; + const char *end = opt_arg; while (end && *end != '\0') { char buf[10]; @@ -1043,7 +1043,7 @@ parse_command_line(int argc, const char *argv[]) /* Turn on chunked HDF5 dataset creation */ cl_opts->h5_use_chunks = 1; { - const char *end = H5_optarg; + const char *end = opt_arg; int j = 0; while (end && *end != '\0') { @@ -1070,7 +1070,7 @@ parse_command_line(int argc, const char *argv[]) break; case 'D': { - const char *end = H5_optarg; + const char *end = opt_arg; while (end && *end != '\0') { char buf[10]; @@ -1126,7 +1126,7 @@ parse_command_line(int argc, const char *argv[]) break; case 'e': { - const char *end = H5_optarg; + const char *end = opt_arg; int j = 0; while (end && *end != '\0') { @@ -1153,38 +1153,38 @@ parse_command_line(int argc, const char *argv[]) break; case 'i': - cl_opts->num_iters = HDatoi(H5_optarg); + cl_opts->num_iters = HDatoi(opt_arg); break; case 'o': - cl_opts->output_file = H5_optarg; + cl_opts->output_file = opt_arg; break; case 'T': - cl_opts->h5_threshold = parse_size_directive(H5_optarg); + cl_opts->h5_threshold = parse_size_directive(opt_arg); break; case 'v': - if (!HDstrcasecmp(H5_optarg, "sec2")) { + if (!HDstrcasecmp(opt_arg, "sec2")) { cl_opts->vfd = sec2; } - else if (!HDstrcasecmp(H5_optarg, "stdio")) { + else if (!HDstrcasecmp(opt_arg, "stdio")) { cl_opts->vfd = stdio; } - else if (!HDstrcasecmp(H5_optarg, "core")) { + else if (!HDstrcasecmp(opt_arg, "core")) { cl_opts->vfd = core; } - else if (!HDstrcasecmp(H5_optarg, "split")) { + else if (!HDstrcasecmp(opt_arg, "split")) { cl_opts->vfd = split; } - else if (!HDstrcasecmp(H5_optarg, "multi")) { + else if (!HDstrcasecmp(opt_arg, "multi")) { cl_opts->vfd = multi; } - else if (!HDstrcasecmp(H5_optarg, "family")) { + else if (!HDstrcasecmp(opt_arg, "family")) { cl_opts->vfd = family; } - else if (!HDstrcasecmp(H5_optarg, "direct")) { + else if (!HDstrcasecmp(opt_arg, "direct")) { cl_opts->vfd = direct; } else { - HDfprintf(stderr, "sio_perf: invalid --api option %s\n", H5_optarg); + HDfprintf(stderr, "sio_perf: invalid --api option %s\n", opt_arg); HDexit(EXIT_FAILURE); } break; @@ -1195,7 +1195,7 @@ parse_command_line(int argc, const char *argv[]) cl_opts->h5_extendable = TRUE; break; case 'x': { - const char *end = H5_optarg; + const char *end = opt_arg; int j = 0; while (end && *end != '\0') { @@ -1222,7 +1222,7 @@ parse_command_line(int argc, const char *argv[]) break; case 'r': { - const char *end = H5_optarg; + const char *end = opt_arg; int j = 0; while (end && *end != '\0') { diff --git a/tools/test/perform/sio_standalone.c b/tools/test/perform/sio_standalone.c index 7c22b53..abc0777 100644 --- a/tools/test/perform/sio_standalone.c +++ b/tools/test/perform/sio_standalone.c @@ -22,26 +22,31 @@ /* global variables */ int nCols = 80; +/* ``get_option'' variables */ +int opt_err = 1; /*get_option prints errors if this is on */ +int opt_ind = 1; /*token pointer */ +const char *opt_arg; /*flag argument (or value) */ + int -get_option(int argc, const char **argv, const char *opts, const struct h5_long_options *l_opts) +get_option(int argc, const char **argv, const char *opts, const struct long_options *l_opts) { static int sp = 1; /* character index in current token */ int opt_opt = '?'; /* option character passed back to user */ if (sp == 1) { /* check for more flag-like tokens */ - if (H5_optind >= argc || argv[H5_optind][0] != '-' || argv[H5_optind][1] == '\0') { + if (opt_ind >= argc || argv[opt_ind][0] != '-' || argv[opt_ind][1] == '\0') { return EOF; } - else if (HDstrcmp(argv[H5_optind], "--") == 0) { - H5_optind++; + else if (HDstrcmp(argv[opt_ind], "--") == 0) { + opt_ind++; return EOF; } } - if (sp == 1 && argv[H5_optind][0] == '-' && argv[H5_optind][1] == '-') { + if (sp == 1 && argv[opt_ind][0] == '-' && argv[opt_ind][1] == '-') { /* long command line option */ - const char *arg = &argv[H5_optind][2]; + const char *arg = &argv[opt_ind][2]; int i; for (i = 0; l_opts && l_opts[i].name; i++) { @@ -53,13 +58,13 @@ get_option(int argc, const char **argv, const char *opts, const struct h5_long_o if (l_opts[i].has_arg != no_arg) { if (arg[len] == '=') { - H5_optarg = &arg[len + 1]; + opt_arg = &arg[len + 1]; } - else if (H5_optind < (argc - 1) && argv[H5_optind + 1][0] != '-') { - H5_optarg = argv[++H5_optind]; + else if (opt_ind < (argc - 1) && argv[opt_ind + 1][0] != '-') { + opt_arg = argv[++opt_ind]; } else if (l_opts[i].has_arg == require_arg) { - if (H5_opterr) + if (opt_err) HDfprintf(stderr, "%s: option required for \"--%s\" flag\n", argv[0], arg); opt_opt = '?'; @@ -67,13 +72,13 @@ get_option(int argc, const char **argv, const char *opts, const struct h5_long_o } else { if (arg[len] == '=') { - if (H5_opterr) + if (opt_err) HDfprintf(stderr, "%s: no option required for \"%s\" flag\n", argv[0], arg); opt_opt = '?'; } - H5_optarg = NULL; + opt_arg = NULL; } break; @@ -82,29 +87,29 @@ get_option(int argc, const char **argv, const char *opts, const struct h5_long_o if (l_opts[i].name == NULL) { /* exhausted all of the l_opts we have and still didn't match */ - if (H5_opterr) + if (opt_err) HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg); opt_opt = '?'; } - H5_optind++; + opt_ind++; sp = 1; } else { register char *cp; /* pointer into current token */ /* short command line option */ - opt_opt = argv[H5_optind][sp]; + opt_opt = argv[opt_ind][sp]; if (opt_opt == ':' || (cp = strchr(opts, opt_opt)) == 0) { - if (H5_opterr) + if (opt_err) HDfprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], opt_opt); /* if no chars left in this token, move to next token */ - if (argv[H5_optind][++sp] == '\0') { - H5_optind++; + if (argv[opt_ind][++sp] == '\0') { + opt_ind++; sp = 1; } @@ -113,32 +118,32 @@ get_option(int argc, const char **argv, const char *opts, const struct h5_long_o if (*++cp == ':') { /* if a value is expected, get it */ - if (argv[H5_optind][sp + 1] != '\0') { + if (argv[opt_ind][sp + 1] != '\0') { /* flag value is rest of current token */ - H5_optarg = &argv[H5_optind++][sp + 1]; + opt_arg = &argv[opt_ind++][sp + 1]; } - else if (++H5_optind >= argc) { - if (H5_opterr) + else if (++opt_ind >= argc) { + if (opt_err) HDfprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], opt_opt); opt_opt = '?'; } else { /* flag value is next token */ - H5_optarg = argv[H5_optind++]; + opt_arg = argv[opt_ind++]; } sp = 1; } else { /* set up to look at next char in token, next time */ - if (argv[H5_optind][++sp] == '\0') { + if (argv[opt_ind][++sp] == '\0') { /* no more in current token, so setup next token */ - H5_optind++; + opt_ind++; sp = 1; } - H5_optarg = NULL; + opt_arg = NULL; } } diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h index 9a2a8c6..d8b6412 100644 --- a/tools/test/perform/sio_standalone.h +++ b/tools/test/perform/sio_standalone.h @@ -21,6 +21,10 @@ #include "H5public.h" /* Include Public Definitions */ +/* + * Include ANSI-C header files. + */ +#ifdef H5_STDC_HEADERS #include <assert.h> #include <ctype.h> #include <errno.h> @@ -33,6 +37,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#endif /* maximum of two, three, or four values */ #undef MAX @@ -486,25 +491,24 @@ void h5_dump_info_object(MPI_Info info); /** From h5tools_utils.h **/ -H5_DLLVAR int H5_opterr; /* getoption prints errors if this is on */ -H5_DLLVAR int H5_optind; /* token pointer */ -H5_DLLVAR const char *H5_optarg; /* flag argument (or value) */ +extern int opt_err; /* getoption prints errors if this is on */ +extern int opt_ind; /* token pointer */ +extern const char *opt_arg; /* flag argument (or value) */ -enum h5_arg_level { +enum { no_arg = 0, /* doesn't take an argument */ require_arg, /* requires an argument */ optional_arg /* argument is optional */ }; -struct h5_long_options { - const char * name; /* Name of the long option */ - enum h5_arg_level has_arg; /* Whether we should look for an arg */ - char shortval; /* The shortname equivalent of long arg - * this gets returned from get_option - */ -}; +typedef struct long_options { + const char *name; /* name of the long option */ + int has_arg; /* whether we should look for an arg */ + char shortval; /* the shortname equivalent of long arg + * this gets returned from get_option */ +} long_options; -extern int H5_get_option(int argc, const char **argv, const char *opt, const struct h5_long_options *l_opt); +extern int get_option(int argc, const char **argv, const char *opt, const struct long_options *l_opt); extern int nCols; /*max number of columns for outputting */ diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c index 6231587..517866b 100644 --- a/tools/test/perform/zip_perf.c +++ b/tools/test/perform/zip_perf.c @@ -64,66 +64,66 @@ static void error(const char *fmt, ...); static void compress_buffer(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen); /* commandline options : long and short form */ -static const char * s_opts = "hB:b:c:p:rs:0123456789"; -static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, - {"compressability", require_arg, 'c'}, - {"compressabilit", require_arg, 'c'}, - {"compressabili", require_arg, 'c'}, - {"compressabil", require_arg, 'c'}, - {"compressabi", require_arg, 'c'}, - {"compressab", require_arg, 'c'}, - {"compressa", require_arg, 'c'}, - {"compress", require_arg, 'c'}, - {"compres", require_arg, 'c'}, - {"compre", require_arg, 'c'}, - {"compr", require_arg, 'c'}, - {"comp", require_arg, 'c'}, - {"com", require_arg, 'c'}, - {"co", require_arg, 'c'}, - {"file-size", require_arg, 's'}, - {"file-siz", require_arg, 's'}, - {"file-si", require_arg, 's'}, - {"file-s", require_arg, 's'}, - {"file", require_arg, 's'}, - {"fil", require_arg, 's'}, - {"fi", require_arg, 's'}, - {"max-buffer-size", require_arg, 'B'}, - {"max-buffer-siz", require_arg, 'B'}, - {"max-buffer-si", require_arg, 'B'}, - {"max-buffer-s", require_arg, 'B'}, - {"max-buffer", require_arg, 'B'}, - {"max-buffe", require_arg, 'B'}, - {"max-buff", require_arg, 'B'}, - {"max-buf", require_arg, 'B'}, - {"max-bu", require_arg, 'B'}, - {"max-b", require_arg, 'B'}, - {"max", require_arg, 'B'}, - {"min-buffer-size", require_arg, 'b'}, - {"min-buffer-siz", require_arg, 'b'}, - {"min-buffer-si", require_arg, 'b'}, - {"min-buffer-s", require_arg, 'b'}, - {"min-buffer", require_arg, 'b'}, - {"min-buffe", require_arg, 'b'}, - {"min-buff", require_arg, 'b'}, - {"min-buf", require_arg, 'b'}, - {"min-bu", require_arg, 'b'}, - {"min-b", require_arg, 'b'}, - {"min", require_arg, 'b'}, - {"prefix", require_arg, 'p'}, - {"prefi", require_arg, 'p'}, - {"pref", require_arg, 'p'}, - {"pre", require_arg, 'p'}, - {"pr", require_arg, 'p'}, - {"random-test", no_arg, 'r'}, - {"random-tes", no_arg, 'r'}, - {"random-te", no_arg, 'r'}, - {"random-t", no_arg, 'r'}, - {"random", no_arg, 'r'}, - {"rando", no_arg, 'r'}, - {"rand", no_arg, 'r'}, - {"ran", no_arg, 'r'}, - {"ra", no_arg, 'r'}, - {NULL, 0, '\0'}}; +static const char * s_opts = "hB:b:c:p:rs:0123456789"; +static struct long_options l_opts[] = {{"help", no_arg, 'h'}, + {"compressability", require_arg, 'c'}, + {"compressabilit", require_arg, 'c'}, + {"compressabili", require_arg, 'c'}, + {"compressabil", require_arg, 'c'}, + {"compressabi", require_arg, 'c'}, + {"compressab", require_arg, 'c'}, + {"compressa", require_arg, 'c'}, + {"compress", require_arg, 'c'}, + {"compres", require_arg, 'c'}, + {"compre", require_arg, 'c'}, + {"compr", require_arg, 'c'}, + {"comp", require_arg, 'c'}, + {"com", require_arg, 'c'}, + {"co", require_arg, 'c'}, + {"file-size", require_arg, 's'}, + {"file-siz", require_arg, 's'}, + {"file-si", require_arg, 's'}, + {"file-s", require_arg, 's'}, + {"file", require_arg, 's'}, + {"fil", require_arg, 's'}, + {"fi", require_arg, 's'}, + {"max-buffer-size", require_arg, 'B'}, + {"max-buffer-siz", require_arg, 'B'}, + {"max-buffer-si", require_arg, 'B'}, + {"max-buffer-s", require_arg, 'B'}, + {"max-buffer", require_arg, 'B'}, + {"max-buffe", require_arg, 'B'}, + {"max-buff", require_arg, 'B'}, + {"max-buf", require_arg, 'B'}, + {"max-bu", require_arg, 'B'}, + {"max-b", require_arg, 'B'}, + {"max", require_arg, 'B'}, + {"min-buffer-size", require_arg, 'b'}, + {"min-buffer-siz", require_arg, 'b'}, + {"min-buffer-si", require_arg, 'b'}, + {"min-buffer-s", require_arg, 'b'}, + {"min-buffer", require_arg, 'b'}, + {"min-buffe", require_arg, 'b'}, + {"min-buff", require_arg, 'b'}, + {"min-buf", require_arg, 'b'}, + {"min-bu", require_arg, 'b'}, + {"min-b", require_arg, 'b'}, + {"min", require_arg, 'b'}, + {"prefix", require_arg, 'p'}, + {"prefi", require_arg, 'p'}, + {"pref", require_arg, 'p'}, + {"pre", require_arg, 'p'}, + {"pr", require_arg, 'p'}, + {"random-test", no_arg, 'r'}, + {"random-tes", no_arg, 'r'}, + {"random-te", no_arg, 'r'}, + {"random-t", no_arg, 'r'}, + {"random", no_arg, 'r'}, + {"rando", no_arg, 'r'}, + {"rand", no_arg, 'r'}, + {"ran", no_arg, 'r'}, + {"ra", no_arg, 'r'}, + {NULL, 0, '\0'}}; /* * Function: error @@ -551,7 +551,7 @@ main(int argc, const char *argv[]) /* Initialize h5tools lib */ h5tools_init(); - while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) > 0) { + while ((opt = get_option(argc, argv, s_opts, l_opts)) > 0) { switch ((char)opt) { case '0': case '1': @@ -566,13 +566,13 @@ main(int argc, const char *argv[]) compress_level = opt - '0'; break; case 'B': - max_buf_size = parse_size_directive(H5_optarg); + max_buf_size = parse_size_directive(opt_arg); break; case 'b': - min_buf_size = parse_size_directive(H5_optarg); + min_buf_size = parse_size_directive(opt_arg); break; case 'c': - compress_percent = (int)HDstrtol(H5_optarg, NULL, 10); + compress_percent = (int)HDstrtol(opt_arg, NULL, 10); if (compress_percent < 0) compress_percent = 0; @@ -581,13 +581,13 @@ main(int argc, const char *argv[]) break; case 'p': - option_prefix = H5_optarg; + option_prefix = opt_arg; break; case 'r': random_test = TRUE; break; case 's': - file_size = parse_size_directive(H5_optarg); + file_size = parse_size_directive(opt_arg); break; case '?': usage(); |