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 38 SessionInfo (deUint32 vendorId, 39 deUint32 deviceId, 40 const std::string& deviceName, 41 const std::string& cmdLine); 42 SessionInfo (std::string vendor, 43 std::string renderer, 44 const std::string& cmdLine); 45 46 std::string get (); 47 48 private: 49 50 // WaiverTreeBuilder fills private fields of this class. 51 friend class WaiverTreeBuilder; 52 53 // String containing urls to gitlab issues 54 // that enable currently used waivers 55 std::string m_waiverUrls; 56 57 // String containing command line 58 std::string m_cmdLine; 59 60 // Stream containing all info 61 std::stringstream m_info; 62 }; 63 64 // Class that uses paths to waived tests represented in a form of tree. 65 // Main functionality of this class is to quickly test test paths in 66 // order to verify if it is on waived tests list that was read from xml. 67 class WaiverUtil 68 { 69 public: 70 WaiverUtil () = default; 71 72 void setup (const std::string waiverFile, 73 std::string packageName, 74 deUint32 vendorId, 75 deUint32 deviceId, 76 SessionInfo& sessionInfo); 77 void setup (const std::string waiverFile, 78 std::string packageName, 79 std::string vendor, 80 std::string renderer, 81 SessionInfo& sessionInfo); 82 83 bool isOnWaiverList (const std::string& casePath) const; 84 85 public: 86 87 struct WaiverComponent 88 { 89 std::string name; 90 std::vector<WaiverComponent*> children; 91 }; 92 93 private: 94 95 std::vector<WaiverComponent> m_waiverTree; 96 }; 97 98 } // tcu 99 100 #endif // _TCUWAIVERUTIL_HPP 101