1bf215546Sopenharmony_ci#!/usr/bin/python3 2bf215546Sopenharmony_ci# 3bf215546Sopenharmony_ci# Copyright 2021 Advanced Micro Devices, Inc. 4bf215546Sopenharmony_ci# 5bf215546Sopenharmony_ci# Permission is hereby granted, free of charge, to any person obtaining a 6bf215546Sopenharmony_ci# copy of this software and associated documentation files (the "Software"), 7bf215546Sopenharmony_ci# to deal in the Software without restriction, including without limitation 8bf215546Sopenharmony_ci# on the rights to use, copy, modify, merge, publish, distribute, sub 9bf215546Sopenharmony_ci# license, and/or sell copies of the Software, and to permit persons to whom 10bf215546Sopenharmony_ci# the Software is furnished to do so, subject to the following conditions: 11bf215546Sopenharmony_ci# 12bf215546Sopenharmony_ci# The above copyright notice and this permission notice (including the next 13bf215546Sopenharmony_ci# paragraph) shall be included in all copies or substantial portions of the 14bf215546Sopenharmony_ci# Software. 15bf215546Sopenharmony_ci# 16bf215546Sopenharmony_ci# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17bf215546Sopenharmony_ci# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18bf215546Sopenharmony_ci# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 19bf215546Sopenharmony_ci# THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 20bf215546Sopenharmony_ci# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 21bf215546Sopenharmony_ci# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 22bf215546Sopenharmony_ci# USE OR OTHER DEALINGS IN THE SOFTWARE. 23bf215546Sopenharmony_ci# 24bf215546Sopenharmony_ci 25bf215546Sopenharmony_ciimport os 26bf215546Sopenharmony_ciimport sys 27bf215546Sopenharmony_ciimport argparse 28bf215546Sopenharmony_ciimport subprocess 29bf215546Sopenharmony_ciimport shutil 30bf215546Sopenharmony_cifrom datetime import datetime 31bf215546Sopenharmony_ciimport tempfile 32bf215546Sopenharmony_ciimport itertools 33bf215546Sopenharmony_ciimport filecmp 34bf215546Sopenharmony_ciimport multiprocessing 35bf215546Sopenharmony_ciimport csv 36bf215546Sopenharmony_ci 37bf215546Sopenharmony_ci 38bf215546Sopenharmony_cidef print_red(txt, end_line=True, prefix=None): 39bf215546Sopenharmony_ci if prefix: 40bf215546Sopenharmony_ci print(prefix, end="") 41bf215546Sopenharmony_ci print("\033[0;31m{}\033[0m".format(txt), end="\n" if end_line else " ") 42bf215546Sopenharmony_ci 43bf215546Sopenharmony_ci 44bf215546Sopenharmony_cidef print_yellow(txt, end_line=True, prefix=None): 45bf215546Sopenharmony_ci if prefix: 46bf215546Sopenharmony_ci print(prefix, end="") 47bf215546Sopenharmony_ci print("\033[1;33m{}\033[0m".format(txt), end="\n" if end_line else " ") 48bf215546Sopenharmony_ci 49bf215546Sopenharmony_ci 50bf215546Sopenharmony_cidef print_green(txt, end_line=True, prefix=None): 51bf215546Sopenharmony_ci if prefix: 52bf215546Sopenharmony_ci print(prefix, end="") 53bf215546Sopenharmony_ci print("\033[1;32m{}\033[0m".format(txt), end="\n" if end_line else " ") 54bf215546Sopenharmony_ci 55bf215546Sopenharmony_ci 56bf215546Sopenharmony_ciparser = argparse.ArgumentParser( 57bf215546Sopenharmony_ci description="radeonsi tester", 58bf215546Sopenharmony_ci formatter_class=argparse.ArgumentDefaultsHelpFormatter, 59bf215546Sopenharmony_ci) 60bf215546Sopenharmony_ciparser.add_argument( 61bf215546Sopenharmony_ci "--jobs", 62bf215546Sopenharmony_ci "-j", 63bf215546Sopenharmony_ci type=int, 64bf215546Sopenharmony_ci help="Number of processes/threads to use.", 65bf215546Sopenharmony_ci default=multiprocessing.cpu_count(), 66bf215546Sopenharmony_ci) 67bf215546Sopenharmony_ciparser.add_argument("--piglit-path", type=str, help="Path to piglit source folder.") 68bf215546Sopenharmony_ciparser.add_argument("--glcts-path", type=str, help="Path to GLCTS source folder.") 69bf215546Sopenharmony_ciparser.add_argument("--deqp-path", type=str, help="Path to dEQP source folder.") 70bf215546Sopenharmony_ciparser.add_argument( 71bf215546Sopenharmony_ci "--parent-path", 72bf215546Sopenharmony_ci type=str, 73bf215546Sopenharmony_ci help="Path to folder containing piglit/GLCTS and dEQP source folders.", 74bf215546Sopenharmony_ci default=os.getenv("MAREKO_BUILD_PATH"), 75bf215546Sopenharmony_ci) 76bf215546Sopenharmony_ciparser.add_argument("--verbose", "-v", action="count", default=0) 77bf215546Sopenharmony_ciparser.add_argument( 78bf215546Sopenharmony_ci "--include-tests", 79bf215546Sopenharmony_ci "-t", 80bf215546Sopenharmony_ci action="append", 81bf215546Sopenharmony_ci dest="include_tests", 82bf215546Sopenharmony_ci default=[], 83bf215546Sopenharmony_ci help="Only run the test matching this expression. This can only be a filename containing a list of failing tests to re-run.", 84bf215546Sopenharmony_ci) 85bf215546Sopenharmony_ciparser.add_argument( 86bf215546Sopenharmony_ci "--baseline", 87bf215546Sopenharmony_ci dest="baseline", 88bf215546Sopenharmony_ci help="Folder containing expected results files", 89bf215546Sopenharmony_ci default=os.path.dirname(__file__), 90bf215546Sopenharmony_ci) 91bf215546Sopenharmony_ciparser.add_argument( 92bf215546Sopenharmony_ci "--no-piglit", dest="piglit", help="Disable piglit tests", action="store_false" 93bf215546Sopenharmony_ci) 94bf215546Sopenharmony_ciparser.add_argument( 95bf215546Sopenharmony_ci "--no-glcts", dest="glcts", help="Disable GLCTS tests", action="store_false" 96bf215546Sopenharmony_ci) 97bf215546Sopenharmony_ciparser.add_argument( 98bf215546Sopenharmony_ci "--no-deqp", dest="deqp", help="Disable dEQP tests", action="store_false" 99bf215546Sopenharmony_ci) 100bf215546Sopenharmony_ciparser.add_argument( 101bf215546Sopenharmony_ci "--slow", dest="slow", help="Include slowest glcts tests", action="store_true" 102bf215546Sopenharmony_ci) 103bf215546Sopenharmony_ciparser.add_argument( 104bf215546Sopenharmony_ci "--no-deqp-egl", 105bf215546Sopenharmony_ci dest="deqp_egl", 106bf215546Sopenharmony_ci help="Disable dEQP-EGL tests", 107bf215546Sopenharmony_ci action="store_false", 108bf215546Sopenharmony_ci) 109bf215546Sopenharmony_ciparser.add_argument( 110bf215546Sopenharmony_ci "--no-deqp-gles2", 111bf215546Sopenharmony_ci dest="deqp_gles2", 112bf215546Sopenharmony_ci help="Disable dEQP-gles2 tests", 113bf215546Sopenharmony_ci action="store_false", 114bf215546Sopenharmony_ci) 115bf215546Sopenharmony_ciparser.add_argument( 116bf215546Sopenharmony_ci "--no-deqp-gles3", 117bf215546Sopenharmony_ci dest="deqp_gles3", 118bf215546Sopenharmony_ci help="Disable dEQP-gles3 tests", 119bf215546Sopenharmony_ci action="store_false", 120bf215546Sopenharmony_ci) 121bf215546Sopenharmony_ciparser.add_argument( 122bf215546Sopenharmony_ci "--no-deqp-gles31", 123bf215546Sopenharmony_ci dest="deqp_gles31", 124bf215546Sopenharmony_ci help="Disable dEQP-gles31 tests", 125bf215546Sopenharmony_ci action="store_false", 126bf215546Sopenharmony_ci) 127bf215546Sopenharmony_ciparser.set_defaults(piglit=True) 128bf215546Sopenharmony_ciparser.set_defaults(glcts=True) 129bf215546Sopenharmony_ciparser.set_defaults(deqp=True) 130bf215546Sopenharmony_ciparser.set_defaults(deqp_egl=True) 131bf215546Sopenharmony_ciparser.set_defaults(deqp_gles2=True) 132bf215546Sopenharmony_ciparser.set_defaults(deqp_gles3=True) 133bf215546Sopenharmony_ciparser.set_defaults(deqp_gles31=True) 134bf215546Sopenharmony_ciparser.set_defaults(slow=False) 135bf215546Sopenharmony_ci 136bf215546Sopenharmony_ciparser.add_argument( 137bf215546Sopenharmony_ci "output_folder", 138bf215546Sopenharmony_ci nargs="?", 139bf215546Sopenharmony_ci help="Output folder (logs, etc)", 140bf215546Sopenharmony_ci default=os.path.join( 141bf215546Sopenharmony_ci tempfile.gettempdir(), datetime.now().strftime("%Y-%m-%d-%H-%M-%S") 142bf215546Sopenharmony_ci ), 143bf215546Sopenharmony_ci) 144bf215546Sopenharmony_ci 145bf215546Sopenharmony_ciavailable_gpus = [] 146bf215546Sopenharmony_cifor f in os.listdir("/dev/dri/by-path"): 147bf215546Sopenharmony_ci idx = f.find("-render") 148bf215546Sopenharmony_ci if idx < 0: 149bf215546Sopenharmony_ci continue 150bf215546Sopenharmony_ci # gbm name is the full path, but DRI_PRIME expects a different 151bf215546Sopenharmony_ci # format 152bf215546Sopenharmony_ci available_gpus += [ 153bf215546Sopenharmony_ci ( 154bf215546Sopenharmony_ci os.path.join("/dev/dri/by-path", f), 155bf215546Sopenharmony_ci f[:idx].replace(":", "_").replace(".", "_"), 156bf215546Sopenharmony_ci ) 157bf215546Sopenharmony_ci ] 158bf215546Sopenharmony_ci 159bf215546Sopenharmony_ciparser.add_argument( 160bf215546Sopenharmony_ci "--gpu", 161bf215546Sopenharmony_ci type=int, 162bf215546Sopenharmony_ci dest="gpu", 163bf215546Sopenharmony_ci default=0, 164bf215546Sopenharmony_ci help="Select GPU (0..{})".format(len(available_gpus) - 1), 165bf215546Sopenharmony_ci) 166bf215546Sopenharmony_ci 167bf215546Sopenharmony_ciargs = parser.parse_args(sys.argv[1:]) 168bf215546Sopenharmony_cipiglit_path = args.piglit_path 169bf215546Sopenharmony_ciglcts_path = args.glcts_path 170bf215546Sopenharmony_cideqp_path = args.deqp_path 171bf215546Sopenharmony_ci 172bf215546Sopenharmony_ciif args.parent_path: 173bf215546Sopenharmony_ci if args.piglit_path or args.glcts_path or args.deqp_path: 174bf215546Sopenharmony_ci parser.print_help() 175bf215546Sopenharmony_ci sys.exit(0) 176bf215546Sopenharmony_ci piglit_path = os.path.join(args.parent_path, "piglit") 177bf215546Sopenharmony_ci glcts_path = os.path.join(args.parent_path, "glcts") 178bf215546Sopenharmony_ci deqp_path = os.path.join(args.parent_path, "deqp") 179bf215546Sopenharmony_cielse: 180bf215546Sopenharmony_ci if not args.piglit_path or not args.glcts_path or not args.deqp_path: 181bf215546Sopenharmony_ci parser.print_help() 182bf215546Sopenharmony_ci sys.exit(0) 183bf215546Sopenharmony_ci 184bf215546Sopenharmony_cibase = args.baseline 185bf215546Sopenharmony_ciskips = os.path.join(os.path.dirname(__file__), "skips.csv") 186bf215546Sopenharmony_ci 187bf215546Sopenharmony_cienv = os.environ.copy() 188bf215546Sopenharmony_ci 189bf215546Sopenharmony_ciif "DISPLAY" not in env: 190bf215546Sopenharmony_ci print_red("DISPLAY environment variable missing.") 191bf215546Sopenharmony_ci sys.exit(1) 192bf215546Sopenharmony_cip = subprocess.run( 193bf215546Sopenharmony_ci ["deqp-runner", "--version"], capture_output="True", check=True, env=env 194bf215546Sopenharmony_ci) 195bf215546Sopenharmony_cifor line in p.stdout.decode().split("\n"): 196bf215546Sopenharmony_ci if line.find("deqp-runner") >= 0: 197bf215546Sopenharmony_ci s = line.split(" ")[1].split(".") 198bf215546Sopenharmony_ci if args.verbose > 1: 199bf215546Sopenharmony_ci print("Checking deqp-version ({})".format(s)) 200bf215546Sopenharmony_ci # We want at least 0.9.0 201bf215546Sopenharmony_ci if not (int(s[0]) > 0 or int(s[1]) >= 9): 202bf215546Sopenharmony_ci print("Expecting deqp-runner 0.9.0+ version (got {})".format(".".join(s))) 203bf215546Sopenharmony_ci sys.exit(1) 204bf215546Sopenharmony_ci 205bf215546Sopenharmony_cienv["PIGLIT_PLATFORM"] = "gbm" 206bf215546Sopenharmony_ci 207bf215546Sopenharmony_ciif "DRI_PRIME" in env: 208bf215546Sopenharmony_ci print("Don't use DRI_PRIME. Instead use --gpu N") 209bf215546Sopenharmony_ci del env["DRI_PRIME"] 210bf215546Sopenharmony_ci 211bf215546Sopenharmony_ciassert "gpu" in args, "--gpu defaults to 0" 212bf215546Sopenharmony_ci 213bf215546Sopenharmony_cigpu_device = available_gpus[args.gpu][1] 214bf215546Sopenharmony_cienv["DRI_PRIME"] = gpu_device 215bf215546Sopenharmony_cienv["WAFFLE_GBM_DEVICE"] = available_gpus[args.gpu][0] 216bf215546Sopenharmony_ci 217bf215546Sopenharmony_ci# Use piglit's glinfo to determine the GPU name 218bf215546Sopenharmony_cigpu_name = "unknown" 219bf215546Sopenharmony_cigpu_name_full = "" 220bf215546Sopenharmony_cigfx_level = -1 221bf215546Sopenharmony_ci 222bf215546Sopenharmony_cienv["AMD_DEBUG"] = "info" 223bf215546Sopenharmony_cip = subprocess.run( 224bf215546Sopenharmony_ci ["./glinfo"], 225bf215546Sopenharmony_ci capture_output="True", 226bf215546Sopenharmony_ci cwd=os.path.join(piglit_path, "bin"), 227bf215546Sopenharmony_ci check=True, 228bf215546Sopenharmony_ci env=env, 229bf215546Sopenharmony_ci) 230bf215546Sopenharmony_cidel env["AMD_DEBUG"] 231bf215546Sopenharmony_cifor line in p.stdout.decode().split("\n"): 232bf215546Sopenharmony_ci if "GL_RENDER" in line: 233bf215546Sopenharmony_ci line = line.split("=")[1] 234bf215546Sopenharmony_ci gpu_name_full = "(".join(line.split("(")[:-1]).strip() 235bf215546Sopenharmony_ci gpu_name = line.replace("(TM)", "").split("(")[1].split(",")[0].lower() 236bf215546Sopenharmony_ci break 237bf215546Sopenharmony_ci elif "gfx_level" in line: 238bf215546Sopenharmony_ci gfx_level = int(line.split("=")[1]) 239bf215546Sopenharmony_ci 240bf215546Sopenharmony_cioutput_folder = args.output_folder 241bf215546Sopenharmony_ciprint_green("Tested GPU: '{}' ({}) {}".format(gpu_name_full, gpu_name, gpu_device)) 242bf215546Sopenharmony_ciprint_green("Output folder: '{}'".format(output_folder)) 243bf215546Sopenharmony_ci 244bf215546Sopenharmony_cicount = 1 245bf215546Sopenharmony_ciwhile os.path.exists(output_folder): 246bf215546Sopenharmony_ci output_folder = "{}.{}".format(os.path.abspath(args.output_folder), count) 247bf215546Sopenharmony_ci count += 1 248bf215546Sopenharmony_ci 249bf215546Sopenharmony_cios.mkdir(output_folder) 250bf215546Sopenharmony_cinew_baseline_folder = os.path.join(output_folder, "new_baseline") 251bf215546Sopenharmony_cios.mkdir(new_baseline_folder) 252bf215546Sopenharmony_ci 253bf215546Sopenharmony_cilogfile = open(os.path.join(output_folder, "{}-run-tests.log".format(gpu_name)), "w") 254bf215546Sopenharmony_ci 255bf215546Sopenharmony_cispin = itertools.cycle("-\\|/") 256bf215546Sopenharmony_ci 257bf215546Sopenharmony_cishutil.copy(skips, output_folder) 258bf215546Sopenharmony_ciskips = os.path.join(output_folder, "skips.csv") 259bf215546Sopenharmony_ciif not args.slow: 260bf215546Sopenharmony_ci # Exclude these 3 tests slow tests 261bf215546Sopenharmony_ci with open(skips, "a") as f: 262bf215546Sopenharmony_ci print("KHR-GL46.copy_image.functional", file=f) 263bf215546Sopenharmony_ci print("KHR-GL46.texture_swizzle.smoke", file=f) 264bf215546Sopenharmony_ci print( 265bf215546Sopenharmony_ci "KHR-GL46.tessellation_shader.tessellation_control_to_tessellation_evaluation.gl_MaxPatchVertices_Position_PointSize", 266bf215546Sopenharmony_ci file=f, 267bf215546Sopenharmony_ci ) 268bf215546Sopenharmony_ci 269bf215546Sopenharmony_ci 270bf215546Sopenharmony_cidef gfx_level_to_str(cl): 271bf215546Sopenharmony_ci supported = ["gfx6", "gfx7", "gfx8", "gfx9", "gfx10", "gfx10_3", "gfx11"] 272bf215546Sopenharmony_ci if 8 <= cl and cl < 8 + len(supported): 273bf215546Sopenharmony_ci return supported[cl - 8] 274bf215546Sopenharmony_ci return supported[-1] 275bf215546Sopenharmony_ci 276bf215546Sopenharmony_ci 277bf215546Sopenharmony_cidef run_cmd(args, verbosity): 278bf215546Sopenharmony_ci if verbosity > 1: 279bf215546Sopenharmony_ci print_yellow( 280bf215546Sopenharmony_ci "| Command line argument '" 281bf215546Sopenharmony_ci + " ".join(['"{}"'.format(a) for a in args]) 282bf215546Sopenharmony_ci + "'" 283bf215546Sopenharmony_ci ) 284bf215546Sopenharmony_ci start = datetime.now() 285bf215546Sopenharmony_ci proc = subprocess.Popen( 286bf215546Sopenharmony_ci args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env 287bf215546Sopenharmony_ci ) 288bf215546Sopenharmony_ci while True: 289bf215546Sopenharmony_ci line = proc.stdout.readline().decode() 290bf215546Sopenharmony_ci if verbosity > 0: 291bf215546Sopenharmony_ci if "ERROR" in line: 292bf215546Sopenharmony_ci print_red(line.strip(), prefix="| ") 293bf215546Sopenharmony_ci else: 294bf215546Sopenharmony_ci print("| " + line.strip()) 295bf215546Sopenharmony_ci else: 296bf215546Sopenharmony_ci sys.stdout.write(next(spin)) 297bf215546Sopenharmony_ci sys.stdout.flush() 298bf215546Sopenharmony_ci sys.stdout.write("\b") 299bf215546Sopenharmony_ci 300bf215546Sopenharmony_ci logfile.write(line) 301bf215546Sopenharmony_ci 302bf215546Sopenharmony_ci if proc.poll() is not None: 303bf215546Sopenharmony_ci break 304bf215546Sopenharmony_ci proc.wait() 305bf215546Sopenharmony_ci end = datetime.now() 306bf215546Sopenharmony_ci 307bf215546Sopenharmony_ci if verbosity == 0: 308bf215546Sopenharmony_ci sys.stdout.write(" ... ") 309bf215546Sopenharmony_ci 310bf215546Sopenharmony_ci print_yellow( 311bf215546Sopenharmony_ci "Completed in {} seconds".format(int((end - start).total_seconds())), 312bf215546Sopenharmony_ci prefix="└ " if verbosity > 0 else None, 313bf215546Sopenharmony_ci ) 314bf215546Sopenharmony_ci 315bf215546Sopenharmony_ci 316bf215546Sopenharmony_cidef verify_results(results): 317bf215546Sopenharmony_ci with open(results) as file: 318bf215546Sopenharmony_ci if len(file.readlines()) == 0: 319bf215546Sopenharmony_ci return True 320bf215546Sopenharmony_ci print_red("New results (fails or pass). Check {}".format(results)) 321bf215546Sopenharmony_ci return False 322bf215546Sopenharmony_ci 323bf215546Sopenharmony_ci 324bf215546Sopenharmony_cidef parse_test_filters(include_tests): 325bf215546Sopenharmony_ci cmd = [] 326bf215546Sopenharmony_ci for t in include_tests: 327bf215546Sopenharmony_ci if os.path.exists(t): 328bf215546Sopenharmony_ci with open(t, "r") as file: 329bf215546Sopenharmony_ci for row in csv.reader(file, delimiter=","): 330bf215546Sopenharmony_ci if not row or row[0][0] == "#": 331bf215546Sopenharmony_ci continue 332bf215546Sopenharmony_ci print(row) 333bf215546Sopenharmony_ci cmd += ["-t", row[0]] 334bf215546Sopenharmony_ci else: 335bf215546Sopenharmony_ci cmd += ["-t", t] 336bf215546Sopenharmony_ci return cmd 337bf215546Sopenharmony_ci 338bf215546Sopenharmony_ci 339bf215546Sopenharmony_cidef select_baseline(basepath, gfx_level, gpu_name): 340bf215546Sopenharmony_ci gfx_level_str = gfx_level_to_str(gfx_level) 341bf215546Sopenharmony_ci 342bf215546Sopenharmony_ci # select the best baseline we can find 343bf215546Sopenharmony_ci # 1. exact match 344bf215546Sopenharmony_ci exact = os.path.join(base, "{}-{}-fail.csv".format(gfx_level_str, gpu_name)) 345bf215546Sopenharmony_ci if os.path.exists(exact): 346bf215546Sopenharmony_ci return exact 347bf215546Sopenharmony_ci # 2. any baseline with the same gfx_level 348bf215546Sopenharmony_ci while gfx_level >= 8: 349bf215546Sopenharmony_ci for subdir, dirs, files in os.walk(basepath): 350bf215546Sopenharmony_ci for file in files: 351bf215546Sopenharmony_ci if file.find(gfx_level_str) == 0 and file.endswith("-fail.csv"): 352bf215546Sopenharmony_ci return os.path.join(base, file) 353bf215546Sopenharmony_ci # No match. Try an earlier class 354bf215546Sopenharmony_ci gfx_level = gfx_level - 1 355bf215546Sopenharmony_ci gfx_level_str = gfx_level_to_str(gfx_level) 356bf215546Sopenharmony_ci 357bf215546Sopenharmony_ci return exact 358bf215546Sopenharmony_ci 359bf215546Sopenharmony_ci 360bf215546Sopenharmony_cifilters_args = parse_test_filters(args.include_tests) 361bf215546Sopenharmony_cibaseline = select_baseline(base, gfx_level, gpu_name) 362bf215546Sopenharmony_ciflakes = os.path.join( 363bf215546Sopenharmony_ci base, "{}-{}-flakes.csv".format(gfx_level_to_str(gfx_level), gpu_name) 364bf215546Sopenharmony_ci) 365bf215546Sopenharmony_ci 366bf215546Sopenharmony_ciif os.path.exists(baseline): 367bf215546Sopenharmony_ci print_yellow("Baseline: {}\n".format(baseline), args.verbose > 0) 368bf215546Sopenharmony_ciif os.path.exists(flakes): 369bf215546Sopenharmony_ci print_yellow("[flakes {}]\n".format(flakes), args.verbose > 0) 370bf215546Sopenharmony_ci 371bf215546Sopenharmony_ci# piglit test 372bf215546Sopenharmony_ciif args.piglit: 373bf215546Sopenharmony_ci out = os.path.join(output_folder, "piglit") 374bf215546Sopenharmony_ci new_baseline = os.path.join( 375bf215546Sopenharmony_ci new_baseline_folder, "{}-piglit-quick-fail.csv".format(gpu_name) 376bf215546Sopenharmony_ci ) 377bf215546Sopenharmony_ci print_yellow("Running piglit tests\n", args.verbose > 0) 378bf215546Sopenharmony_ci cmd = [ 379bf215546Sopenharmony_ci "piglit-runner", 380bf215546Sopenharmony_ci "run", 381bf215546Sopenharmony_ci "--piglit-folder", 382bf215546Sopenharmony_ci piglit_path, 383bf215546Sopenharmony_ci "--profile", 384bf215546Sopenharmony_ci "quick", 385bf215546Sopenharmony_ci "--output", 386bf215546Sopenharmony_ci out, 387bf215546Sopenharmony_ci "--process-isolation", 388bf215546Sopenharmony_ci "--timeout", 389bf215546Sopenharmony_ci "300", 390bf215546Sopenharmony_ci "--jobs", 391bf215546Sopenharmony_ci str(args.jobs), 392bf215546Sopenharmony_ci "--skips", 393bf215546Sopenharmony_ci skips, 394bf215546Sopenharmony_ci ] + filters_args 395bf215546Sopenharmony_ci 396bf215546Sopenharmony_ci if os.path.exists(baseline): 397bf215546Sopenharmony_ci cmd += ["--baseline", baseline] 398bf215546Sopenharmony_ci 399bf215546Sopenharmony_ci if os.path.exists(flakes): 400bf215546Sopenharmony_ci cmd += ["--flakes", flakes] 401bf215546Sopenharmony_ci 402bf215546Sopenharmony_ci run_cmd(cmd, args.verbose) 403bf215546Sopenharmony_ci shutil.copy(os.path.join(out, "failures.csv"), new_baseline) 404bf215546Sopenharmony_ci verify_results(new_baseline) 405bf215546Sopenharmony_ci 406bf215546Sopenharmony_cideqp_args = "-- --deqp-surface-width=256 --deqp-surface-height=256 --deqp-gl-config-name=rgba8888d24s8ms0 --deqp-visibility=hidden".split( 407bf215546Sopenharmony_ci " " 408bf215546Sopenharmony_ci) 409bf215546Sopenharmony_ci 410bf215546Sopenharmony_ci# glcts test 411bf215546Sopenharmony_ciif args.glcts: 412bf215546Sopenharmony_ci out = os.path.join(output_folder, "glcts") 413bf215546Sopenharmony_ci new_baseline = os.path.join( 414bf215546Sopenharmony_ci new_baseline_folder, "{}-glcts-fail.csv".format(gpu_name) 415bf215546Sopenharmony_ci ) 416bf215546Sopenharmony_ci print_yellow("Running GLCTS tests", args.verbose > 0) 417bf215546Sopenharmony_ci os.mkdir(os.path.join(output_folder, "glcts")) 418bf215546Sopenharmony_ci 419bf215546Sopenharmony_ci cmd = [ 420bf215546Sopenharmony_ci "deqp-runner", 421bf215546Sopenharmony_ci "run", 422bf215546Sopenharmony_ci "--tests-per-group", 423bf215546Sopenharmony_ci "100", 424bf215546Sopenharmony_ci "--deqp", 425bf215546Sopenharmony_ci "{}/external/openglcts/modules/glcts".format(glcts_path), 426bf215546Sopenharmony_ci "--caselist", 427bf215546Sopenharmony_ci "{}/external/openglcts/modules/gl_cts/data/mustpass/gl/khronos_mustpass/4.6.1.x/gl46-master.txt".format( 428bf215546Sopenharmony_ci glcts_path 429bf215546Sopenharmony_ci ), 430bf215546Sopenharmony_ci "--output", 431bf215546Sopenharmony_ci out, 432bf215546Sopenharmony_ci "--skips", 433bf215546Sopenharmony_ci skips, 434bf215546Sopenharmony_ci "--jobs", 435bf215546Sopenharmony_ci str(args.jobs), 436bf215546Sopenharmony_ci "--timeout", 437bf215546Sopenharmony_ci "1000", 438bf215546Sopenharmony_ci ] + filters_args 439bf215546Sopenharmony_ci 440bf215546Sopenharmony_ci if os.path.exists(baseline): 441bf215546Sopenharmony_ci cmd += ["--baseline", baseline] 442bf215546Sopenharmony_ci cmd += deqp_args 443bf215546Sopenharmony_ci run_cmd(cmd, args.verbose) 444bf215546Sopenharmony_ci shutil.copy(os.path.join(out, "failures.csv"), new_baseline) 445bf215546Sopenharmony_ci verify_results(new_baseline) 446bf215546Sopenharmony_ci 447bf215546Sopenharmony_ciif args.deqp: 448bf215546Sopenharmony_ci print_yellow("Running dEQP tests", args.verbose > 0) 449bf215546Sopenharmony_ci 450bf215546Sopenharmony_ci # Generate a test-suite file 451bf215546Sopenharmony_ci out = os.path.join(output_folder, "deqp") 452bf215546Sopenharmony_ci suite_filename = os.path.join(output_folder, "deqp-suite.toml") 453bf215546Sopenharmony_ci suite = open(suite_filename, "w") 454bf215546Sopenharmony_ci os.mkdir(out) 455bf215546Sopenharmony_ci new_baseline = os.path.join( 456bf215546Sopenharmony_ci new_baseline_folder, "{}-deqp-fail.csv".format(gpu_name) 457bf215546Sopenharmony_ci ) 458bf215546Sopenharmony_ci 459bf215546Sopenharmony_ci deqp_tests = { 460bf215546Sopenharmony_ci "egl": args.deqp_egl, 461bf215546Sopenharmony_ci "gles2": args.deqp_gles2, 462bf215546Sopenharmony_ci "gles3": args.deqp_gles3, 463bf215546Sopenharmony_ci "gles31": args.deqp_gles31, 464bf215546Sopenharmony_ci } 465bf215546Sopenharmony_ci 466bf215546Sopenharmony_ci for k in deqp_tests: 467bf215546Sopenharmony_ci if not deqp_tests[k]: 468bf215546Sopenharmony_ci continue 469bf215546Sopenharmony_ci 470bf215546Sopenharmony_ci suite.write("[[deqp]]\n") 471bf215546Sopenharmony_ci suite.write( 472bf215546Sopenharmony_ci 'deqp = "{}"\n'.format( 473bf215546Sopenharmony_ci "{}/modules/{subtest}/deqp-{subtest}".format(deqp_path, subtest=k) 474bf215546Sopenharmony_ci ) 475bf215546Sopenharmony_ci ) 476bf215546Sopenharmony_ci suite.write( 477bf215546Sopenharmony_ci 'caselists = ["{}"]\n'.format( 478bf215546Sopenharmony_ci "{}/android/cts/master/{}-master.txt".format(deqp_path, k) 479bf215546Sopenharmony_ci ) 480bf215546Sopenharmony_ci ) 481bf215546Sopenharmony_ci if os.path.exists(baseline): 482bf215546Sopenharmony_ci suite.write('baseline = "{}"\n'.format(baseline)) 483bf215546Sopenharmony_ci suite.write('skips = ["{}"]\n'.format(skips)) 484bf215546Sopenharmony_ci suite.write("deqp_args = [\n") 485bf215546Sopenharmony_ci for a in deqp_args[1:-1]: 486bf215546Sopenharmony_ci suite.write(' "{}",\n'.format(a)) 487bf215546Sopenharmony_ci suite.write(' "{}"\n'.format(deqp_args[-1])) 488bf215546Sopenharmony_ci suite.write("]\n") 489bf215546Sopenharmony_ci 490bf215546Sopenharmony_ci suite.close() 491bf215546Sopenharmony_ci 492bf215546Sopenharmony_ci cmd = [ 493bf215546Sopenharmony_ci "deqp-runner", 494bf215546Sopenharmony_ci "suite", 495bf215546Sopenharmony_ci "--jobs", 496bf215546Sopenharmony_ci str(args.jobs), 497bf215546Sopenharmony_ci "--output", 498bf215546Sopenharmony_ci os.path.join(output_folder, "deqp"), 499bf215546Sopenharmony_ci "--suite", 500bf215546Sopenharmony_ci suite_filename, 501bf215546Sopenharmony_ci ] + filters_args 502bf215546Sopenharmony_ci run_cmd(cmd, args.verbose) 503bf215546Sopenharmony_ci shutil.copy(os.path.join(out, "failures.csv"), new_baseline) 504bf215546Sopenharmony_ci verify_results(new_baseline) 505