1 #ifndef _TCUWAIVERUTIL_HPP 2 #define _TCUWAIVERUTIL_HPP 3 /*------------------------------------------------------------------------- 4 * Vulkan CTS Framework 5 * -------------------- 6 * 7 * Copyright (c) 2020 The Khronos Group Inc. 8 * 9 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * you may not use this file except in compliance with the License. 11 * You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 * 21 *//*! 22 * \file 23 * \brief Waiver mechanism implementation. 24 *//*--------------------------------------------------------------------*/ 25 26 #include "deDefs.h" 27 #include <sstream> 28 #include <vector> 29 30 namespace tcu 31 { 32 33 // Class containing information about session that are printed at the beginning of log. 34 class SessionInfo 35 { 36 public: 37 SessionInfo(uint32_t vendorId, uint32_t deviceId, const std::string &deviceName, const std::string &cmdLine); 38 SessionInfo(std::string vendor, std::string renderer, const std::string &cmdLine); 39 40 std::string get(); 41 42 private: 43 // WaiverTreeBuilder fills private fields of this class. 44 friend class WaiverTreeBuilder; 45 46 // String containing urls to gitlab issues 47 // that enable currently used waivers 48 std::string m_waiverUrls; 49 50 // String containing command line 51 std::string m_cmdLine; 52 53 // Stream containing all info 54 std::stringstream m_info; 55 }; 56 57 // Class that uses paths to waived tests represented in a form of tree. 58 // Main functionality of this class is to quickly test test paths in 59 // order to verify if it is on waived tests list that was read from xml. 60 class WaiverUtil 61 { 62 public: 63 WaiverUtil() = default; 64 65 void setup(const std::string waiverFile, std::string packageName, uint32_t vendorId, uint32_t deviceId, 66 SessionInfo &sessionInfo); 67 void setup(const std::string waiverFile, std::string packageName, std::string vendor, std::string renderer, 68 SessionInfo &sessionInfo); 69 70 bool isOnWaiverList(const std::string &casePath) const; 71 72 public: 73 struct WaiverComponent 74 { 75 std::string name; 76 std::vector<WaiverComponent *> children; 77 }; 78 79 private: 80 std::vector<WaiverComponent> m_waiverTree; 81 }; 82 83 } // namespace tcu 84 85 #endif // _TCUWAIVERUTIL_HPP 86