Merge pull request #99 from glennklockwood/issue87

fixes #87
master
Julian Kunkel 2018-10-06 16:54:23 +01:00 committed by GitHub
commit c6580dc93b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 6 deletions

View File

@ -365,6 +365,7 @@ IOR_test_t *ReadConfigScript(char *scriptName)
int runflag = 0;
char linebuf[MAX_STR];
char empty[MAX_STR];
char *ptr;
FILE *file;
IOR_test_t *head = NULL;
IOR_test_t *tail = NULL;
@ -387,15 +388,22 @@ IOR_test_t *ReadConfigScript(char *scriptName)
/* Iterate over a block of IOR commands */
while (fgets(linebuf, MAX_STR, file) != NULL) {
/* skip over leading whitespace */
ptr = linebuf;
while (isspace(*ptr))
ptr++;
/* skip empty lines */
if (sscanf(linebuf, "%s", empty) == -1)
if (sscanf(ptr, "%s", empty) == -1)
continue;
/* skip lines containing only comments */
if (sscanf(linebuf, " #%s", empty) == 1)
if (sscanf(ptr, " #%s", empty) == 1)
continue;
if (contains_only(linebuf, "ior stop")) {
if (contains_only(ptr, "ior stop")) {
break;
} else if (contains_only(linebuf, "run")) {
} else if (contains_only(ptr, "run")) {
if (runflag) {
/* previous line was a "run" as well
create duplicate test */
@ -411,9 +419,9 @@ IOR_test_t *ReadConfigScript(char *scriptName)
tail->next = CreateTest(&tail->params, test_num++);
AllocResults(tail);
tail = tail->next;
ParseLine(linebuf, &tail->params);
ParseLine(ptr, &tail->params);
} else {
ParseLine(linebuf, &tail->params);
ParseLine(ptr, &tail->params);
}
}

View File

@ -23,4 +23,7 @@ IOR 2 -a POSIX -r -z -Z -Q 2 -F -k -e -i1 -m -t 100k -b 100k
IOR 2 -a POSIX -r -z -Z -Q 3 -X 13 -F -k -e -i1 -m -t 100k -b 100k
IOR 2 -a POSIX -w -z -Z -Q 1 -X -13 -F -e -i1 -m -t 100k -b 100k
IOR 2 -f "$ROOT/test_comments.ior"
END

17
testing/test_comments.ior Normal file
View File

@ -0,0 +1,17 @@
# test to ensure that leading whitespace is ignored
IOR START
api=posix
writeFile =1
randomOffset=1
reorderTasks=1
filePerProc=1
keepFile=1
fsync=1
repetitions=1
multiFile=1
# tab-prefixed comment
transferSize=100k
blockSize=100k
# space-prefixed comment
run
ior stop