summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2004-04-03 21:43:20 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2004-04-03 21:43:20 (GMT)
commit740a672798d4e0b9c946aea8b94eb7e1b8d74a6e (patch)
tree2feceed54651b788b874cd9c193e9af9f2b3aabd
parent79e7ccdd03fdec83554dc4d231642779985e1f5a (diff)
downloadhdf5-740a672798d4e0b9c946aea8b94eb7e1b8d74a6e.zip
hdf5-740a672798d4e0b9c946aea8b94eb7e1b8d74a6e.tar.gz
hdf5-740a672798d4e0b9c946aea8b94eb7e1b8d74a6e.tar.bz2
[svn-r8299] Purpose:
Code cleanup (sort of) Description: Added SetTest() to handle test controls. Platforms tested: h5committested.
-rw-r--r--test/h5test.h9
-rw-r--r--test/testframe.c62
2 files changed, 59 insertions, 12 deletions
diff --git a/test/h5test.h b/test/h5test.h
index fa4ed43..99706f0 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -68,6 +68,13 @@
#define VERBOSE_HI (GetTestVerbosity()>=VERBO_HI)
/*
+ * Test controls definitions.
+ */
+#define SKIPTEST 1 /* Skip this test */
+#define ONLYTEST 2 /* Do only this test */
+#define BEGINTEST 3 /* Skip all tests before this test */
+
+/*
* This contains the filename prefix specificied as command line option for
* the parallel test files.
*/
@@ -129,6 +136,8 @@ H5TEST_DLL void ParseTestVerbosity(char *argv);
H5TEST_DLL int GetTestNumErrs(void);
H5TEST_DLL void *GetTestParameters(void);
H5TEST_DLL int TestErrPrintf(const char *format, ...);
+H5TEST_DLL void SetTest(const char *testname, int action);
+
#ifdef H5_HAVE_PARALLEL
H5TEST_DLL int h5_set_info_object(void);
diff --git a/test/testframe.c b/test/testframe.c
index 7373d54..4539276 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -192,9 +192,7 @@ void TestParseCmdLine(int argc, char *argv[], int *Summary, int *CleanUp)
(HDstrcmp(argv[CLLoop], "-x") == 0))) {
Loop = CLLoop + 1;
while ((Loop < argc) && (argv[Loop][0] != '-')) {
- for (Loop1 = 0; Loop1 < Index; Loop1++)
- if (HDstrcmp(argv[Loop], Test[Loop1].Name) == 0)
- Test[Loop1].SkipFlag = 1;
+ SetTest(argv[Loop], SKIPTEST);
Loop++;
} /* end while */
} /* end if */
@@ -202,12 +200,7 @@ void TestParseCmdLine(int argc, char *argv[], int *Summary, int *CleanUp)
(HDstrcmp(argv[CLLoop], "-b") == 0))) {
Loop = CLLoop + 1;
while ((Loop < argc) && (argv[Loop][0] != '-')) {
- for (Loop1 = 0; Loop1 < Index; Loop1++) {
- if (HDstrcmp(argv[Loop], Test[Loop1].Name) != 0)
- Test[Loop1].SkipFlag = 1;
- if (HDstrcmp(argv[Loop], Test[Loop1].Name) == 0)
- Loop1 = Index;
- } /* end for */
+ SetTest(argv[Loop], BEGINTEST);
Loop++;
} /* end while */
} /* end if */
@@ -218,9 +211,7 @@ void TestParseCmdLine(int argc, char *argv[], int *Summary, int *CleanUp)
Loop = CLLoop + 1;
while ((Loop < argc) && (argv[Loop][0] != '-')) {
- for (Loop1 = 0; Loop1 < Index; Loop1++)
- if (HDstrcmp(argv[Loop], Test[Loop1].Name) == 0)
- Test[Loop1].SkipFlag = 0;
+ SetTest(argv[Loop], ONLYTEST);
Loop++;
} /* end while */
} /* end if */
@@ -375,3 +366,50 @@ TestErrPrintf(const char *format, ...)
return ret_value;
}
+
+/*
+ * Set (control) which test will be tested.
+ * SKIPTEST: skip this test
+ * ONLYTEST: do only this test
+ * BEGINETEST: skip all tests before this test
+ *
+ */
+void SetTest(const char *testname, int action)
+{
+ int Loop;
+
+ switch (action){
+ case SKIPTEST:
+ for (Loop = 0; Loop < Index; Loop++)
+ if (HDstrcmp(testname, Test[Loop].Name) == 0){
+ Test[Loop].SkipFlag = 1;
+ break;
+ }
+ break;
+ case BEGINTEST:
+ for (Loop = 0; Loop < Index; Loop++) {
+ if (HDstrcmp(testname, Test[Loop].Name) != 0)
+ Test[Loop].SkipFlag = 1;
+ else
+ break;
+ }
+ break;
+ case ONLYTEST:
+ for (Loop = 0; Loop < Index; Loop++) {
+ if (HDstrcmp(testname, Test[Loop].Name) != 0)
+ Test[Loop].SkipFlag = 1;
+ else {
+ Test[Loop].SkipFlag = 0;
+ break;
+ }
+ }
+ /* skip the rest */
+ while (++Loop < Index)
+ Test[Loop].SkipFlag = 1;
+ break;
+ default:
+ /* error */
+ printf("*** ERROR: Unknown action (%d) for SetTest\n", action);
+ break;
+ }
+}