Skip to content

Commit

Permalink
[Testbed] Add more color highlighting to error reports in Testbed.
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasBanana committed Feb 17, 2025
1 parent 77d1dae commit 9fa7506
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tests/Testbed/TestbedContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ unsigned TestbedContext::RunAllTests()
RUN_TEST( CombinedTexSamplers );

// Reset main renderer and run C99 tests
// LLGL can't run the same render system in multiple instances (confuses the context managemenr in GL backend)
// LLGL can't run the same render system in multiple instances (confuses the context management in GL backend)
renderer.reset();
RUN_C99_TEST( OffscreenC99 );

Expand Down
22 changes: 14 additions & 8 deletions tests/Testbed/UnitTests/TestImageConversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ DEF_RITEST( ImageConversions )
{ \
const std::string name = MakeOutputFilename(filename, img.GetFormat(), threadCount); \
Log::Errorf( \
Log::ColorFlags::StdError, \
"Mismatch between image size '%s' (%u bytes) and expected size (%u bytes)\n", \
name.c_str(), static_cast<unsigned>(img.GetDataSize()), static_cast<unsigned>(SIZE) \
); \
Expand Down Expand Up @@ -107,6 +108,7 @@ DEF_RITEST( ImageConversions )
if (std::abs(p0 - p1) > tolerance)
{
Log::Errorf(
Log::ColorFlags::StdError,
"Mismatch between final pixel [%u,%u] of image '%s' (R=%d) and original pixel (R=%d)\n",
x, y, filename.c_str(), p0, p1
);
Expand All @@ -118,14 +120,18 @@ DEF_RITEST( ImageConversions )
return TestResult::Passed;
};

#define TEST_CONVERSION_THREADED(FILENAME, THREADS, TIME) \
{ \
TestResult result = TestConversion((FILENAME), (THREADS), (TIME)); \
if (result != TestResult::Passed) \
{ \
Log::Errorf("ImageConversion(\"%s\", threads: %d) failed\n", (FILENAME), (THREADS)); \
return result; \
} \
#define TEST_CONVERSION_THREADED(FILENAME, THREADS, TIME) \
{ \
TestResult result = TestConversion((FILENAME), (THREADS), (TIME)); \
if (result != TestResult::Passed) \
{ \
Log::Errorf( \
Log::ColorFlags::StdError, \
"ImageConversion(\"%s\", threads: %d) failed\n", \
(FILENAME), (THREADS) \
); \
return result; \
} \
}

#define TEST_CONVERSION(FILENAME) \
Expand Down
2 changes: 2 additions & 0 deletions tests/Testbed/UnitTests/TestResourceBinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ DEF_TEST( ResourceBinding )
if (!VectorsEqual(readbackValue, expectedResults.buffers[i]))
{
Log::Errorf(
Log::ColorFlags::StdError,
"Mismatch between buffer %d (Frame %u) [%d, %d, %d, %d] and expected value [%d, %d, %d, %d]\n",
i, frame,
readbackValue[0], readbackValue[1], readbackValue[2], readbackValue[3],
Expand Down Expand Up @@ -699,6 +700,7 @@ DEF_TEST( ResourceBinding )
if (!VectorsEqual(readbackValue, expectedResults.textures[i]))
{
Log::Errorf(
Log::ColorFlags::StdError,
"Mismatch between texture %d (Frame %u) [%d, %d, %d, %d] and expected value [%d, %d, %d, %d]\n",
i, frame,
readbackValue[0], readbackValue[1], readbackValue[2], readbackValue[3],
Expand Down
2 changes: 2 additions & 0 deletions tests/Testbed/UnitTests/TestStreamOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ DEF_TEST( StreamOutput )
if (actualNumPrimitives != expectedNumPrimitives)
{
Log::Errorf(
Log::ColorFlags::StdError,
"Mismatch between number of written stream-output primitives (0x%08X) in frame [%u] and expected value (0x%08X)\n",
actualNumPrimitives, frame, expectedNumPrimitives
);
Expand All @@ -372,6 +373,7 @@ DEF_TEST( StreamOutput )
if (actualPrimitiveOverflow != expectedPrimitiveOverflow)
{
Log::Errorf(
Log::ColorFlags::StdError,
"Mismatch between stream-output primitive overflow flag (0x%08X) in frame [%u] and expected value (0x%08X)\n",
actualPrimitiveOverflow, frame, expectedPrimitiveOverflow
);
Expand Down

0 comments on commit 9fa7506

Please sign in to comment.