From: Charles Giessen Date: Sat, 10 Jun 2023 23:59:22 +0000 (-0600) Subject: Add tests for longer version strings X-Git-Tag: upstream/1.3.268~106 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=338825a7aef3ba6f440e2a9ffe0791fa76fbcf8b;p=platform%2Fupstream%2FVulkan-Loader.git Add tests for longer version strings Include tests which exercise parsing logic for versions longer than a single character. --- diff --git a/tests/loader_version_tests.cpp b/tests/loader_version_tests.cpp index 757f21fe..548e81aa 100644 --- a/tests/loader_version_tests.cpp +++ b/tests/loader_version_tests.cpp @@ -923,6 +923,22 @@ TEST(DriverManifest, UnknownManifestVersion) { ASSERT_TRUE(log.find("has unknown icd manifest file version 3.2.1. May cause errors.")); } +TEST(DriverManifest, LargeUnknownManifestVersion) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails( + ManifestICD{}.set_lib_path(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA).set_file_format_version({100, 222, 111}))); + env.get_test_icd().physical_devices.push_back({}); + + DebugUtilsLogger log; + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)); + FillDebugUtilsCreateDetails(inst.create_info, log); + inst.CheckCreate(); + ASSERT_TRUE(log.find("loader_parse_icd_manifest: ")); + // log prints the path to the file, don't look for it since it is hard to determine inside the test what the path should be. + ASSERT_TRUE(log.find("has unknown icd manifest file version 100.222.111. May cause errors.")); +} + TEST(LayerManifest, UnknownManifestVersion) { FrameworkEnvironment env{}; env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); @@ -932,7 +948,7 @@ TEST(LayerManifest, UnknownManifestVersion) { env.add_implicit_layer(ManifestLayer{} .add_layer(ManifestLayer::LayerDescription{} .set_name(implicit_layer_name) - .set_api_version(VK_MAKE_API_VERSION(1, 1, 0, 0)) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)) .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) .set_disable_environment("DISABLE_ME")) .set_file_format_version({3, 2, 1}), @@ -948,6 +964,31 @@ TEST(LayerManifest, UnknownManifestVersion) { ASSERT_TRUE(log.find("has unknown layer manifest file version 3.2.1. May cause errors.")); } +TEST(LayerManifest, LargeUnknownManifestVersion) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_2_EXPORT_ICD_GPDPA)); + env.get_test_icd().physical_devices.push_back({}); + + const char* implicit_layer_name = "ImplicitTestLayer"; + env.add_implicit_layer(ManifestLayer{} + .add_layer(ManifestLayer::LayerDescription{} + .set_name(implicit_layer_name) + .set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)) + .set_lib_path(TEST_LAYER_PATH_EXPORT_VERSION_2) + .set_disable_environment("DISABLE_ME")) + .set_file_format_version({100, 222, 111}), + "implicit_test_layer.json"); + + DebugUtilsLogger log; + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(VK_MAKE_API_VERSION(0, 1, 0, 0)); + FillDebugUtilsCreateDetails(inst.create_info, log); + inst.CheckCreate(); + ASSERT_TRUE(log.find("loader_add_layer_properties: ")); + // log prints the path to the file, don't look for it since it is hard to determine inside the test what the path should be. + ASSERT_TRUE(log.find("has unknown layer manifest file version 100.222.111. May cause errors.")); +} + struct DriverInfo { DriverInfo(TestICDDetails icd_details, uint32_t driver_version, bool expect_to_find) noexcept : icd_details(icd_details), driver_version(driver_version), expect_to_find(expect_to_find) {}