MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCL-CTS / parseAndCallCommandLineTests

Function parseAndCallCommandLineTests

test_common/harness/testHarness.cpp:818–893  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

816}
817
818int parseAndCallCommandLineTests(int argc, const char *argv[], const char *args,
819 cl_device_id device, int testNum,
820 test_definition testList[],
821 const test_harness_config &config)
822{
823 int ret = EXIT_SUCCESS;
824
825 unsigned char *selectedTestList = (unsigned char *)calloc(testNum, 1);
826
827 if (argc == 1)
828 {
829 /* No actual arguments, all tests will be run. */
830 memset(selectedTestList, 1, testNum);
831 }
832 else
833 {
834 for (int i = 1; i < argc; i++)
835 {
836 if (strchr(argv[i], '*') != NULL)
837 {
838 ret = find_matching_tests(testList, selectedTestList, testNum,
839 argv[i], true);
840 }
841 else
842 {
843 if (strcmp(argv[i], "all") == 0)
844 {
845 memset(selectedTestList, 1, testNum);
846 break;
847 }
848 else
849 {
850 ret = find_matching_tests(testList, selectedTestList,
851 testNum, argv[i], false);
852 }
853 }
854
855 if (ret == EXIT_FAILURE)
856 {
857 break;
858 }
859 }
860 }
861
862 if (ret == EXIT_SUCCESS)
863 {
864 std::vector<test_status> resultTestList(testNum, TEST_PASS);
865
866 callTestFunctions(testList, selectedTestList, resultTestList.data(),
867 testNum, device, config);
868
869 print_results(gFailCount, gTestCount, "sub-test");
870 print_results(gTestsFailed, gTestsFailed + gTestsPassed, "test");
871
872 ret = saveResultsToJson(argv[0], args, testList, selectedTestList,
873 resultTestList.data(), testNum);
874
875 if (std::any_of(resultTestList.begin(), resultTestList.end(),

Callers 3

mainFunction · 0.85
mainFunction · 0.85

Calls 6

find_matching_testsFunction · 0.85
callTestFunctionsFunction · 0.85
print_resultsFunction · 0.85
saveResultsToJsonFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected