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