Skip to content

Commit

Permalink
tests: Extension check unified
Browse files Browse the repository at this point in the history
  • Loading branch information
sjfricke authored and ncesario-lunarg committed May 19, 2022
1 parent c37dbb6 commit c935ec7
Show file tree
Hide file tree
Showing 20 changed files with 201 additions and 442 deletions.
3 changes: 1 addition & 2 deletions docs/creating_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ ASSERT_NO_FATAL_FAILURE(InitFramework());
// Check that all extensions and their dependencies were enabled successfully
if (!AreRequestedExtensionsEnabled()) {
printf("%s test requires %s extensions which are not available.\n", kSkipPrefix, VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}
// Finish initializing state, including creating the VkDevice (whith extensions added) that will be used for the test
Expand Down
6 changes: 2 additions & 4 deletions tests/positive/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1094,8 +1094,7 @@ TEST_F(VkPositiveLayerTest, ClearRectWith2DArray) {
AddRequiredExtensions(VK_KHR_MAINTENANCE_1_EXTENSION_NAME);
ASSERT_NO_FATAL_FAILURE(Init(nullptr, nullptr, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT));
if (!AreRequestedExtensionsEnabled()) {
printf("%s Extension %s is not supported.\n", kSkipPrefix, VK_KHR_MAINTENANCE_1_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

m_errorMonitor->ExpectSuccess();
Expand Down Expand Up @@ -1202,8 +1201,7 @@ TEST_F(VkPositiveLayerTest, WriteTimestampNoneAndAll) {
AddRequiredExtensions(VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME);
ASSERT_NO_FATAL_FAILURE(InitFramework());
if (!AreRequestedExtensionsEnabled()) {
printf("%s Synchronization2 not supported, skipping test\n", kSkipPrefix);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}
VkPhysicalDeviceSynchronization2FeaturesKHR synchronization2 = LvlInitStruct<VkPhysicalDeviceSynchronization2FeaturesKHR>();
synchronization2.synchronization2 = VK_TRUE;
Expand Down
9 changes: 3 additions & 6 deletions tests/positive/descriptors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1131,8 +1131,7 @@ TEST_F(VkPositiveLayerTest, CopyMutableDescriptors) {
AddRequiredExtensions(VK_VALVE_MUTABLE_DESCRIPTOR_TYPE_EXTENSION_NAME);
ASSERT_NO_FATAL_FAILURE(InitFramework(m_errorMonitor));
if (!AreRequestedExtensionsEnabled()) {
printf("%s Extension %s is not supported, skipping test.\n", kSkipPrefix, VK_VALVE_MUTABLE_DESCRIPTOR_TYPE_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}
auto mutable_descriptor_type_features = LvlInitStruct<VkPhysicalDeviceMutableDescriptorTypeFeaturesVALVE>();
auto features2 = LvlInitStruct<VkPhysicalDeviceFeatures2KHR>(&mutable_descriptor_type_features);
Expand Down Expand Up @@ -1394,8 +1393,7 @@ TEST_F(VkPositiveLayerTest, UpdateImageDescriptorSetThatHasImageViewUsage) {
AddRequiredExtensions(VK_KHR_MAINTENANCE_2_EXTENSION_NAME);
ASSERT_NO_FATAL_FAILURE(Init());
if (!AreRequestedExtensionsEnabled()) {
printf("%s %s Extension not supported, skipping tests\n", kSkipPrefix, VK_KHR_MAINTENANCE_2_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}
ASSERT_NO_FATAL_FAILURE(InitRenderTarget());

Expand Down Expand Up @@ -1446,8 +1444,7 @@ TEST_F(VkPositiveLayerTest, MultipleThreadsUsingHostOnlyDescriptorSet) {
return;
}
if (!AreRequestedExtensionsEnabled()) {
printf("%s %s Extension not supported, skipping test.\n", kSkipPrefix, VK_VALVE_MUTABLE_DESCRIPTOR_TYPE_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

auto mutable_descriptor = LvlInitStruct<VkPhysicalDeviceMutableDescriptorTypeFeaturesVALVE>();
Expand Down
13 changes: 4 additions & 9 deletions tests/positive/dynamic_rendering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ TEST_F(VkPositiveLayerTest, DynamicRenderingDraw) {
ASSERT_NO_FATAL_FAILURE(InitFramework());

if (!AreRequestedExtensionsEnabled()) {
printf("%s %s Extension not supported, skipping tests\n", kSkipPrefix, VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

if (DeviceValidationVersion() < VK_API_VERSION_1_1) {
Expand Down Expand Up @@ -133,8 +132,7 @@ TEST_F(VkPositiveLayerTest, CmdClearAttachmentTestsDynamicRendering) {
ASSERT_NO_FATAL_FAILURE(InitFramework());

if (!AreRequestedExtensionsEnabled()) {
printf("%s %s Extension not supported, skipping tests\n", kSkipPrefix, VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

if (DeviceValidationVersion() < VK_API_VERSION_1_1) {
Expand Down Expand Up @@ -264,8 +262,7 @@ TEST_F(VkPositiveLayerTest, DynamicRenderingPipeWithDiscard) {
ASSERT_NO_FATAL_FAILURE(InitFramework());

if (!AreRequestedExtensionsEnabled()) {
printf("%s %s Extension not supported, skipping tests\n", kSkipPrefix, VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

if (DeviceValidationVersion() < VK_API_VERSION_1_1) {
Expand Down Expand Up @@ -342,9 +339,7 @@ TEST_F(VkPositiveLayerTest, UseStencilAttachmentWithIntegerFormatAndDepthStencil
return;
}
if (!AreRequestedExtensionsEnabled()) {
printf("%s %s or %s is not supported; skipping\n", kSkipPrefix, VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME,
VK_KHR_DEPTH_STENCIL_RESOLVE_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

auto dynamic_rendering_features = LvlInitStruct<VkPhysicalDeviceDynamicRenderingFeaturesKHR>();
Expand Down
50 changes: 10 additions & 40 deletions tests/positive/graphics_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,8 @@ TEST_F(VkPositiveGraphicsLibraryLayerTest, VertexInputGraphicsPipelineLibrary) {
return;
}

std::vector<const char *> failed_exts;
if (!AreRequestedExtensionsEnabled(failed_exts)) {
printf("%s The following device extensions are not supported: ", kSkipPrefix);
for (const auto &ext : failed_exts) {
printf("%s ", ext);
}
printf("\n");
return;
if (!AreRequestedExtensionsEnabled()) {
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

auto gpl_features = LvlInitStruct<VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT>();
Expand Down Expand Up @@ -88,14 +82,8 @@ TEST_F(VkPositiveGraphicsLibraryLayerTest, PreRasterGraphicsPipelineLibrary) {
return;
}

std::vector<const char *> failed_exts;
if (!AreRequestedExtensionsEnabled(failed_exts)) {
printf("%s The following device extensions are not supported: ", kSkipPrefix);
for (const auto &ext : failed_exts) {
printf("%s ", ext);
}
printf("\n");
return;
if (!AreRequestedExtensionsEnabled()) {
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

auto gpl_features = LvlInitStruct<VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT>();
Expand Down Expand Up @@ -145,14 +133,8 @@ TEST_F(VkPositiveGraphicsLibraryLayerTest, FragmentShaderGraphicsPipelineLibrary
return;
}

std::vector<const char *> failed_exts;
if (!AreRequestedExtensionsEnabled(failed_exts)) {
printf("%s The following device extensions are not supported: ", kSkipPrefix);
for (const auto &ext : failed_exts) {
printf("%s ", ext);
}
printf("\n");
return;
if (!AreRequestedExtensionsEnabled()) {
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

auto gpl_features = LvlInitStruct<VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT>();
Expand Down Expand Up @@ -202,14 +184,8 @@ TEST_F(VkPositiveGraphicsLibraryLayerTest, FragmentOutputGraphicsPipelineLibrary
return;
}

std::vector<const char *> failed_exts;
if (!AreRequestedExtensionsEnabled(failed_exts)) {
printf("%s The following device extensions are not supported: ", kSkipPrefix);
for (const auto &ext : failed_exts) {
printf("%s ", ext);
}
printf("\n");
return;
if (!AreRequestedExtensionsEnabled()) {
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

auto gpl_features = LvlInitStruct<VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT>();
Expand Down Expand Up @@ -248,14 +224,8 @@ TEST_F(VkPositiveGraphicsLibraryLayerTest, ExeLibrary) {
return;
}

std::vector<const char *> failed_exts;
if (!AreRequestedExtensionsEnabled(failed_exts)) {
printf("%s The following device extensions are not supported: ", kSkipPrefix);
for (const auto &ext : failed_exts) {
printf("%s ", ext);
}
printf("\n");
return;
if (!AreRequestedExtensionsEnabled()) {
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

auto gpl_features = LvlInitStruct<VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT>();
Expand Down
6 changes: 2 additions & 4 deletions tests/positive/image_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1829,8 +1829,7 @@ TEST_F(VkPositiveLayerTest, TestMappingMemoryWithMultiInstanceHeapFlag) {
AddRequiredExtensions(VK_KHR_DEVICE_GROUP_EXTENSION_NAME);
ASSERT_NO_FATAL_FAILURE(InitFramework(m_errorMonitor));
if (!AreRequestedExtensionsEnabled()) {
printf("%s Extension %s is not supported, skipping test.\n", kSkipPrefix, VK_KHR_DEVICE_GROUP_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}
ASSERT_NO_FATAL_FAILURE(InitState());

Expand Down Expand Up @@ -2484,8 +2483,7 @@ TEST_F(VkPositiveLayerTest, ValidExtendedUsageWithDifferentFormatViews) {
AddRequiredExtensions(VK_KHR_MAINTENANCE_2_EXTENSION_NAME);
ASSERT_NO_FATAL_FAILURE(Init());
if (!AreRequestedExtensionsEnabled()) {
printf("%s %s extension not available\n", kSkipPrefix, VK_KHR_MAINTENANCE_2_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

auto image_ci = LvlInitStruct<VkImageCreateInfo>();
Expand Down
3 changes: 1 addition & 2 deletions tests/positive/other.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,8 +801,7 @@ TEST_F(VkPositiveLayerTest, ValidateGetAccelerationStructureBuildSizes) {
}

if (!AreRequestedExtensionsEnabled()) {
printf("%s Extension %s is not supported, skipping test.\n", kSkipPrefix, VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}
if (DeviceValidationVersion() < VK_API_VERSION_1_1) {
printf("%s test requires Vulkan 1.1 extensions, not available, skipping test.\n", kSkipPrefix);
Expand Down
47 changes: 15 additions & 32 deletions tests/positive/pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ TEST_F(VkPositiveLayerTest, ViewportWithCountNoMultiViewport) {

uint32_t version = SetTargetApiVersion(VK_API_VERSION_1_1);
if (version < VK_API_VERSION_1_1) {
printf("%s At least Vulkan version 1.1 is required, skipping test.\n", kSkipPrefix);
return;
GTEST_SKIP() << "At least Vulkan version 1.1 is required";
}

ASSERT_NO_FATAL_FAILURE(InitFramework(m_errorMonitor));
Expand Down Expand Up @@ -2695,8 +2694,7 @@ TEST_F(VkPositiveLayerTest, SeparateDepthStencilSubresourceLayout) {
m_errorMonitor->ExpectSuccess(kErrorBit | kWarningBit);

if (!AreRequestedExtensionsEnabled()) {
printf("%s Required extensions not supported, skipping tests.\n", kSkipPrefix);
return;
GTEST_SKIP() << VK_EXT_COLOR_WRITE_ENABLE_EXTENSION_NAME << " not supported";
}

auto separate_features = LvlInitStruct<VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures>();
Expand Down Expand Up @@ -5701,8 +5699,7 @@ TEST_F(VkPositiveLayerTest, FillBufferCmdPoolTransferQueue) {

uint32_t version = SetTargetApiVersion(VK_API_VERSION_1_1);
if (version < VK_API_VERSION_1_1) {
printf("%s At least Vulkan version 1.1 is required, skipping test.\n", kSkipPrefix);
return;
GTEST_SKIP() << "At least Vulkan version 1.1 is required";
}

ASSERT_NO_FATAL_FAILURE(Init());
Expand Down Expand Up @@ -5778,8 +5775,7 @@ TEST_F(VkPositiveLayerTest, ShaderAtomicInt64) {
ASSERT_NO_FATAL_FAILURE(InitState(nullptr, &features2));

if (m_device->props.apiVersion < VK_API_VERSION_1_1) {
printf("%s At least Vulkan version 1.1 is required for SPIR-V 1.3, skipping test.\n", kSkipPrefix);
return;
GTEST_SKIP() << "At least Vulkan version 1.1 is required for SPIR-V 1.3";
}

std::string cs_base = R"glsl(
Expand Down Expand Up @@ -6100,8 +6096,7 @@ TEST_F(VkPositiveLayerTest, TestPervertexNVShaderAttributes) {
AddRequiredExtensions(VK_NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME);
ASSERT_NO_FATAL_FAILURE(InitFramework(m_errorMonitor));
if (!AreRequestedExtensionsEnabled()) {
printf("%s Extension %s is not supported, skipping test.\n", kSkipPrefix, VK_NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV fragment_shader_barycentric_features =
Expand Down Expand Up @@ -6310,8 +6305,7 @@ TEST_F(VkPositiveLayerTest, LineTopologyClasses) {
}

if (!AreRequestedExtensionsEnabled()) {
printf("%s Extension %s is not supported.\n", kSkipPrefix, VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

if (!extended_dynamic_state_features.extendedDynamicState) {
Expand Down Expand Up @@ -6384,8 +6378,7 @@ TEST_F(VkPositiveLayerTest, MutableStorageImageFormatWriteForFormat) {
ASSERT_NO_FATAL_FAILURE(InitState(nullptr, nullptr, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT));

if (!AreRequestedExtensionsEnabled()) {
printf("%s Required extensions not supported, skipping.\n", kSkipPrefix);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

PFN_vkSetPhysicalDeviceFormatProperties2EXT fpvkSetPhysicalDeviceFormatProperties2EXT = nullptr;
Expand Down Expand Up @@ -6535,8 +6528,7 @@ TEST_F(VkPositiveLayerTest, CreateGraphicsPipelineDynamicRendering) {
ASSERT_NO_FATAL_FAILURE(InitFramework());

if (!AreRequestedExtensionsEnabled()) {
printf("%s %s Extension not supported, skipping tests\n", kSkipPrefix, VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

m_errorMonitor->ExpectSuccess();
Expand Down Expand Up @@ -6594,8 +6586,7 @@ TEST_F(VkPositiveLayerTest, CreateGraphicsPipelineDynamicRenderingNoInfo) {
ASSERT_NO_FATAL_FAILURE(InitFramework());

if (!AreRequestedExtensionsEnabled()) {
printf("%s %s Extension not supported, skipping tests\n", kSkipPrefix, VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

m_errorMonitor->ExpectSuccess();
Expand Down Expand Up @@ -6651,8 +6642,7 @@ TEST_F(VkPositiveLayerTest, CreateGraphicsPipelineRasterizationOrderAttachmentAc
ASSERT_NO_FATAL_FAILURE(InitFrameworkAndRetrieveFeatures(features2));

if (!AreRequestedExtensionsEnabled()) {
printf("%s Extension %s is not supported.\n", kSkipPrefix, VK_ARM_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

if (!rasterization_order_features.rasterizationOrderColorAttachmentAccess &&
Expand Down Expand Up @@ -6949,8 +6939,7 @@ TEST_F(VkPositiveLayerTest, TestDualBlendShader) {
ASSERT_NO_FATAL_FAILURE(InitFramework(m_errorMonitor));

if (DeviceValidationVersion() < VK_API_VERSION_1_1) {
printf("%s At least Vulkan version 1.1 is required, skipping test.\n", kSkipPrefix);
return;
GTEST_SKIP() << "At least Vulkan version 1.1 is required";
}

auto features2 = LvlInitStruct<VkPhysicalDeviceFeatures2>();
Expand Down Expand Up @@ -7014,12 +7003,10 @@ TEST_F(VkPositiveLayerTest, TestDynamicRenderingWithDualSourceBlending) {
ASSERT_NO_FATAL_FAILURE(InitFramework(m_errorMonitor));

if (DeviceValidationVersion() < VK_API_VERSION_1_1) {
printf("%s At least Vulkan version 1.1 is required, skipping test.\n", kSkipPrefix);
return;
GTEST_SKIP() << "At least Vulkan version 1.1 is required";
}
if (!AreRequestedExtensionsEnabled()) {
printf("%s Extension %s is not supported, skipping test.\n", kSkipPrefix, VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

auto dynamic_rendering_features = LvlInitStruct<VkPhysicalDeviceDynamicRenderingFeaturesKHR>();
Expand Down Expand Up @@ -7105,9 +7092,7 @@ TEST_F(VkPositiveLayerTest, TestUpdateAfterBind) {
return;
}
if (!AreRequestedExtensionsEnabled()) {
printf("%s Extension %s or %s is not supported, skipping test.\n", kSkipPrefix, VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME,
VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

auto descriptor_indexing = LvlInitStruct<VkPhysicalDeviceDescriptorIndexingFeatures>();
Expand Down Expand Up @@ -7248,9 +7233,7 @@ TEST_F(VkPositiveLayerTest, TestPartiallyBoundDescriptors) {
return;
}
if (!AreRequestedExtensionsEnabled()) {
printf("%s Extension %s or %s is not supported, skipping test.\n", kSkipPrefix, VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME,
VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

auto descriptor_indexing = LvlInitStruct<VkPhysicalDeviceDescriptorIndexingFeatures>();
Expand Down
6 changes: 2 additions & 4 deletions tests/positive/render_pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,7 @@ TEST_F(VkPositiveLayerTest, ImagelessFramebufferNonZeroBaseMip) {
}

if (!AreRequestedExtensionsEnabled()) {
printf("%s Device extensions for %s not supported\n", kSkipPrefix, VK_KHR_IMAGELESS_FRAMEBUFFER_EXTENSION_NAME);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

if (pd_imageless_fb_features.imagelessFramebuffer != VK_TRUE) {
Expand Down Expand Up @@ -1012,8 +1011,7 @@ TEST_F(VkPositiveLayerTest, CreateRenderPassWithViewMask) {
}

if (!AreRequestedExtensionsEnabled()) {
printf("%s required extensions are not supported, skipping tests.\n", kSkipPrefix);
return;
GTEST_SKIP() << RequestedExtensionsNotSupported() << " not supported";
}

auto vulkan_11_features = LvlInitStruct<VkPhysicalDeviceVulkan11Features>();
Expand Down
Loading

0 comments on commit c935ec7

Please sign in to comment.