Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submitting tests results with an invalid image measurement can cause an internal error #2682

Open
marc-legendre opened this issue Jan 31, 2025 · 0 comments
Assignees

Comments

@marc-legendre
Copy link

Bug report

Sample reproduction CMakeLists.txt:

cmake_minimum_required(VERSION 3.25)

project(bidou)
include(CTest)
enable_testing()
add_test(NAME my_test COMMAND bash -c "
echo '<CTestMeasurementFile type=\"image/png\" name=\"ValidImage\">${CMAKE_CURRENT_SOURCE_DIR}/a.png</CTestMeasurementFile>'
echo '<CTestMeasurementFile type=\"image/png\" name=\"TestImage\">${CMAKE_CURRENT_SOURCE_DIR}/b.png</CTestMeasurementFile>'
exit 1
")

where a.png b.png is not a valid image file (e.g. it contains text).

Expected Behavior

When submitting tests results with CTest, submit succeeds, invalid images are ignored, and the test results are available on CDash.

Actual Behavior

Submit fails with an error 500, and the test results are not available on CDash.

CDash Version

3.7.0

Additional Information

Example output of ctest -D Experimental
   Site: oeil
   Build name: Linux-clang++
Create new tag: 20250131-1638 - Experimental
Configure project
   Each . represents 1024 bytes of output
    . Size of output: 0K
Build project
   Each symbol represents 1024 bytes of output.
   '!' represents an error and '*' a warning.
    . Size of output: 0K
   0 Compiler errors
   0 Compiler warnings
Test project /tmp/src/build
    Start 1: my_test
1/1 Test #1: my_test ..........................***Failed    0.00 sec
<CTestMeasurementFile type="image/png" name="ValidImage">/tmp/src/a.png</CTestMeasurementFile>
<CTestMeasurementFile type="image/png" name="TestImage">/tmp/src/b.png</CTestMeasurementFile>


0% tests passed, 1 tests failed out of 1

Total Test time (real) =   0.00 sec

The following tests FAILED:
          1 - my_test (Failed)
Performing coverage
 Cannot find any coverage files. Ignoring Coverage request.
Submit files
   SubmitURL: http://localhost:8080/submit.php?project=myproject
   Uploaded: /tmp/src/build/Testing/20250131-1638/Configure.xml
   Uploaded: /tmp/src/build/Testing/20250131-1638/Build.xml
   Submit failed, waiting 5 seconds...
   Retry submission: Attempt 1 of 3
   Submit failed, waiting 5 seconds...
   Retry submission: Attempt 2 of 3
   Submit failed, waiting 5 seconds...
   Retry submission: Attempt 3 of 3
   Error when uploading file: /tmp/src/build/Testing/20250131-1638/Test.xml
   Error message was: The requested URL returned error: 500
   Problems when submitting via HTTP
Errors while running CTest

CDash logs:

127.0.0.1 - - [31/Jan/2025:16:38:35 +0000] "GET /ajax/dailyupdatescurl.php?projectid=1 HTTP/1.1" 200 813
172.18.0.1 - - [31/Jan/2025:16:38:35 +0000] "PUT /submit.php?project=myproject&FileName=oeil___Linux-clang%2B%2B___20250131-1638-Experimental___XML___Configure.xml&build=Linux-clang%2B%2B&site=oeil&stamp=20250131-1638-Experimental&MD5=2a19981e4379b6d00348d5379fd63433 HTTP/1.1" 200 950
127.0.0.1 - - [31/Jan/2025:16:38:36 +0000] "GET /ajax/dailyupdatescurl.php?projectid=1 HTTP/1.1" 200 813
172.18.0.1 - - [31/Jan/2025:16:38:36 +0000] "PUT /submit.php?project=myproject&FileName=oeil___Linux-clang%2B%2B___20250131-1638-Experimental___XML___Build.xml&build=Linux-clang%2B%2B&site=oeil&stamp=20250131-1638-Experimental&MD5=5c8f8869c08353670fd57156979dc42a HTTP/1.1" 200 950
127.0.0.1 - - [31/Jan/2025:16:38:36 +0000] "GET /ajax/dailyupdatescurl.php?projectid=1 HTTP/1.1" 200 813
172.18.0.1 - - [31/Jan/2025:16:38:36 +0000] "PUT /submit.php?project=myproject&FileName=oeil___Linux-clang%2B%2B___20250131-1638-Experimental___XML___Test.xml&build=Linux-clang%2B%2B&site=oeil&stamp=20250131-1638-Experimental&MD5=ec4df0aa83a8c472545f6204830b6729 HTTP/1.1" 500 939
127.0.0.1 - - [31/Jan/2025:16:38:41 +0000] "GET /ajax/dailyupdatescurl.php?projectid=1 HTTP/1.1" 200 813
172.18.0.1 - - [31/Jan/2025:16:38:41 +0000] "PUT /submit.php?project=myproject&FileName=oeil___Linux-clang%2B%2B___20250131-1638-Experimental___XML___Test.xml&build=Linux-clang%2B%2B&site=oeil&stamp=20250131-1638-Experimental&MD5=ec4df0aa83a8c472545f6204830b6729 HTTP/1.1" 500 939
127.0.0.1 - - [31/Jan/2025:16:38:46 +0000] "GET /ajax/dailyupdatescurl.php?projectid=1 HTTP/1.1" 200 813
172.18.0.1 - - [31/Jan/2025:16:38:46 +0000] "PUT /submit.php?project=myproject&FileName=oeil___Linux-clang%2B%2B___20250131-1638-Experimental___XML___Test.xml&build=Linux-clang%2B%2B&site=oeil&stamp=20250131-1638-Experimental&MD5=ec4df0aa83a8c472545f6204830b6729 HTTP/1.1" 500 939
127.0.0.1 - - [31/Jan/2025:16:38:51 +0000] "GET /ajax/dailyupdatescurl.php?projectid=1 HTTP/1.1" 200 813
172.18.0.1 - - [31/Jan/2025:16:38:51 +0000] "PUT /submit.php?project=myproject&FileName=oeil___Linux-clang%2B%2B___20250131-1638-Experimental___XML___Test.xml&build=Linux-clang%2B%2B&site=oeil&stamp=20250131-1638-Experimental&MD5=ec4df0aa83a8c472545f6204830b6729 HTTP/1.1" 500 939

I used cmake 3.25.1, FWIW.

@josephsnyder josephsnyder self-assigned this Feb 14, 2025
josephsnyder added a commit that referenced this issue Feb 17, 2025
As reported in #2682, invalid images (but valid a valid file) would
report a 500 error when CDash attempts to create the image from the
information.  Catch the error on creation and return early, as if the
image had an unknown extension.

Set the checksum to 0 to avoid writing other error messages to the log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants