1 /*-------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
5 * Copyright (c) 2016 Google Inc.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief Build and Device Tests
22 *//*--------------------------------------------------------------------*/
24 #include "vktInfoTests.hpp"
25 #include "vktTestCaseUtil.hpp"
26 #include "vkPlatform.hpp"
27 #include "vkApiVersion.hpp"
28 #include "tcuTestLog.hpp"
29 #include "tcuFormatUtil.hpp"
30 #include "tcuCommandLine.hpp"
31 #include "tcuPlatform.hpp"
32 #include "deStringUtil.hpp"
43 std::string getOsName (int os)
47 case DE_OS_VANILLA: return "DE_OS_VANILLA";
48 case DE_OS_WIN32: return "DE_OS_WIN32";
49 case DE_OS_UNIX: return "DE_OS_UNIX";
50 case DE_OS_WINCE: return "DE_OS_WINCE";
51 case DE_OS_OSX: return "DE_OS_OSX";
52 case DE_OS_ANDROID: return "DE_OS_ANDROID";
53 case DE_OS_SYMBIAN: return "DE_OS_SYMBIAN";
54 case DE_OS_IOS: return "DE_OS_IOS";
56 return de::toString(os);
60 std::string getCompilerName (int compiler)
64 case DE_COMPILER_VANILLA: return "DE_COMPILER_VANILLA";
65 case DE_COMPILER_MSC: return "DE_COMPILER_MSC";
66 case DE_COMPILER_GCC: return "DE_COMPILER_GCC";
67 case DE_COMPILER_CLANG: return "DE_COMPILER_CLANG";
69 return de::toString(compiler);
73 std::string getCpuName (int cpu)
77 case DE_CPU_VANILLA: return "DE_CPU_VANILLA";
78 case DE_CPU_ARM: return "DE_CPU_ARM";
79 case DE_CPU_X86: return "DE_CPU_X86";
80 case DE_CPU_X86_64: return "DE_CPU_X86_64";
81 case DE_CPU_ARM_64: return "DE_CPU_ARM_64";
82 case DE_CPU_MIPS: return "DE_CPU_MIPS";
83 case DE_CPU_MIPS_64: return "DE_CPU_MIPS_64";
85 return de::toString(cpu);
89 std::string getEndiannessName (int endianness)
93 case DE_BIG_ENDIAN: return "DE_BIG_ENDIAN";
94 case DE_LITTLE_ENDIAN: return "DE_LITTLE_ENDIAN";
96 return de::toString(endianness);
100 tcu::TestStatus logBuildInfo (Context& context)
102 #if defined(DE_DEBUG)
103 const bool isDebug = true;
105 const bool isDebug = false;
108 context.getTestContext().getLog()
110 << "DE_OS: " << getOsName(DE_OS) << "\n"
111 << "DE_CPU: " << getCpuName(DE_CPU) << "\n"
112 << "DE_PTR_SIZE: " << DE_PTR_SIZE << "\n"
113 << "DE_ENDIANNESS: " << getEndiannessName(DE_ENDIANNESS) << "\n"
114 << "DE_COMPILER: " << getCompilerName(DE_COMPILER) << "\n"
115 << "DE_DEBUG: " << (isDebug ? "true" : "false") << "\n"
116 << TestLog::EndMessage;
118 return tcu::TestStatus::pass("Not validated");
121 tcu::TestStatus logDeviceInfo (Context& context)
123 TestLog& log = context.getTestContext().getLog();
124 const vk::VkPhysicalDeviceProperties& properties = context.getDeviceProperties();
126 log << TestLog::Message
127 << "Using --deqp-vk-device-id="
128 << context.getTestContext().getCommandLine().getVKDeviceId()
129 << TestLog::EndMessage;
131 log << TestLog::Message
132 << "apiVersion: " << vk::unpackVersion(properties.apiVersion) << "\n"
133 << "driverVersion: " << tcu::toHex(properties.driverVersion) << "\n"
134 << "deviceName: " << (const char*)properties.deviceName << "\n"
135 << "vendorID: " << tcu::toHex(properties.vendorID) << "\n"
136 << "deviceID: " << tcu::toHex(properties.deviceID) << "\n"
137 << TestLog::EndMessage;
139 return tcu::TestStatus::pass("Not validated");
142 tcu::TestStatus logPlatformInfo (Context& context)
144 std::ostringstream details;
146 context.getTestContext().getPlatform().getVulkanPlatform().describePlatform(details);
148 context.getTestContext().getLog()
151 << TestLog::EndMessage;
153 return tcu::TestStatus::pass("Not validated");
158 void createInfoTests (tcu::TestCaseGroup* testGroup)
160 addFunctionCase(testGroup, "build", "Build Info", logBuildInfo);
161 addFunctionCase(testGroup, "device", "Device Info", logDeviceInfo);
162 addFunctionCase(testGroup, "platform", "Platform Info", logPlatformInfo);