summaryrefslogtreecommitdiffstats
path: root/test/tcheck_version.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-09-29 15:21:35 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-09-29 15:21:35 (GMT)
commitee5a1e07350f0dcf3ef07d9443aa2f4c073392f4 (patch)
treec53de6e31b5071d33edf877383d943dc683ad51b /test/tcheck_version.c
parentfeed8687714f0f7148475a31d1e815ff78ad452d (diff)
downloadhdf5-ee5a1e07350f0dcf3ef07d9443aa2f4c073392f4.zip
hdf5-ee5a1e07350f0dcf3ef07d9443aa2f4c073392f4.tar.gz
hdf5-ee5a1e07350f0dcf3ef07d9443aa2f4c073392f4.tar.bz2
[svn-r17547] Description:
Bring r17518:17546 from trunk to revise_chunks branch Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.5.8 (amazon) in debug mode Mac OS X/32 10.5.8 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'test/tcheck_version.c')
-rw-r--r--test/tcheck_version.c99
1 files changed, 99 insertions, 0 deletions
diff --git a/test/tcheck_version.c b/test/tcheck_version.c
new file mode 100644
index 0000000..7a34b26
--- /dev/null
+++ b/test/tcheck_version.c
@@ -0,0 +1,99 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * This tests the h5check_version() function.
+ *
+ * The default is to call the h5check_version() with the version information
+ * in the header file and should incur no warnings or abort.
+ * Options provided to call it with incorrect versions to test
+ * if it will indeed issue the warning message and aborts. With environment
+ * variable $HDF5_DISABLE_VERSION_CHECK sets to 1, it should issue warnings
+ * but no abort. If it is 2, no warning or abort.
+ *
+ * Programmer: Albert Cheng
+ * September 20, 2009
+ */
+
+
+#include <stdlib.h>
+#include "hdf5.h"
+
+#define progname "tcheck_version"
+
+/* global variables */
+unsigned major = H5_VERS_MAJOR;
+unsigned minor = H5_VERS_MINOR;
+unsigned release = H5_VERS_RELEASE;
+
+void
+showhelp(void)
+{
+ printf("Usage: " progname " [-h] [-t<vers>]\n");
+ printf("\t-h\tShow this page and version information\n");
+ printf("\t-t<vers>: Test by changing (adding 1 to) the <vers> to trigger\n");
+ printf("\t\t the warning. <vers> can be:\n");
+ printf("\t\t\tM for Major version number (%d)\n", H5_VERS_MAJOR);
+ printf("\t\t\tm for Minor version number (%d)\n", H5_VERS_MINOR);
+ printf("\t\t\tr for Release number (%d)\n", H5_VERS_RELEASE);
+}
+
+
+void
+parse(int ac, char **av)
+{
+ char *pt;
+
+ while (--ac > 0){
+ pt = *(++av);
+ if (*pt != '-') {
+ fprintf(stderr, "Unknown option(%s). Aborted.\n", *av);
+ exit(1);
+ }else{
+ switch(*(++pt)) {
+ case 't': /* option -t */
+ switch(*(++pt)) {
+ case 'M':
+ major++;
+ break;
+ case 'm':
+ minor++;
+ break;
+ case 'r':
+ release++;
+ break;
+ default:
+ fprintf(stderr, "Unknown -v parameter (%s). Aborted.\n", *av);
+ exit(1);
+ }
+ break;
+ case 'h': /* help page */
+ showhelp();
+ exit(0);
+ default:
+ fprintf(stderr, "Unknown option(%s). Aborted.\n", *av);
+ exit(1);
+ }
+ }
+ }
+}
+
+int
+main(int ac, char **av)
+{
+ parse(ac, av);
+ H5check_version(major, minor, release);
+ return 0;
+}