diff --git a/test/test-automation/fuzzer/fuzzer.c b/test/test-automation/fuzzer/fuzzer.c index 72aa272d4..8ee310108 100644 --- a/test/test-automation/fuzzer/fuzzer.c +++ b/test/test-automation/fuzzer/fuzzer.c @@ -50,7 +50,7 @@ GenerateExecKey(CRC32_CTX crcContext, char *runSeed, char *suiteName, utl_crc32Calc(&crcContext, md5Context.digest, sizeof(md5Context.digest), &result); - return result; + return abs(result); // makes sure that the key is positive } void @@ -135,7 +135,7 @@ RandomAsciiStringWithMaximumLength(int maxSize) int counter = 0; for( ; counter < size; ++counter) { - char character = (char) RandomPositiveIntegerInRange(1, 127); + char character = (char) RandomIntegerInRange(1, 127); string[counter] = character; } diff --git a/test/test-automation/fuzzer/fuzzer.h b/test/test-automation/fuzzer/fuzzer.h index 892165200..fc5117b42 100644 --- a/test/test-automation/fuzzer/fuzzer.h +++ b/test/test-automation/fuzzer/fuzzer.h @@ -54,6 +54,18 @@ int RandomInteger(); int RandomPositiveInteger(); +/*! + * todo add markup + */ +int RandomUint8BoundaryValue(); + + +/*! + * todo add markup + */ +int RandomInt8BoundaryValue(); + + /*! * Returns integer in range [min, max]. Min and max * value can be negative values as long as min is smaller than max. @@ -90,18 +102,6 @@ char *RandomAsciiString(); char *RandomAsciiStringWithMaximumLength(int maxLength); -/*! - * todo add markup - */ -int RandomUint8BoundaryValue(); - - -/*! - * todo add markup - */ -int RandomInt8BoundaryValue(); - - /*! * Generates execution key (used for random seed) for a test * diff --git a/test/test-automation/logger.h b/test/test-automation/logger.h index 3a3fd6588..49780ba32 100644 --- a/test/test-automation/logger.h +++ b/test/test-automation/logger.h @@ -28,7 +28,7 @@ * logging interface. See the headers of implementations (plain_logger.h or * xml_logger.h) for more information. */ -typedef void (*RunStartedFp)(int parameterCount, char *runnerParameters[], time_t eventTime, void *data); +typedef void (*RunStartedFp)(int parameterCount, char *runnerParameters[], char *runSeed, time_t eventTime, void *data); typedef void (*RunEndedFp)(int testCount, int suiteCount, int testPassCount, int testFailCount, int testSkippedCount, time_t endTime, double totalRuntime); diff --git a/test/test-automation/logger_helpers.c b/test/test-automation/logger_helpers.c index 017d332ec..eefb8ba88 100644 --- a/test/test-automation/logger_helpers.c +++ b/test/test-automation/logger_helpers.c @@ -4,7 +4,7 @@ #include "logger_helpers.h" /*! - * Helper functions. Turns the given integer in to a string + * Helper function. Turns the given integer in to a string * * Note: uses static buffer internally, so the return value * isn't valid after the next call of this function. If you @@ -23,7 +23,27 @@ char *IntToString(const int integer) { } /*! - * Helper functions. Turns the given double value in to a string + * Helper function. Turns the given integer in to a string in + * hex format. + * + * Note: uses static buffer internally, so the return value + * isn't valid after the next call of this function. If you + * want to retain the return value, make a copy of it + * + * \param integer The converted integer + * \returns Given integer as string in hex fomat + */ +char *IntToHexString(const int integer) { + static char buffer[256]; // malloc might work better + memset(buffer, 0, sizeof(buffer)); + + SDL_snprintf(buffer, sizeof(buffer), "%X", integer); + + return buffer; +} + +/*! + * Helper function. Turns the given double value in to a string * * Note: uses static buffer internally, so the return value * isn't valid after the next call of this function. If you diff --git a/test/test-automation/logger_helpers.h b/test/test-automation/logger_helpers.h index ce727f116..a50fe89d4 100644 --- a/test/test-automation/logger_helpers.h +++ b/test/test-automation/logger_helpers.h @@ -5,6 +5,8 @@ char *IntToString(const int integer); +char *IntToHexString(const int integer); + char *DoubleToString(const double decimal); char *TimestampToString(const time_t timestamp); diff --git a/test/test-automation/plain_logger.c b/test/test-automation/plain_logger.c index 4001db437..0b7e71455 100644 --- a/test/test-automation/plain_logger.c +++ b/test/test-automation/plain_logger.c @@ -37,10 +37,11 @@ Output(const int currentIndentLevel, const char *message, ...) } void -PlainRunStarted(int parameterCount, char *runnerParameters[], time_t eventTime, - void *data) +PlainRunStarted(int parameterCount, char *runnerParameters[], char *runSeed, + time_t eventTime, void *data) { Output(indentLevel, "Test run started at %s", TimestampToString(eventTime)); + Output(indentLevel, "Fuzzer seed is %s", runSeed); Output(indentLevel, "Runner parameters: "); int counter = 0; @@ -83,7 +84,7 @@ void PlainTestStarted(const char *testName, const char *suiteName, const char *testDescription, int execKey, time_t startTime) { - Output(indentLevel++, "Executing test: %s (in %s). Execution key: %d", testName, suiteName, execKey); + Output(indentLevel++, "Executing test: %s (in %s). Exec key: %X", testName, suiteName, execKey); } void diff --git a/test/test-automation/plain_logger.h b/test/test-automation/plain_logger.h index 0a4d2409d..90c652024 100644 --- a/test/test-automation/plain_logger.h +++ b/test/test-automation/plain_logger.h @@ -8,12 +8,13 @@ * * \param parameterCount How many parameters were given * \param runnerParameters What parameters were given to the runner + * \param runSeed Fuzzer seed of the harness * \param eventTime When the execution started * \param data Any additional data logger needs * */ -void PlainRunStarted(int parameterCount, char *runnerParameters[], time_t eventTime, - void *data); +void PlainRunStarted(int parameterCount, char *runnerParameters[], char *runSeed, + time_t eventTime, void *data); /*! * Prints out information about ending the test run. diff --git a/test/test-automation/runner.c b/test/test-automation/runner.c index 42561cbc9..1eecbe03c 100644 --- a/test/test-automation/runner.c +++ b/test/test-automation/runner.c @@ -1052,7 +1052,6 @@ main(int argc, char *argv[]) // print: Testing against SDL version fuu (rev: bar) if verbose == true - char *testSuiteName = NULL; int suiteCounter = 0; @@ -1081,7 +1080,7 @@ main(int argc, char *argv[]) return 0; } - RunStarted(argc, argv, time(0), loggerData); + RunStarted(argc, argv, runSeed, time(0), loggerData); if(execute_inproc && universal_timeout_enabled) { Log(time(0), "Test timeout is not supported with in-proc execution."); diff --git a/test/test-automation/style.xsl b/test/test-automation/style.xsl index 52ca9aa6a..01f800adc 100644 --- a/test/test-automation/style.xsl +++ b/test/test-automation/style.xsl @@ -169,8 +169,8 @@ div, h1 {