diff options
| author | Charles Giessen <charles@lunarg.com> | 2021-11-14 11:43:21 -0700 |
|---|---|---|
| committer | Charles Giessen <46324611+charles-lunarg@users.noreply.github.com> | 2022-02-02 16:22:12 -0700 |
| commit | cbc3324494827e51d31b03a90a8f32f1f1860399 (patch) | |
| tree | 8d3c930316792e6d0ecdb98fe312d98309ec2ac7 /vulkaninfo/vulkaninfo.cpp | |
| parent | 7273e43d41c4d4b8296ca940b287362bfe3104ff (diff) | |
| download | usermoji-cbc3324494827e51d31b03a90a8f32f1f1860399.tar.xz | |
vulkaninfo: Return non-zero from failure
If vulkaninfo fails for whatever reason, including vulkan API calls, vulkaninfo
should return 1 so that CI systems can detect if something is amiss. Previously,
while vulkaninfo would recover from a failure (finishing any json/html files that
were being printed) it would print 0, which is counter intuitive.
Diffstat (limited to 'vulkaninfo/vulkaninfo.cpp')
| -rw-r--r-- | vulkaninfo/vulkaninfo.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/vulkaninfo/vulkaninfo.cpp b/vulkaninfo/vulkaninfo.cpp index 53838eeb..fa7a6db8 100644 --- a/vulkaninfo/vulkaninfo.cpp +++ b/vulkaninfo/vulkaninfo.cpp @@ -958,7 +958,7 @@ PrinterCreateDetails get_printer_create_details(ParsedResults &parse_data, AppIn "\"https://schema.khronos.org/vulkan/devsim_VK_KHR_portability_subset-provisional-1.json#\",\n") + "\t\"comments\": {\n\t\t\"desc\": \"JSON configuration file describing GPU " + std::to_string(parse_data.selected_gpu) + "'s (" + selected_gpu.props.deviceName + - "( portability features and properties. Generated using the vulkaninfo " + ") portability features and properties. Generated using the vulkaninfo " "program.\",\n\t\t\"vulkanApiVersion\": " "\"" + VkVersionString(inst.vk_version) + "\"\n" + "\t}"; @@ -1045,6 +1045,7 @@ int main(int argc, char **argv) { } #endif + int return_code = 0; // set in case of error std::unique_ptr<Printer> printer; std::ostream std_out(std::cout.rdbuf()); std::ofstream file_out; @@ -1120,6 +1121,7 @@ int main(int argc, char **argv) { if (printer) { printer->FinishOutput(); } + return_code = 1; } // Call the printer's destructor before the file handle gets closed printer.reset(nullptr); @@ -1128,5 +1130,5 @@ int main(int argc, char **argv) { if (parse_data.output_category == OutputCategory::text && !parse_data.print_to_file) wait_for_console_destroy(); #endif - return 0; + return return_code; } |
