Hydra: Support %p in test summaries (#5626)
This commit is contained in:
parent
0a830b5a5a
commit
7f52fca8fe
2 changed files with 15 additions and 9 deletions
|
@ -379,7 +379,7 @@ u32 RandomUniform(enum RandomTag tag, u32 lo, u32 hi)
|
||||||
}
|
}
|
||||||
else if (STATE->trials != n)
|
else if (STATE->trials != n)
|
||||||
{
|
{
|
||||||
Test_ExitWithResult(TEST_RESULT_ERROR, SourceLine(0), ":LRandomUniform called with inconsistent trials %d and %d", STATE->trials, n);
|
Test_ExitWithResult(TEST_RESULT_ERROR, SourceLine(0), ":LRandomUniform called from %p with tag %d and inconsistent trials %d and %d", __builtin_extract_return_addr(__builtin_return_address(0)), tag, STATE->trials, n);
|
||||||
}
|
}
|
||||||
STATE->trialRatio = Q_4_12(1) / STATE->trials;
|
STATE->trialRatio = Q_4_12(1) / STATE->trials;
|
||||||
return STATE->runTrial + lo;
|
return STATE->runTrial + lo;
|
||||||
|
@ -421,7 +421,7 @@ u32 RandomUniformExcept(enum RandomTag tag, u32 lo, u32 hi, bool32 (*reject)(u32
|
||||||
while (reject(STATE->runTrial + lo + STATE->rngTrialOffset))
|
while (reject(STATE->runTrial + lo + STATE->rngTrialOffset))
|
||||||
{
|
{
|
||||||
if (STATE->runTrial + lo + STATE->rngTrialOffset > hi)
|
if (STATE->runTrial + lo + STATE->rngTrialOffset > hi)
|
||||||
Test_ExitWithResult(TEST_RESULT_INVALID, SourceLine(0), ":LRandomUniformExcept called with inconsistent reject");
|
Test_ExitWithResult(TEST_RESULT_ERROR, SourceLine(0), ":LRandomUniformExcept called from %p with tag %d and inconsistent reject", __builtin_extract_return_addr(__builtin_return_address(0)), tag);
|
||||||
STATE->rngTrialOffset++;
|
STATE->rngTrialOffset++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,7 +432,7 @@ u32 RandomUniformExcept(enum RandomTag tag, u32 lo, u32 hi, bool32 (*reject)(u32
|
||||||
while (reject(default_))
|
while (reject(default_))
|
||||||
{
|
{
|
||||||
if (default_ == lo)
|
if (default_ == lo)
|
||||||
Test_ExitWithResult(TEST_RESULT_INVALID, SourceLine(0), ":LRandomUniformExcept rejected all values");
|
Test_ExitWithResult(TEST_RESULT_ERROR, SourceLine(0), ":LRandomUniformExcept called from %p with tag %d rejected all values", __builtin_extract_return_addr(__builtin_return_address(0)), tag);
|
||||||
default_--;
|
default_--;
|
||||||
}
|
}
|
||||||
return default_;
|
return default_;
|
||||||
|
@ -462,7 +462,7 @@ u32 RandomWeightedArray(enum RandomTag tag, u32 sum, u32 n, const u8 *weights)
|
||||||
}
|
}
|
||||||
else if (STATE->trials != n)
|
else if (STATE->trials != n)
|
||||||
{
|
{
|
||||||
Test_ExitWithResult(TEST_RESULT_ERROR, SourceLine(0), ":LRandomWeighted called with inconsistent trials %d and %d", STATE->trials, n);
|
Test_ExitWithResult(TEST_RESULT_ERROR, SourceLine(0), ":LRandomWeighted called from %p with tag %d and inconsistent trials %d and %d", __builtin_extract_return_addr(__builtin_return_address(0)), tag, STATE->trials, n);
|
||||||
}
|
}
|
||||||
// TODO: Detect inconsistent sum.
|
// TODO: Detect inconsistent sum.
|
||||||
STATE->trialRatio = Q_4_12(weights[STATE->runTrial]) / sum;
|
STATE->trialRatio = Q_4_12(weights[STATE->runTrial]) / sum;
|
||||||
|
@ -496,7 +496,7 @@ u32 RandomWeightedArray(enum RandomTag tag, u32 sum, u32 n, const u8 *weights)
|
||||||
while (weights[n-1] == 0)
|
while (weights[n-1] == 0)
|
||||||
{
|
{
|
||||||
if (n == 1)
|
if (n == 1)
|
||||||
Test_ExitWithResult(TEST_RESULT_ERROR, SourceLine(0), ":LRandomWeightedArray called with all zero weights");
|
Test_ExitWithResult(TEST_RESULT_ERROR, SourceLine(0), ":LRandomWeightedArray called from %p with tag %d and all zero weights", __builtin_extract_return_addr(__builtin_return_address(0)), tag);
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
return n-1;
|
return n-1;
|
||||||
|
@ -535,7 +535,7 @@ const void *RandomElementArray(enum RandomTag tag, const void *array, size_t siz
|
||||||
}
|
}
|
||||||
else if (STATE->trials != count)
|
else if (STATE->trials != count)
|
||||||
{
|
{
|
||||||
Test_ExitWithResult(TEST_RESULT_ERROR, SourceLine(0), ":LRandomElement called with inconsistent trials %d and %d", STATE->trials, count);
|
Test_ExitWithResult(TEST_RESULT_ERROR, SourceLine(0), ":LRandomElement called from %p with tag %d and inconsistent trials %d and %d", __builtin_extract_return_addr(__builtin_return_address(0)), tag, STATE->trials, count);
|
||||||
}
|
}
|
||||||
STATE->trialRatio = Q_4_12(1) / count;
|
STATE->trialRatio = Q_4_12(1) / count;
|
||||||
return (const u8 *)array + size * STATE->runTrial;
|
return (const u8 *)array + size * STATE->runTrial;
|
||||||
|
|
|
@ -812,7 +812,9 @@ int main(int argc, char *argv[])
|
||||||
fprintf(stdout, " - \e[31mand %d more...\e[0m\n", fails - MAX_SUMMARY_TESTS_TO_LIST);
|
fprintf(stdout, " - \e[31mand %d more...\e[0m\n", fails - MAX_SUMMARY_TESTS_TO_LIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fprintf(stdout, " - \e[31m%s\e[0m - %s.\n", failed_TestFilenameLine[i], failed_TestNames[i]);
|
fprintf(stdout, " - \e[31m");
|
||||||
|
fprint_buffer(stdout, failed_TestFilenameLine[i], strlen(failed_TestFilenameLine[i]));
|
||||||
|
fprintf(stdout, "\e[0m - %s.\n", failed_TestNames[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -826,7 +828,9 @@ int main(int argc, char *argv[])
|
||||||
fprintf(stdout, " - \e[33mand %d more...\e[0m\n", assumptionFails - MAX_SUMMARY_TESTS_TO_LIST);
|
fprintf(stdout, " - \e[33mand %d more...\e[0m\n", assumptionFails - MAX_SUMMARY_TESTS_TO_LIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fprintf(stdout, " - \e[33m%s\e[0m - %s.\n", assumeFailed_FilenameLine[i], assumeFailed_TestNames[i]);
|
fprintf(stdout, " - \e[33m");
|
||||||
|
fprint_buffer(stdout, assumeFailed_FilenameLine[i], strlen(assumeFailed_FilenameLine[i]));
|
||||||
|
fprintf(stdout, "\e[0m - %s.\n", assumeFailed_TestNames[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -840,7 +844,9 @@ int main(int argc, char *argv[])
|
||||||
fprintf(stdout, " - \e[32mand %d more...\e[0m\n", knownFailsPassing - MAX_SUMMARY_TESTS_TO_LIST);
|
fprintf(stdout, " - \e[32mand %d more...\e[0m\n", knownFailsPassing - MAX_SUMMARY_TESTS_TO_LIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fprintf(stdout, " - \e[32m%s\e[0m - %s.\n", knownFailingPassed_FilenameLine[i], knownFailingPassed_TestNames[i]);
|
fprintf(stdout, " - \e[32m");
|
||||||
|
fprint_buffer(stdout, knownFailingPassed_FilenameLine[i], strlen(knownFailingPassed_FilenameLine[i]));
|
||||||
|
fprintf(stdout, "\e[0m - %s.\n", knownFailingPassed_TestNames[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue