Logger logs harness seed and test execution keys in hex representation.
1.1 --- a/test/test-automation/fuzzer/fuzzer.c Mon Jul 25 18:51:57 2011 +0300
1.2 +++ b/test/test-automation/fuzzer/fuzzer.c Mon Jul 25 19:33:32 2011 +0300
1.3 @@ -50,7 +50,7 @@
1.4
1.5 utl_crc32Calc(&crcContext, md5Context.digest, sizeof(md5Context.digest), &result);
1.6
1.7 - return result;
1.8 + return abs(result); // makes sure that the key is positive
1.9 }
1.10
1.11 void
1.12 @@ -135,7 +135,7 @@
1.13
1.14 int counter = 0;
1.15 for( ; counter < size; ++counter) {
1.16 - char character = (char) RandomPositiveIntegerInRange(1, 127);
1.17 + char character = (char) RandomIntegerInRange(1, 127);
1.18 string[counter] = character;
1.19 }
1.20
2.1 --- a/test/test-automation/fuzzer/fuzzer.h Mon Jul 25 18:51:57 2011 +0300
2.2 +++ b/test/test-automation/fuzzer/fuzzer.h Mon Jul 25 19:33:32 2011 +0300
2.3 @@ -55,6 +55,18 @@
2.4
2.5
2.6 /*!
2.7 + * todo add markup
2.8 + */
2.9 +int RandomUint8BoundaryValue();
2.10 +
2.11 +
2.12 +/*!
2.13 + * todo add markup
2.14 + */
2.15 +int RandomInt8BoundaryValue();
2.16 +
2.17 +
2.18 +/*!
2.19 * Returns integer in range [min, max]. Min and max
2.20 * value can be negative values as long as min is smaller than max.
2.21 * Min and max also can't be the same value.
2.22 @@ -91,18 +103,6 @@
2.23
2.24
2.25 /*!
2.26 - * todo add markup
2.27 - */
2.28 -int RandomUint8BoundaryValue();
2.29 -
2.30 -
2.31 -/*!
2.32 - * todo add markup
2.33 - */
2.34 -int RandomInt8BoundaryValue();
2.35 -
2.36 -
2.37 -/*!
2.38 * Generates execution key (used for random seed) for a test
2.39 *
2.40 * \param runSeed Seed of the harness
3.1 --- a/test/test-automation/logger.h Mon Jul 25 18:51:57 2011 +0300
3.2 +++ b/test/test-automation/logger.h Mon Jul 25 19:33:32 2011 +0300
3.3 @@ -28,7 +28,7 @@
3.4 * logging interface. See the headers of implementations (plain_logger.h or
3.5 * xml_logger.h) for more information.
3.6 */
3.7 -typedef void (*RunStartedFp)(int parameterCount, char *runnerParameters[], time_t eventTime, void *data);
3.8 +typedef void (*RunStartedFp)(int parameterCount, char *runnerParameters[], char *runSeed, time_t eventTime, void *data);
3.9 typedef void (*RunEndedFp)(int testCount, int suiteCount, int testPassCount, int testFailCount,
3.10 int testSkippedCount, time_t endTime, double totalRuntime);
3.11
4.1 --- a/test/test-automation/logger_helpers.c Mon Jul 25 18:51:57 2011 +0300
4.2 +++ b/test/test-automation/logger_helpers.c Mon Jul 25 19:33:32 2011 +0300
4.3 @@ -4,7 +4,7 @@
4.4 #include "logger_helpers.h"
4.5
4.6 /*!
4.7 - * Helper functions. Turns the given integer in to a string
4.8 + * Helper function. Turns the given integer in to a string
4.9 *
4.10 * Note: uses static buffer internally, so the return value
4.11 * isn't valid after the next call of this function. If you
4.12 @@ -23,7 +23,27 @@
4.13 }
4.14
4.15 /*!
4.16 - * Helper functions. Turns the given double value in to a string
4.17 + * Helper function. Turns the given integer in to a string in
4.18 + * hex format.
4.19 + *
4.20 + * Note: uses static buffer internally, so the return value
4.21 + * isn't valid after the next call of this function. If you
4.22 + * want to retain the return value, make a copy of it
4.23 + *
4.24 + * \param integer The converted integer
4.25 + * \returns Given integer as string in hex fomat
4.26 + */
4.27 +char *IntToHexString(const int integer) {
4.28 + static char buffer[256]; // malloc might work better
4.29 + memset(buffer, 0, sizeof(buffer));
4.30 +
4.31 + SDL_snprintf(buffer, sizeof(buffer), "%X", integer);
4.32 +
4.33 + return buffer;
4.34 +}
4.35 +
4.36 +/*!
4.37 + * Helper function. Turns the given double value in to a string
4.38 *
4.39 * Note: uses static buffer internally, so the return value
4.40 * isn't valid after the next call of this function. If you
5.1 --- a/test/test-automation/logger_helpers.h Mon Jul 25 18:51:57 2011 +0300
5.2 +++ b/test/test-automation/logger_helpers.h Mon Jul 25 19:33:32 2011 +0300
5.3 @@ -5,6 +5,8 @@
5.4
5.5 char *IntToString(const int integer);
5.6
5.7 +char *IntToHexString(const int integer);
5.8 +
5.9 char *DoubleToString(const double decimal);
5.10
5.11 char *TimestampToString(const time_t timestamp);
6.1 --- a/test/test-automation/plain_logger.c Mon Jul 25 18:51:57 2011 +0300
6.2 +++ b/test/test-automation/plain_logger.c Mon Jul 25 19:33:32 2011 +0300
6.3 @@ -37,10 +37,11 @@
6.4 }
6.5
6.6 void
6.7 -PlainRunStarted(int parameterCount, char *runnerParameters[], time_t eventTime,
6.8 - void *data)
6.9 +PlainRunStarted(int parameterCount, char *runnerParameters[], char *runSeed,
6.10 + time_t eventTime, void *data)
6.11 {
6.12 Output(indentLevel, "Test run started at %s", TimestampToString(eventTime));
6.13 + Output(indentLevel, "Fuzzer seed is %s", runSeed);
6.14 Output(indentLevel, "Runner parameters: ");
6.15
6.16 int counter = 0;
6.17 @@ -83,7 +84,7 @@
6.18 PlainTestStarted(const char *testName, const char *suiteName,
6.19 const char *testDescription, int execKey, time_t startTime)
6.20 {
6.21 - Output(indentLevel++, "Executing test: %s (in %s). Execution key: %d", testName, suiteName, execKey);
6.22 + Output(indentLevel++, "Executing test: %s (in %s). Exec key: %X", testName, suiteName, execKey);
6.23 }
6.24
6.25 void
7.1 --- a/test/test-automation/plain_logger.h Mon Jul 25 18:51:57 2011 +0300
7.2 +++ b/test/test-automation/plain_logger.h Mon Jul 25 19:33:32 2011 +0300
7.3 @@ -8,12 +8,13 @@
7.4 *
7.5 * \param parameterCount How many parameters were given
7.6 * \param runnerParameters What parameters were given to the runner
7.7 + * \param runSeed Fuzzer seed of the harness
7.8 * \param eventTime When the execution started
7.9 * \param data Any additional data logger needs
7.10 *
7.11 */
7.12 -void PlainRunStarted(int parameterCount, char *runnerParameters[], time_t eventTime,
7.13 - void *data);
7.14 +void PlainRunStarted(int parameterCount, char *runnerParameters[], char *runSeed,
7.15 + time_t eventTime, void *data);
7.16
7.17 /*!
7.18 * Prints out information about ending the test run.
8.1 --- a/test/test-automation/runner.c Mon Jul 25 18:51:57 2011 +0300
8.2 +++ b/test/test-automation/runner.c Mon Jul 25 19:33:32 2011 +0300
8.3 @@ -1052,7 +1052,6 @@
8.4
8.5 // print: Testing against SDL version fuu (rev: bar) if verbose == true
8.6
8.7 -
8.8 char *testSuiteName = NULL;
8.9 int suiteCounter = 0;
8.10
8.11 @@ -1081,7 +1080,7 @@
8.12 return 0;
8.13 }
8.14
8.15 - RunStarted(argc, argv, time(0), loggerData);
8.16 + RunStarted(argc, argv, runSeed, time(0), loggerData);
8.17
8.18 if(execute_inproc && universal_timeout_enabled) {
8.19 Log(time(0), "Test timeout is not supported with in-proc execution.");
9.1 --- a/test/test-automation/style.xsl Mon Jul 25 18:51:57 2011 +0300
9.2 +++ b/test/test-automation/style.xsl Mon Jul 25 19:33:32 2011 +0300
9.3 @@ -169,8 +169,8 @@
9.4 <h1>Test Report</h1>
9.5 <div>
9.6 <span class="title">Start time: </span><xsl:value-of select="testlog/startTime"/><br/>
9.7 - <!-- and ended at <xsl:value-of select="testlog/endTime"/>.<br/>-->
9.8 <span class="title">Total runtime: </span><xsl:value-of select="testlog/totalRuntime"/> seconds.<br/>
9.9 + <span class="title">Fuzz seed: </span><xsl:value-of select="testlog/seed"/><br/>
9.10 <span class="title">Harness parameters: </span>
9.11 <span xml:space="preserve">
9.12 <xsl:for-each select="testlog/parameters/parameter">
9.13 @@ -184,7 +184,6 @@
9.14 <span>Tests in total: </span> <xsl:value-of select="testlog/numTests"/> (passed: <xsl:value-of select="testlog/numPassedTests"/>, failed: <xsl:value-of select="testlog/numFailedTests"/>, skipped: <xsl:value-of select="testlog/numSkippedTests"/>)
9.15 </div>
9.16 </div>
9.17 -
9.18 <div>
9.19 <br/>
9.20 <span class="bigtitle">Test Results</span><br/>
9.21 @@ -214,6 +213,7 @@
9.22 (<xsl:value-of select="resultDescription"/>)
9.23 </span>
9.24 </xsl:if>
9.25 + - exec-key: <xsl:value-of select="executionKey"/>
9.26 (Total runtime: <xsl:value-of select="totalRuntime"/> seconds)<br/>
9.27 Description: <span class="description"> <xsl:value-of select="description"/> </span><br/>
9.28 <span class="switch show-asserts" uid="{generate-id(assertSummary)}">[Show Assert Summary]</span><br/>
9.29 @@ -242,6 +242,7 @@
9.30 </body>
9.31 </html>
9.32
9.33 +
9.34 </xsl:template>
9.35 </xsl:stylesheet>
9.36
10.1 --- a/test/test-automation/testdummy/testdummy.c Mon Jul 25 18:51:57 2011 +0300
10.2 +++ b/test/test-automation/testdummy/testdummy.c Mon Jul 25 19:33:32 2011 +0300
10.3 @@ -91,7 +91,7 @@
10.4 {
10.5 AssertEquals(5, 5, "Assert message");
10.6
10.7 - for(; 1 ;) {
10.8 + for(; 0 ;) {
10.9 Log(0, "uint8: %d", RandomUint8BoundaryValue());
10.10 Log(0, "int8: %d", RandomInt8BoundaryValue());
10.11
10.12 @@ -100,7 +100,7 @@
10.13 for(; 0 ;) {
10.14 int min = -5;
10.15 int max = 5;
10.16 - int random = RandomPositiveIntegerInRange(min, max);
10.17 + int random = RandomIntegerInRange(min, max);
10.18 if(random < min || random > max ) {
10.19 AssertFail("Generated incorrect integer");
10.20 }
11.1 --- a/test/test-automation/xml_logger.c Mon Jul 25 18:51:57 2011 +0300
11.2 +++ b/test/test-automation/xml_logger.c Mon Jul 25 19:33:32 2011 +0300
11.3 @@ -35,6 +35,7 @@
11.4 const char *parametersElementName = "parameters";
11.5 const char *parameterElementName = "parameter";
11.6 const char *startTimeElementName = "startTime";
11.7 +const char *seedElementName = "seed";
11.8 const char *execKeyElementName = "executionKey";
11.9 const char *numSuitesElementName = "numSuites";
11.10 const char *numTestElementName = "numTests";
11.11 @@ -109,14 +110,15 @@
11.12 }
11.13
11.14 void
11.15 -XMLRunStarted(int parameterCount, char *runnerParameters[], time_t eventTime,
11.16 - void *data)
11.17 +XMLRunStarted(int parameterCount, char *runnerParameters[], char *runSeed,
11.18 + time_t eventTime, void *data)
11.19 {
11.20 char *xslStylesheet = (char *)data;
11.21
11.22 char *output = XMLOpenDocument(documentRoot, xslStylesheet);
11.23 XMLOutputter(indentLevel++, YES, output);
11.24
11.25 + // log harness parameters
11.26 output = XMLOpenElement(parametersElementName);
11.27 XMLOutputter(indentLevel++, YES, output);
11.28
11.29 @@ -137,6 +139,17 @@
11.30 output = XMLCloseElement(parametersElementName);
11.31 XMLOutputter(--indentLevel, YES, output);
11.32
11.33 + // log seed
11.34 + output = XMLOpenElement(seedElementName);
11.35 + XMLOutputter(indentLevel++, NO, output);
11.36 +
11.37 + output = XMLAddContent(runSeed);
11.38 + XMLOutputter(indentLevel, NO, output);
11.39 +
11.40 + output = XMLCloseElement(seedElementName);
11.41 + XMLOutputter(--indentLevel, YES, output);
11.42 +
11.43 + // log start time
11.44 output = XMLOpenElement(startTimeElementName);
11.45 XMLOutputter(indentLevel++, NO, output);
11.46
11.47 @@ -340,7 +353,7 @@
11.48 output = XMLOpenElement(execKeyElementName);
11.49 XMLOutputter(indentLevel++, NO, output);
11.50
11.51 - output = XMLAddContent(IntToString(execKey));
11.52 + output = XMLAddContent(IntToHexString(execKey));
11.53 XMLOutputter(indentLevel, NO, output);
11.54
11.55 output = XMLCloseElement(execKeyElementName);
12.1 --- a/test/test-automation/xml_logger.h Mon Jul 25 18:51:57 2011 +0300
12.2 +++ b/test/test-automation/xml_logger.h Mon Jul 25 19:33:32 2011 +0300
12.3 @@ -8,10 +8,12 @@
12.4 *
12.5 * \param parameterCount How many parameters were given
12.6 * \param runnerParameters What parameters were given to the runner
12.7 + * \param runSeed Fuzzer seed of the harness
12.8 * \param eventTime When the execution started
12.9 * \param data Any additional data logger needs
12.10 */
12.11 -void XMLRunStarted(int parameterCount, char *runnerParameters[], time_t eventTime, void *data);
12.12 +void XMLRunStarted(int parameterCount, char *runnerParameters[], char *runSeed,
12.13 + time_t eventTime, void *data);
12.14
12.15 /*!
12.16 * Prints out information about ending the test run in XML