| 816 | } |
| 817 | |
| 818 | int 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(), |
no test coverage detected