1*35238bceSAndroid Build Coastguard Worker# -*- coding: utf-8 -*- 2*35238bceSAndroid Build Coastguard Worker 3*35238bceSAndroid Build Coastguard Worker#------------------------------------------------------------------------- 4*35238bceSAndroid Build Coastguard Worker# drawElements Quality Program utilities 5*35238bceSAndroid Build Coastguard Worker# -------------------------------------- 6*35238bceSAndroid Build Coastguard Worker# 7*35238bceSAndroid Build Coastguard Worker# Copyright 2015 The Android Open Source Project 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 sys 24*35238bceSAndroid Build Coastguard Worker 25*35238bceSAndroid Build Coastguard WorkerRENAME_LIST_2011_1_2011_2 = [ 26*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.shaders.random.basic_expressions.*", "dEQP-GLES2.functional.shaders.random.basic_expression."), 27*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.shaders.random.scalar_conversions.*", "dEQP-GLES2.functional.shaders.random.scalar_conversion."), 28*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.fbo.render.color_clears_*", "dEQP-GLES2.functional.fbo.render.color_clear."), 29*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.fbo.render.intersecting_quads_*", "dEQP-GLES2.functional.fbo.render.depth."), 30*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.fbo.render.mix_*", "dEQP-GLES2.functional.fbo.render.color.mix_"), 31*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.fbo.render.blend_*", "dEQP-GLES2.functional.fbo.render.color.blend_"), 32*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.fbo.render.shared_colorbuffer_clears_*", "dEQP-GLES2.functional.fbo.render.shared_colorbuffer_clear."), 33*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.fbo.render.shared_colorbuffer_*", "dEQP-GLES2.functional.fbo.render.shared_colorbuffer."), 34*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.fbo.render.shared_depthbuffer_*", "dEQP-GLES2.functional.fbo.render.shared_depthbuffer."), 35*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.fbo.render.texsubimage_*", "dEQP-GLES2.functional.fbo.render.texsubimage."), 36*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.fbo.render.recreate_colorbuffer_*", "dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.no_rebind_"), 37*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.fbo.render.recreate_depthbuffer_*", "dEQP-GLES2.functional.fbo.render.recreate_depthbuffer.no_rebind_"), 38*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.fbo.render.resize_*", "dEQP-GLES2.functional.fbo.render.resize.") 39*35238bceSAndroid Build Coastguard Worker] 40*35238bceSAndroid Build Coastguard Worker 41*35238bceSAndroid Build Coastguard WorkerRENAME_LIST_2011_2_2011_3 = [ 42*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.ui.src_over_linear_1_batched", "dEQP-GLES2.usecases.ui.src_over_linear_batched_1"), 43*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.ui.src_over_linear_2_batched", "dEQP-GLES2.usecases.ui.src_over_linear_batched_2"), 44*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.ui.src_over_linear_4_batched", "dEQP-GLES2.usecases.ui.src_over_linear_batched_4"), 45*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.ui.src_over_nearest_1_batched", "dEQP-GLES2.usecases.ui.src_over_nearest_batched_1"), 46*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.ui.src_over_nearest_2_batched", "dEQP-GLES2.usecases.ui.src_over_nearest_batched_2"), 47*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.ui.src_over_nearest_4_batched", "dEQP-GLES2.usecases.ui.src_over_nearest_batched_4"), 48*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.ui.premultiplied_src_over_linear_1_batched", "dEQP-GLES2.usecases.ui.premultiplied_src_over_linear_batched_1"), 49*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.ui.premultiplied_src_over_linear_2_batched", "dEQP-GLES2.usecases.ui.premultiplied_src_over_linear_batched_2"), 50*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.ui.premultiplied_src_over_linear_4_batched", "dEQP-GLES2.usecases.ui.premultiplied_src_over_linear_batched_4"), 51*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.ui.premultiplied_src_over_nearest_1_batched", "dEQP-GLES2.usecases.ui.premultiplied_src_over_nearest_batched_1"), 52*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.ui.premultiplied_src_over_nearest_2_batched", "dEQP-GLES2.usecases.ui.premultiplied_src_over_nearest_batched_2"), 53*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.ui.premultiplied_src_over_nearest_4_batched", "dEQP-GLES2.usecases.ui.premultiplied_src_over_nearest_batched_4"), 54*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.ui.no_blend_linear_1_batched", "dEQP-GLES2.usecases.ui.no_blend_linear_batched_1"), 55*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.ui.no_blend_linear_2_batched", "dEQP-GLES2.usecases.ui.no_blend_linear_batched_2"), 56*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.ui.no_blend_linear_4_batched", "dEQP-GLES2.usecases.ui.no_blend_linear_batched_4"), 57*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.ui.no_blend_nearest_1_batched", "dEQP-GLES2.usecases.ui.no_blend_nearest_batched_1"), 58*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.ui.no_blend_nearest_2_batched", "dEQP-GLES2.usecases.ui.no_blend_nearest_batched_2"), 59*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.ui.no_blend_nearest_4_batched", "dEQP-GLES2.usecases.ui.no_blend_nearest_batched_4") 60*35238bceSAndroid Build Coastguard Worker] 61*35238bceSAndroid Build Coastguard Worker 62*35238bceSAndroid Build Coastguard WorkerRENAME_LIST_2011_3_2011_4 = [] 63*35238bceSAndroid Build Coastguard Worker 64*35238bceSAndroid Build Coastguard WorkerRENAME_LIST_2011_4_2012_1 = [ 65*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.vertex_arrays.multiple_attributes.output_types.*", "dEQP-GLES2.functional.vertex_arrays.multiple_attributes.input_types."), 66*35238bceSAndroid Build Coastguard Worker] 67*35238bceSAndroid Build Coastguard Worker 68*35238bceSAndroid Build Coastguard WorkerRENAME_LIST_2012_2_2012_3 = [ 69*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.shaders.operator.geometric.refract.mediump_float_vertex", "dEQP-GLES2.functional.shaders.operator.geometric.refract.mediump_float_float_vertex"), 70*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.shaders.operator.geometric.refract.mediump_float_fragment", "dEQP-GLES2.functional.shaders.operator.geometric.refract.mediump_float_float_fragment"), 71*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.shaders.operator.geometric.refract.highp_float_vertex", "dEQP-GLES2.functional.shaders.operator.geometric.refract.highp_float_float_vertex"), 72*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.shaders.operator.geometric.refract.highp_float_fragment", "dEQP-GLES2.functional.shaders.operator.geometric.refract.highp_float_float_fragment"), 73*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.shaders.operator.geometric.refract.mediump_vec2_vertex", "dEQP-GLES2.functional.shaders.operator.geometric.refract.mediump_vec2_float_vertex"), 74*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.shaders.operator.geometric.refract.mediump_vec2_fragment", "dEQP-GLES2.functional.shaders.operator.geometric.refract.mediump_vec2_float_fragment"), 75*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.shaders.operator.geometric.refract.highp_vec2_vertex", "dEQP-GLES2.functional.shaders.operator.geometric.refract.highp_vec2_float_vertex"), 76*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.shaders.operator.geometric.refract.highp_vec2_fragment", "dEQP-GLES2.functional.shaders.operator.geometric.refract.highp_vec2_float_fragment"), 77*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.shaders.operator.geometric.refract.mediump_vec3_vertex", "dEQP-GLES2.functional.shaders.operator.geometric.refract.mediump_vec3_float_vertex"), 78*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.shaders.operator.geometric.refract.mediump_vec3_fragment", "dEQP-GLES2.functional.shaders.operator.geometric.refract.mediump_vec3_float_fragment"), 79*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.shaders.operator.geometric.refract.highp_vec3_vertex", "dEQP-GLES2.functional.shaders.operator.geometric.refract.highp_vec3_float_vertex"), 80*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.shaders.operator.geometric.refract.highp_vec3_fragment", "dEQP-GLES2.functional.shaders.operator.geometric.refract.highp_vec3_float_fragment"), 81*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.shaders.operator.geometric.refract.mediump_vec4_vertex", "dEQP-GLES2.functional.shaders.operator.geometric.refract.mediump_vec4_float_vertex"), 82*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.shaders.operator.geometric.refract.mediump_vec4_fragment", "dEQP-GLES2.functional.shaders.operator.geometric.refract.mediump_vec4_float_fragment"), 83*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.shaders.operator.geometric.refract.highp_vec4_vertex", "dEQP-GLES2.functional.shaders.operator.geometric.refract.highp_vec4_float_vertex"), 84*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.shaders.operator.geometric.refract.highp_vec4_fragment", "dEQP-GLES2.functional.shaders.operator.geometric.refract.highp_vec4_float_fragment"), 85*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.negative_api.texture.copyteximage2d_unequal_width_height_cube", "dEQP-GLES2.functional.negative_api.texture.copyteximage2d_inequal_width_height_cube"), 86*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.negative_api.texture.teximage2d_unequal_width_height_cube", "dEQP-GLES2.functional.negative_api.texture.teximage2d_inequal_width_height_cube"), 87*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.negative_api.vertex_array.draw_arrays", "dEQP-GLES2.functional.negative_api.vertex_array.draw_arrays_invalid_program"), 88*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.negative_api.vertex_array.draw_elemens", "dEQP-GLES2.functional.negative_api.vertex_array.draw_elements_invalid_program"), 89*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.negative_api.shader.attach_shader_invalid_object", "dEQP-GLES2.functional.negative_api.shader.attach_shader"), 90*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.negative_api.shader.detach_shader_invalid_object", "dEQP-GLES2.functional.negative_api.shader.detach_shader"), 91*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.1sample.1_vertex_lights_no_texture", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_1sample.1_vertex_lights_no_texture"), 92*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.1sample.2_vertex_lights_no_texture", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_1sample.2_vertex_lights_no_texture"), 93*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.1sample.4_vertex_lights_no_texture", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_1sample.4_vertex_lights_no_texture"), 94*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.1sample.1_vertex_lights", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_1sample.1_vertex_lights"), 95*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.1sample.2_vertex_lights", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_1sample.2_vertex_lights"), 96*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.1sample.4_vertex_lights", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_1sample.4_vertex_lights"), 97*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.1sample.1_fragment_lights", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_1sample.1_fragment_lights"), 98*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.1sample.2_fragment_lights", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_1sample.2_fragment_lights"), 99*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.1sample.4_fragment_lights", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_1sample.4_fragment_lights"), 100*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.4sample.1_vertex_lights_no_texture", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_4sample.1_vertex_lights_no_texture"), 101*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.4sample.2_vertex_lights_no_texture", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_4sample.2_vertex_lights_no_texture"), 102*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.4sample.4_vertex_lights_no_texture", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_4sample.4_vertex_lights_no_texture"), 103*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.4sample.1_vertex_lights", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_4sample.1_vertex_lights"), 104*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.4sample.2_vertex_lights", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_4sample.2_vertex_lights"), 105*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.4sample.4_vertex_lights", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_4sample.4_vertex_lights"), 106*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.4sample.1_fragment_lights", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_4sample.1_fragment_lights"), 107*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.4sample.2_fragment_lights", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_4sample.2_fragment_lights"), 108*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.4sample.4_fragment_lights", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_4sample.4_fragment_lights"), 109*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.16sample.1_vertex_lights_no_texture", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_16sample.1_vertex_lights_no_texture"), 110*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.16sample.2_vertex_lights_no_texture", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_16sample.2_vertex_lights_no_texture"), 111*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.16sample.4_vertex_lights_no_texture", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_16sample.4_vertex_lights_no_texture"), 112*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.16sample.1_vertex_lights", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_16sample.1_vertex_lights"), 113*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.16sample.2_vertex_lights", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_16sample.2_vertex_lights"), 114*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.16sample.4_vertex_lights", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_16sample.4_vertex_lights"), 115*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.16sample.1_fragment_lights", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_16sample.1_fragment_lights"), 116*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.16sample.2_fragment_lights", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_16sample.2_fragment_lights"), 117*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.usecases.shadow.shadowmap.16sample.4_fragment_lights", "dEQP-GLES2.usecases.shadow.shadowmaps.basic_16sample.4_fragment_lights") 118*35238bceSAndroid Build Coastguard Worker] 119*35238bceSAndroid Build Coastguard Worker 120*35238bceSAndroid Build Coastguard WorkerRENAME_LIST_2012_3_2012_4 = [ 121*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.depth.*", "dEQP-GLES2.functional.fragment_ops.depth."), 122*35238bceSAndroid Build Coastguard Worker ("dEQP-GLES2.functional.stencil.*", "dEQP-GLES2.functional.fragment_ops.stencil.") 123*35238bceSAndroid Build Coastguard Worker] 124*35238bceSAndroid Build Coastguard Worker 125*35238bceSAndroid Build Coastguard Workerdef readCaseList (filename): 126*35238bceSAndroid Build Coastguard Worker f = open(filename, 'r') 127*35238bceSAndroid Build Coastguard Worker cases = [] 128*35238bceSAndroid Build Coastguard Worker for line in f: 129*35238bceSAndroid Build Coastguard Worker if line[0:5] == "TEST:": 130*35238bceSAndroid Build Coastguard Worker cases.append(line[6:].strip()) 131*35238bceSAndroid Build Coastguard Worker f.close() 132*35238bceSAndroid Build Coastguard Worker return cases 133*35238bceSAndroid Build Coastguard Worker 134*35238bceSAndroid Build Coastguard Workerdef isWildcardPattern (pattern): 135*35238bceSAndroid Build Coastguard Worker return pattern[-1:] == '*' 136*35238bceSAndroid Build Coastguard Worker 137*35238bceSAndroid Build Coastguard Worker# returns (cases, renames) 138*35238bceSAndroid Build Coastguard Workerdef renameCases (cases, rename): 139*35238bceSAndroid Build Coastguard Worker renamedCases = [] 140*35238bceSAndroid Build Coastguard Worker renamedSet = set() 141*35238bceSAndroid Build Coastguard Worker renames = [] 142*35238bceSAndroid Build Coastguard Worker for case in cases: 143*35238bceSAndroid Build Coastguard Worker renamed = None 144*35238bceSAndroid Build Coastguard Worker 145*35238bceSAndroid Build Coastguard Worker for src, dst in rename: 146*35238bceSAndroid Build Coastguard Worker if isWildcardPattern(src) and case[:len(src)-1] == src[:-1]: 147*35238bceSAndroid Build Coastguard Worker renamed = dst + case[len(src)-1:] 148*35238bceSAndroid Build Coastguard Worker break 149*35238bceSAndroid Build Coastguard Worker elif case == src: 150*35238bceSAndroid Build Coastguard Worker renamed = dst 151*35238bceSAndroid Build Coastguard Worker break 152*35238bceSAndroid Build Coastguard Worker 153*35238bceSAndroid Build Coastguard Worker if renamed != None: 154*35238bceSAndroid Build Coastguard Worker renames.append((case, renamed)) 155*35238bceSAndroid Build Coastguard Worker case = renamed 156*35238bceSAndroid Build Coastguard Worker 157*35238bceSAndroid Build Coastguard Worker # It is possible that some later case is renamed to case already seen in the list 158*35238bceSAndroid Build Coastguard Worker assert not case in renamedSet or renamed != None 159*35238bceSAndroid Build Coastguard Worker if case not in renamedSet: 160*35238bceSAndroid Build Coastguard Worker renamedCases.append(case) 161*35238bceSAndroid Build Coastguard Worker renamedSet.add(case) 162*35238bceSAndroid Build Coastguard Worker 163*35238bceSAndroid Build Coastguard Worker return (renamedCases, renames) 164*35238bceSAndroid Build Coastguard Worker 165*35238bceSAndroid Build Coastguard Worker# returns (added, removed) lists 166*35238bceSAndroid Build Coastguard Workerdef diffCaseLists (old, new): 167*35238bceSAndroid Build Coastguard Worker added = [] 168*35238bceSAndroid Build Coastguard Worker removed = [] 169*35238bceSAndroid Build Coastguard Worker 170*35238bceSAndroid Build Coastguard Worker oldSet = set(old) 171*35238bceSAndroid Build Coastguard Worker newSet = set(new) 172*35238bceSAndroid Build Coastguard Worker 173*35238bceSAndroid Build Coastguard Worker # build added list 174*35238bceSAndroid Build Coastguard Worker for case in new: 175*35238bceSAndroid Build Coastguard Worker if not case in oldSet: 176*35238bceSAndroid Build Coastguard Worker added.append(case) 177*35238bceSAndroid Build Coastguard Worker 178*35238bceSAndroid Build Coastguard Worker # build removed set 179*35238bceSAndroid Build Coastguard Worker for case in old: 180*35238bceSAndroid Build Coastguard Worker if not case in newSet: 181*35238bceSAndroid Build Coastguard Worker removed.append(case) 182*35238bceSAndroid Build Coastguard Worker 183*35238bceSAndroid Build Coastguard Worker return (added, removed) 184*35238bceSAndroid Build Coastguard Worker 185*35238bceSAndroid Build Coastguard Workerif __name__ == "__main__": 186*35238bceSAndroid Build Coastguard Worker if len(sys.argv) != 3: 187*35238bceSAndroid Build Coastguard Worker print("%s [old caselist] [new caselist]" % sys.argv[0]) 188*35238bceSAndroid Build Coastguard Worker sys.exit(-1) 189*35238bceSAndroid Build Coastguard Worker 190*35238bceSAndroid Build Coastguard Worker oldCases = readCaseList(sys.argv[1]) 191*35238bceSAndroid Build Coastguard Worker newCases = readCaseList(sys.argv[2]) 192*35238bceSAndroid Build Coastguard Worker rename = RENAME_LIST_2012_3_2012_4 193*35238bceSAndroid Build Coastguard Worker 194*35238bceSAndroid Build Coastguard Worker renamedCases, renameList = renameCases(oldCases, rename) 195*35238bceSAndroid Build Coastguard Worker added, removed = diffCaseLists(renamedCases, newCases) 196*35238bceSAndroid Build Coastguard Worker 197*35238bceSAndroid Build Coastguard Worker# for src, dst in rename: 198*35238bceSAndroid Build Coastguard Worker# print("RENAME: %s -> %s" % (src, dst)) 199*35238bceSAndroid Build Coastguard Worker 200*35238bceSAndroid Build Coastguard Worker for case in added: 201*35238bceSAndroid Build Coastguard Worker print("ADD: %s" % case) 202*35238bceSAndroid Build Coastguard Worker 203*35238bceSAndroid Build Coastguard Worker for src, dst in renameList: 204*35238bceSAndroid Build Coastguard Worker print("RENAME: %s -> %s" % (src, dst)) 205*35238bceSAndroid Build Coastguard Worker 206*35238bceSAndroid Build Coastguard Worker for case in removed: 207*35238bceSAndroid Build Coastguard Worker print("REMOVE: %s" % case) 208