Add sanity checking of API version
authorDavid Sodman <dsodman@google.com>
Tue, 5 Apr 2016 02:16:24 +0000 (19:16 -0700)
committerDavid Sodman <dsodman@google.com>
Tue, 5 Apr 2016 17:18:30 +0000 (10:18 -0700)
Bug: 27640790

Change-Id: I8b4d1b9311908ef3591ec20f34996a2e68384410

external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp

index e4d5da9..ed6cfc6 100644 (file)
@@ -32,6 +32,7 @@
 #include "vkDeviceUtil.hpp"
 #include "vkQueryUtil.hpp"
 #include "vkImageUtil.hpp"
+#include "vkApiVersion.hpp"
 
 #include "tcuTestLog.hpp"
 #include "tcuFormatUtil.hpp"
@@ -762,6 +763,23 @@ tcu::TestStatus deviceProperties (Context& context)
                return tcu::TestStatus::fail("deviceProperties incomplete initialization");
        }
 
+       {
+               const ApiVersion deviceVersion = unpackVersion(props->apiVersion);
+               const ApiVersion deqpVersion = unpackVersion(VK_API_VERSION);
+
+               if (deviceVersion.majorNum != deqpVersion.majorNum)
+               {
+                       log << TestLog::Message << "deviceProperties - API Major Version " << deviceVersion.majorNum << " is not valid" << TestLog::EndMessage;
+                       return tcu::TestStatus::fail("deviceProperties apiVersion not valid");
+               }
+
+               if (deviceVersion.minorNum > deqpVersion.minorNum)
+               {
+                       log << TestLog::Message << "deviceProperties - API Minor Version " << deviceVersion.minorNum << " is not valid for this version of dEQP" << TestLog::EndMessage;
+                       return tcu::TestStatus::fail("deviceProperties apiVersion not valid");
+               }
+       }
+
        return tcu::TestStatus::pass("DeviceProperites query succeeded");
 }