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