1 /*-------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
5 * Copyright (c) 2016 Google Inc.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and/or associated documentation files (the
9 * "Materials"), to deal in the Materials without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sublicense, and/or sell copies of the Materials, and to
12 * permit persons to whom the Materials are furnished to do so, subject to
13 * the following conditions:
15 * The above copyright notice(s) and this permission notice shall be
16 * included in all copies or substantial portions of the Materials.
18 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
28 * \brief Build and Device Tests
29 *//*--------------------------------------------------------------------*/
31 #include "vktInfoTests.hpp"
32 #include "vktTestCaseUtil.hpp"
33 #include "vkPlatform.hpp"
34 #include "vkApiVersion.hpp"
35 #include "tcuTestLog.hpp"
36 #include "tcuFormatUtil.hpp"
37 #include "tcuCommandLine.hpp"
38 #include "tcuPlatform.hpp"
39 #include "deStringUtil.hpp"
50 std::string getOsName (int os)
54 case DE_OS_VANILLA: return "DE_OS_VANILLA";
55 case DE_OS_WIN32: return "DE_OS_WIN32";
56 case DE_OS_UNIX: return "DE_OS_UNIX";
57 case DE_OS_WINCE: return "DE_OS_WINCE";
58 case DE_OS_OSX: return "DE_OS_OSX";
59 case DE_OS_ANDROID: return "DE_OS_ANDROID";
60 case DE_OS_SYMBIAN: return "DE_OS_SYMBIAN";
61 case DE_OS_IOS: return "DE_OS_IOS";
63 return de::toString(os);
67 std::string getCompilerName (int compiler)
71 case DE_COMPILER_VANILLA: return "DE_COMPILER_VANILLA";
72 case DE_COMPILER_MSC: return "DE_COMPILER_MSC";
73 case DE_COMPILER_GCC: return "DE_COMPILER_GCC";
74 case DE_COMPILER_CLANG: return "DE_COMPILER_CLANG";
76 return de::toString(compiler);
80 std::string getCpuName (int cpu)
84 case DE_CPU_VANILLA: return "DE_CPU_VANILLA";
85 case DE_CPU_ARM: return "DE_CPU_ARM";
86 case DE_CPU_X86: return "DE_CPU_X86";
87 case DE_CPU_X86_64: return "DE_CPU_X86_64";
88 case DE_CPU_ARM_64: return "DE_CPU_ARM_64";
89 case DE_CPU_MIPS: return "DE_CPU_MIPS";
90 case DE_CPU_MIPS_64: return "DE_CPU_MIPS_64";
92 return de::toString(cpu);
96 std::string getEndiannessName (int endianness)
100 case DE_BIG_ENDIAN: return "DE_BIG_ENDIAN";
101 case DE_LITTLE_ENDIAN: return "DE_LITTLE_ENDIAN";
103 return de::toString(endianness);
107 tcu::TestStatus logBuildInfo (Context& context)
109 #if defined(DE_DEBUG)
110 const bool isDebug = true;
112 const bool isDebug = false;
115 context.getTestContext().getLog()
117 << "DE_OS: " << getOsName(DE_OS) << "\n"
118 << "DE_CPU: " << getCpuName(DE_CPU) << "\n"
119 << "DE_PTR_SIZE: " << DE_PTR_SIZE << "\n"
120 << "DE_ENDIANNESS: " << getEndiannessName(DE_ENDIANNESS) << "\n"
121 << "DE_COMPILER: " << getCompilerName(DE_COMPILER) << "\n"
122 << "DE_DEBUG: " << (isDebug ? "true" : "false") << "\n"
123 << TestLog::EndMessage;
125 return tcu::TestStatus::pass("Not validated");
128 tcu::TestStatus logDeviceInfo (Context& context)
130 TestLog& log = context.getTestContext().getLog();
131 const vk::VkPhysicalDeviceProperties& properties = context.getDeviceProperties();
133 log << TestLog::Message
134 << "Using --deqp-vk-device-id="
135 << context.getTestContext().getCommandLine().getVKDeviceId()
136 << TestLog::EndMessage;
138 log << TestLog::Message
139 << "apiVersion: " << vk::unpackVersion(properties.apiVersion) << "\n"
140 << "driverVersion: " << tcu::toHex(properties.driverVersion) << "\n"
141 << "deviceName: " << (const char*)properties.deviceName << "\n"
142 << "vendorID: " << tcu::toHex(properties.vendorID) << "\n"
143 << "deviceID: " << tcu::toHex(properties.deviceID) << "\n"
144 << TestLog::EndMessage;
146 return tcu::TestStatus::pass("Not validated");
149 tcu::TestStatus logPlatformInfo (Context& context)
151 std::ostringstream details;
153 context.getTestContext().getPlatform().getVulkanPlatform().describePlatform(details);
155 context.getTestContext().getLog()
158 << TestLog::EndMessage;
160 return tcu::TestStatus::pass("Not validated");
165 void createInfoTests (tcu::TestCaseGroup* testGroup)
167 addFunctionCase(testGroup, "build", "Build Info", logBuildInfo);
168 addFunctionCase(testGroup, "device", "Device Info", logDeviceInfo);
169 addFunctionCase(testGroup, "platform", "Platform Info", logPlatformInfo);