cargilld 2004/02/13 05:23:17 Modified: c/scripts sanityTest_ExpectedResult.log c/tests/ThreadTest ThreadTest.cpp Log: Update threadtest to accept -init option instead of using compiler directive. Revision Changes Path 1.64 +1 -0 xml-xerces/c/scripts/sanityTest_ExpectedResult.log Index: sanityTest_ExpectedResult.log =================================================================== RCS file: /home/cvs/xml-xerces/c/scripts/sanityTest_ExpectedResult.log,v retrieving revision 1.63 retrieving revision 1.64 diff -u -r1.63 -r1.64 --- sanityTest_ExpectedResult.log 6 Feb 2004 15:04:16 -0000 1.63 +++ sanityTest_ExpectedResult.log 13 Feb 2004 13:23:17 -0000 1.64 @@ -954,6 +954,7 @@ -time nnn Total time to run, in seconds. Default is forever. -dump Dump DOM tree on error. -mem Read files into memory once only, and parse them from there. + -init Perform an initial parse of the file(s) before starting up the individual threads. 1Test Run Successfully 2Test Run Successfully 1.33 +40 -36 xml-xerces/c/tests/ThreadTest/ThreadTest.cpp Index: ThreadTest.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/tests/ThreadTest/ThreadTest.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- ThreadTest.cpp 10 Dec 2003 15:49:30 -0000 1.32 +++ ThreadTest.cpp 13 Feb 2004 13:23:17 -0000 1.33 @@ -234,6 +234,7 @@ bool doSchema; bool schemaFullChecking; bool doNamespaces; + bool doInitialParse; int totalTime; int numInputFiles; InFileInfo files[MAXINFILES]; @@ -646,6 +647,7 @@ gRunInfo.doSchema = false; gRunInfo.schemaFullChecking = false; gRunInfo.doNamespaces = false; + gRunInfo.doInitialParse = false; gRunInfo.dom = false; gRunInfo.reuseParser = false; gRunInfo.inMemory = false; @@ -682,6 +684,8 @@ else throw 1; } + else if (strcmp(argv[argnum], "-init") == 0) + gRunInfo.doInitialParse = true; else if (strcmp(argv[argnum], "-reuse") == 0) gRunInfo.reuseParser = true; else if (strcmp(argv[argnum], "-dump") == 0) @@ -749,7 +753,8 @@ " -threads nnn Number of threads. Default is 2.\n" " -time nnn Total time to run, in seconds. Default is forever.\n" " -dump Dump DOM tree on error.\n" - " -mem Read files into memory once only, and parse them from there.\n\n" + " -mem Read files into memory once only, and parse them from there.\n" + " -init Perform an initial parse of the file(s) before starting up the individual threads.\n\n" ); exit(1); } @@ -867,10 +872,9 @@ int checkSum = 0; checkSum = thParser->parse(docNum); - // SRD -- for the case where we skip the preparse we will have nothing - // to compare the first parse's results to ... so if this looks like - // first parser move the checkSum back into the gRunInfo data for this - // file. + // For the case where we skip the preparse we will have nothing to + // compare the first parse's results to ... so if this looks like first + // parse move the checkSum back into the gRunInfo data for this file. if (gRunInfo.files[docNum].checkSum == 0) { @@ -950,52 +954,52 @@ // ReadFilesIntoMemory(); - // SRD -- initialize checksums to zero so we can check first parse and if - // zero then we need to move first parse's checksum into array + // Initialize checksums to zero so we can check first parse and if + // zero then we need to move first parse's checksum into array. This + // is for the cse where we skip the initial parse. for (int n = 0; n < gRunInfo.numInputFiles; n++) { gRunInfo.files[n].checkSum = 0; } -#ifdef DOINITIALPARSE + if (gRunInfo.doInitialParse) + { // // While we are still single threaded, parse each of the documents // once, to check for errors, and to note the checksum. // Blow off the rest of the test if there are errors. // - ThreadParser *mainParser = new ThreadParser; - int n; - bool errors = false; - int cksum; - + ThreadParser *mainParser = new ThreadParser; + int n; + bool errors = false; + int cksum; - for (n = 0; n < gRunInfo.numInputFiles; n++) - { - char *fileName = gRunInfo.files[n].fileName; - if (gRunInfo.verbose) - printf("%s checksum is ", fileName); + for (n = 0; n < gRunInfo.numInputFiles; n++) + { + char *fileName = gRunInfo.files[n].fileName; + if (gRunInfo.verbose) + printf("%s checksum is ", fileName); - cksum = mainParser->parse(n); + cksum = mainParser->parse(n); - if (cksum == 0) - { - fprintf(stderr, "An error occurred while initially parsing %s\n", - fileName); - errors = true; - }; + if (cksum == 0) + { + fprintf(stderr, "An error occurred while initially parsing %s\n", + fileName); + errors = true; + }; + + gRunInfo.files[n].checkSum = cksum; + if (gRunInfo.verbose ) + printf("%x\n", cksum); + if (gRunInfo.dumpOnErr && errors) { + if (gRunInfo.dom) + mainParser->domPrint(); + } - gRunInfo.files[n].checkSum = cksum; - if (gRunInfo.verbose ) - printf("%x\n", cksum); - if (gRunInfo.dumpOnErr && errors) { - if (gRunInfo.dom) - mainParser->domPrint(); } - + delete mainParser; } - - delete mainParser; -#endif // // Fire off the requested number of parallel threads
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]