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 Confidential Information as defined by the
19 * Khronos Membership Agreement until designated non-confidential by
20 * Khronos, at which point this condition clause shall be removed.
22 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
32 * \brief Build and Device Tests
33 *//*--------------------------------------------------------------------*/
35 #include "vktInfoTests.hpp"
36 #include "vktTestCaseUtil.hpp"
37 #include "vkPlatform.hpp"
38 #include "vkApiVersion.hpp"
39 #include "tcuTestLog.hpp"
40 #include "tcuFormatUtil.hpp"
41 #include "tcuCommandLine.hpp"
42 #include "tcuPlatform.hpp"
43 #include "deStringUtil.hpp"
54 std::string getOsName (int os)
58 case DE_OS_VANILLA: return "DE_OS_VANILLA";
59 case DE_OS_WIN32: return "DE_OS_WIN32";
60 case DE_OS_UNIX: return "DE_OS_UNIX";
61 case DE_OS_WINCE: return "DE_OS_WINCE";
62 case DE_OS_OSX: return "DE_OS_OSX";
63 case DE_OS_ANDROID: return "DE_OS_ANDROID";
64 case DE_OS_SYMBIAN: return "DE_OS_SYMBIAN";
65 case DE_OS_IOS: return "DE_OS_IOS";
67 return de::toString(os);
71 std::string getCompilerName (int compiler)
75 case DE_COMPILER_VANILLA: return "DE_COMPILER_VANILLA";
76 case DE_COMPILER_MSC: return "DE_COMPILER_MSC";
77 case DE_COMPILER_GCC: return "DE_COMPILER_GCC";
78 case DE_COMPILER_CLANG: return "DE_COMPILER_CLANG";
80 return de::toString(compiler);
84 std::string getCpuName (int cpu)
88 case DE_CPU_VANILLA: return "DE_CPU_VANILLA";
89 case DE_CPU_ARM: return "DE_CPU_ARM";
90 case DE_CPU_X86: return "DE_CPU_X86";
91 case DE_CPU_X86_64: return "DE_CPU_X86_64";
92 case DE_CPU_ARM_64: return "DE_CPU_ARM_64";
93 case DE_CPU_MIPS: return "DE_CPU_MIPS";
94 case DE_CPU_MIPS_64: return "DE_CPU_MIPS_64";
96 return de::toString(cpu);
100 std::string getEndiannessName (int endianness)
104 case DE_BIG_ENDIAN: return "DE_BIG_ENDIAN";
105 case DE_LITTLE_ENDIAN: return "DE_LITTLE_ENDIAN";
107 return de::toString(endianness);
111 tcu::TestStatus logBuildInfo (Context& context)
113 #if defined(DE_DEBUG)
114 const bool isDebug = true;
116 const bool isDebug = false;
119 context.getTestContext().getLog()
121 << "DE_OS: " << getOsName(DE_OS) << "\n"
122 << "DE_CPU: " << getCpuName(DE_CPU) << "\n"
123 << "DE_PTR_SIZE: " << DE_PTR_SIZE << "\n"
124 << "DE_ENDIANNESS: " << getEndiannessName(DE_ENDIANNESS) << "\n"
125 << "DE_COMPILER: " << getCompilerName(DE_COMPILER) << "\n"
126 << "DE_DEBUG: " << (isDebug ? "true" : "false") << "\n"
127 << TestLog::EndMessage;
129 return tcu::TestStatus::pass("Not validated");
132 tcu::TestStatus logDeviceInfo (Context& context)
134 TestLog& log = context.getTestContext().getLog();
135 const vk::VkPhysicalDeviceProperties& properties = context.getDeviceProperties();
137 log << TestLog::Message
138 << "Using --deqp-vk-device-id="
139 << context.getTestContext().getCommandLine().getVKDeviceId()
140 << TestLog::EndMessage;
142 log << TestLog::Message
143 << "apiVersion: " << vk::unpackVersion(properties.apiVersion) << "\n"
144 << "driverVersion: " << tcu::toHex(properties.driverVersion) << "\n"
145 << "deviceName: " << (const char*)properties.deviceName << "\n"
146 << "vendorID: " << tcu::toHex(properties.vendorID) << "\n"
147 << "deviceID: " << tcu::toHex(properties.deviceID) << "\n"
148 << TestLog::EndMessage;
150 return tcu::TestStatus::pass("Not validated");
153 tcu::TestStatus logPlatformInfo (Context& context)
155 std::ostringstream details;
157 context.getTestContext().getPlatform().getVulkanPlatform().describePlatform(details);
159 context.getTestContext().getLog()
162 << TestLog::EndMessage;
164 return tcu::TestStatus::pass("Not validated");
169 void createInfoTests (tcu::TestCaseGroup* testGroup)
171 addFunctionCase(testGroup, "build", "Build Info", logBuildInfo);
172 addFunctionCase(testGroup, "device", "Device Info", logDeviceInfo);
173 addFunctionCase(testGroup, "platform", "Platform Info", logPlatformInfo);