mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Return a non-zero exit-code when a sub-test fails (#951)
When running sub-tests explicitly on the command line and that sub-test fails, the test harness returns `0` from `main()`. This is problematic in automated testing environments as failed tests can be hidden. This patch iterates over all the test results in the `resultTestList` after all sub-tests have completed, if any of the tests failed a non-zero value is returned from `parseAndCallCommandLineTests()` which is then propagated up the call stack to `main()`.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
//
|
||||
#include "testHarness.h"
|
||||
#include "compat.h"
|
||||
#include <algorithm>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -639,6 +640,19 @@ int parseAndCallCommandLineTests( int argc, const char *argv[], cl_device_id dev
|
||||
}
|
||||
}
|
||||
|
||||
if (std::any_of(resultTestList, resultTestList + testNum,
|
||||
[](test_status result) {
|
||||
switch (result)
|
||||
{
|
||||
case TEST_PASS:
|
||||
case TEST_SKIP: return false;
|
||||
case TEST_FAIL: return true;
|
||||
};
|
||||
}))
|
||||
{
|
||||
ret = EXIT_FAILURE;
|
||||
}
|
||||
|
||||
free( selectedTestList );
|
||||
free( resultTestList );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user