1e5c31af7Sopenharmony_ci# -*- coding: utf-8 -*- 2e5c31af7Sopenharmony_ci 3e5c31af7Sopenharmony_ci#------------------------------------------------------------------------- 4e5c31af7Sopenharmony_ci# Vulkan CTS 5e5c31af7Sopenharmony_ci# ---------- 6e5c31af7Sopenharmony_ci# 7e5c31af7Sopenharmony_ci# Copyright (c) 2016 Google Inc. 8e5c31af7Sopenharmony_ci# 9e5c31af7Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 10e5c31af7Sopenharmony_ci# you may not use this file except in compliance with the License. 11e5c31af7Sopenharmony_ci# You may obtain a copy of the License at 12e5c31af7Sopenharmony_ci# 13e5c31af7Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 14e5c31af7Sopenharmony_ci# 15e5c31af7Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 16e5c31af7Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 17e5c31af7Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18e5c31af7Sopenharmony_ci# See the License for the specific language governing permissions and 19e5c31af7Sopenharmony_ci# limitations under the License. 20e5c31af7Sopenharmony_ci# 21e5c31af7Sopenharmony_ci#------------------------------------------------------------------------- 22e5c31af7Sopenharmony_ci 23e5c31af7Sopenharmony_ciimport os 24e5c31af7Sopenharmony_cifrom fnmatch import fnmatch 25e5c31af7Sopenharmony_ci 26e5c31af7Sopenharmony_ciSTATEMENT_PATTERN = "STATEMENT-*" 27e5c31af7Sopenharmony_ciTEST_LOG_PATTERN = "*.qpa" 28e5c31af7Sopenharmony_ciGIT_STATUS_PATTERN = "*git-status.txt" 29e5c31af7Sopenharmony_ciGIT_LOG_PATTERN = "*git-log.txt" 30e5c31af7Sopenharmony_ciPATCH_PATTERN = "*.patch" 31e5c31af7Sopenharmony_ciSUMMARY_PATTERN = "cts-run-summary.xml" 32e5c31af7Sopenharmony_ci 33e5c31af7Sopenharmony_ciclass PackageDescription: 34e5c31af7Sopenharmony_ci def __init__ (self, basePath, statement, testLogs, gitStatus, gitLog, patches, summary, conformVersion, conformOs, otherItems): 35e5c31af7Sopenharmony_ci self.basePath = basePath 36e5c31af7Sopenharmony_ci self.statement = statement 37e5c31af7Sopenharmony_ci self.testLogs = testLogs 38e5c31af7Sopenharmony_ci self.gitStatus = gitStatus 39e5c31af7Sopenharmony_ci self.gitLog = gitLog 40e5c31af7Sopenharmony_ci self.patches = patches 41e5c31af7Sopenharmony_ci self.summary = summary 42e5c31af7Sopenharmony_ci self.otherItems = otherItems 43e5c31af7Sopenharmony_ci self.conformVersion = conformVersion 44e5c31af7Sopenharmony_ci self.conformOs = conformOs 45e5c31af7Sopenharmony_ci 46e5c31af7Sopenharmony_cidef getPackageDescription (packagePath): 47e5c31af7Sopenharmony_ci allItems = os.listdir(packagePath) 48e5c31af7Sopenharmony_ci statement = None 49e5c31af7Sopenharmony_ci testLogs = [] 50e5c31af7Sopenharmony_ci gitStatus = [] 51e5c31af7Sopenharmony_ci gitLog = [] 52e5c31af7Sopenharmony_ci patches = [] 53e5c31af7Sopenharmony_ci summary = None 54e5c31af7Sopenharmony_ci otherItems = [] 55e5c31af7Sopenharmony_ci conformVersion = None 56e5c31af7Sopenharmony_ci conformOs = None 57e5c31af7Sopenharmony_ci 58e5c31af7Sopenharmony_ci for item in allItems: 59e5c31af7Sopenharmony_ci if fnmatch(item, STATEMENT_PATTERN): 60e5c31af7Sopenharmony_ci assert statement == None 61e5c31af7Sopenharmony_ci statement = item 62e5c31af7Sopenharmony_ci elif fnmatch(item, TEST_LOG_PATTERN): 63e5c31af7Sopenharmony_ci testLogs.append(item) 64e5c31af7Sopenharmony_ci elif fnmatch(item, GIT_STATUS_PATTERN): 65e5c31af7Sopenharmony_ci gitStatus.append(item) 66e5c31af7Sopenharmony_ci elif fnmatch(item, GIT_LOG_PATTERN): 67e5c31af7Sopenharmony_ci gitLog.append((item, '.')) 68e5c31af7Sopenharmony_ci elif fnmatch(item, PATCH_PATTERN): 69e5c31af7Sopenharmony_ci patches.append(item) 70e5c31af7Sopenharmony_ci elif fnmatch(item, SUMMARY_PATTERN): 71e5c31af7Sopenharmony_ci assert summary == None 72e5c31af7Sopenharmony_ci summary = item 73e5c31af7Sopenharmony_ci else: 74e5c31af7Sopenharmony_ci otherItems.append(item) 75e5c31af7Sopenharmony_ci 76e5c31af7Sopenharmony_ci return PackageDescription(packagePath, statement, testLogs, gitStatus, gitLog, patches, summary, conformVersion, conformOs, otherItems) 77