summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2014-07-22 19:40:41 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2014-07-22 19:40:41 (GMT)
commitfe090c1a5c8fc2038a293e7d81da2b7af691ba6d (patch)
treedfe3c81a597938a769637b25642cb586172ec290 /test
parent8ee0ef54a4ea70099caaa31c2e93964df29d9738 (diff)
downloadhdf5-fe090c1a5c8fc2038a293e7d81da2b7af691ba6d.zip
hdf5-fe090c1a5c8fc2038a293e7d81da2b7af691ba6d.tar.gz
hdf5-fe090c1a5c8fc2038a293e7d81da2b7af691ba6d.tar.bz2
[svn-r25466] Bug fix: HDFFV-8881
testfrome.c has incorrectly exit code (using -1). Fixed by replacing them with C defined EXIT_FAILURE. Verified by temporary decreaing MAXNUMTESTS to introduce failure in testhdf to see the changed code did work. Also replaced all other correctly coded exit codes with the C defined EXIT_SUCCESS and EXIT_FAILURE. This would help portability for non-Unix systems. Tested: h5committest.
Diffstat (limited to 'test')
-rw-r--r--test/testframe.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/test/testframe.c b/test/testframe.c
index 8805a82..6a878da 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -69,6 +69,8 @@ static int (*TestPrivateParser)(int ac, char *av[]) = NULL;
* TheDescr--Long description of the test.
* Parameters--pointer to extra parameters. Use NULL if none used.
* Since only the pointer is copied, the contents should not change.
+ * Return: Void
+ * exit EXIT_FAILURE if error is encountered.
*/
void
AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), const char *TheDescr, const void *Parameters)
@@ -77,17 +79,17 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con
if (Index >= MAXNUMOFTESTS) {
printf("Too many tests added, increase MAXNUMOFTESTS(%d).\n",
MAXNUMOFTESTS);
- exit(-1);
+ exit(EXIT_FAILURE);
} /* end if */
if (HDstrlen(TheDescr) >= MAXTESTDESC) {
printf("Test description too long, increase MAXTESTDESC(%d).\n",
MAXTESTDESC);
- exit(-1);
+ exit(EXIT_FAILURE);
} /* end if */
if (HDstrlen(TheName) >= MAXTESTNAME) {
printf("Test name too long, increase MAXTESTNAME(%d).\n",
MAXTESTNAME);
- exit(-1);
+ exit(EXIT_FAILURE);
} /* end if */
/* Set up test function */
@@ -207,6 +209,9 @@ void TestInfo(const char *ProgName)
* Parse command line information.
* argc, argv: the usual command line argument count and strings
*
+ * Return: Void
+ * exit EXIT_FAILURE if error is encountered.
+ *
* Modification:
* 2004/08/18 Albert Cheng. Add extra_parse feature.
*/
@@ -222,7 +227,7 @@ void TestParseCmdLine(int argc, char *argv[])
ParseTestVerbosity(*argv);
}else{
TestUsage();
- exit(1);
+ exit(EXIT_FAILURE);
}
}
else if (((HDstrcmp(*argv, "-exclude") == 0) ||
@@ -232,7 +237,7 @@ void TestParseCmdLine(int argc, char *argv[])
SetTest(*argv, SKIPTEST);
}else{
TestUsage();
- exit(1);
+ exit(EXIT_FAILURE);
}
}
else if (((HDstrcmp(*argv, "-begin") == 0) ||
@@ -242,7 +247,7 @@ void TestParseCmdLine(int argc, char *argv[])
SetTest(*argv, BEGINTEST);
}else{
TestUsage();
- exit(1);
+ exit(EXIT_FAILURE);
}
}
else if (((HDstrcmp(*argv, "-only") == 0) ||
@@ -256,14 +261,14 @@ void TestParseCmdLine(int argc, char *argv[])
SetTest(*argv, ONLYTEST);
}else{
TestUsage();
- exit(1);
+ exit(EXIT_FAILURE);
}
}
else if ((HDstrcmp(*argv, "-summary") == 0) || (HDstrcmp(*argv, "-s") == 0))
Summary = 1;
else if ((HDstrcmp(*argv, "-help") == 0) || (HDstrcmp(*argv, "-h") == 0)) {
TestUsage();
- exit(0);
+ exit(EXIT_SUCCESS);
}
else if ((HDstrcmp(*argv, "-cleanoff") == 0) || (HDstrcmp(*argv, "-c") == 0))
SetTestNoCleanup();
@@ -278,7 +283,7 @@ void TestParseCmdLine(int argc, char *argv[])
if (NULL != TestPrivateParser){
ret_code=TestPrivateParser(argc+1, argv-1);
if (ret_code != 0)
- exit(-1);
+ exit(EXIT_FAILURE);
}
}