| # Copyright 2018 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import os |
| import glob |
| import subprocess |
| |
| out_file = open("resources.gni", "w") |
| |
| out_file.write("""\ |
| ### NOTE: This file auto-generated from gen.py |
| |
| cts_resources = [ |
| { |
| path=rebase_path("../external/vulkancts/mustpass/1.1.4/vk-default.txt") |
| dest="vk-default-1.1.4.txt" |
| }, |
| { |
| path=rebase_path("../external/vulkancts/mustpass/1.1.3/vk-default.txt") |
| dest="vk-default-1.1.3.txt" |
| }, |
| { |
| path=rebase_path("../external/vulkancts/mustpass/1.1.2/vk-default.txt") |
| dest="vk-default-1.1.2.txt" |
| }, |
| { |
| path=rebase_path("../external/vulkancts/mustpass/1.0.2/vk-default.txt") |
| dest="vk-default-1.0.2.txt" |
| }, |
| """) |
| |
| files = subprocess.check_output( |
| ["find", "../external/vulkancts/data/vulkan", "-type", "f"]) |
| file_lines = files.splitlines() |
| |
| for file in sorted(file_lines): |
| file_split = file.split("/") |
| file_split = file_split[4:] |
| out_file.write(" {\n") |
| out_file.write(' path=rebase_path("%s")\n' % file) |
| out_file.write(' dest="%s"\n' % "/".join(file_split)) |
| out_file.write(" },\n") |
| |
| out_file.write(" ]\n") |
| out_file.close() |
| |
| cts_version = "1.1.4" |
| dirs_to_delete = ["data", "meta"] |
| for dir_delete in dirs_to_delete: |
| assert (os.path.isdir(os.path.join("split-cts", dir_delete))) |
| |
| for f in glob.glob("split-cts/meta/*.cmx"): |
| os.remove(f) |
| |
| for f in glob.glob("split-cts/data/*.txt"): |
| os.remove(f) |
| |
| out_file = open("split-cts/BUILD.gn", "w") |
| |
| out_file.write("""# Copyright 2019 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| # File generated by ../gen.py - do not modify. |
| |
| import("//build/package.gni") |
| import("//garnet/lib/magma/gnbuild/magma.gni") |
| import("../resources.gni") |
| |
| # Add a label of "vulkan-cts" for each environment given in the list |
| # of general hardware environments for magma tests. The label ensures |
| # that the Vulkan CTS will not be run in the general test pipeline; |
| # the label will be keyed on so that the suite may be run in a special |
| # builder. |
| labeled_magma_hardware_envs = [] |
| foreach(env, magma_hardware_envs) { |
| labeled_env = { |
| } # Clear from previous iteration. |
| labeled_env = { |
| forward_variables_from(env, "*") |
| if (defined(tags)) { |
| tags += [ "vulkan-cts" ] |
| } else { |
| tags = [ "vulkan-cts" ] |
| } |
| } |
| labeled_magma_hardware_envs += [ labeled_env ] |
| } |
| """) |
| |
| cts_file_list = open( |
| "../external/vulkancts/mustpass/%s/vk-default.txt" % cts_version, |
| "r").read().split("\n") |
| |
| chunk_size = 1000 |
| cts_chunks = [] |
| while cts_file_list: |
| first_section = cts_file_list[:chunk_size] |
| cts_file_list = cts_file_list[chunk_size:] |
| cts_chunks.append(first_section) |
| |
| test_list = [] |
| meta_list = [] |
| resources_list = [] |
| for chunk_num in range(len(cts_chunks)): |
| test_list.append(""" |
| { |
| name = "vulkan-cts" |
| dest = "vulkan-cts-%03d" |
| environments = labeled_magma_hardware_envs |
| },""" % chunk_num) |
| |
| meta_list.append(""" |
| { |
| path = rebase_path("meta/vulkan-cts-%03d.cmx") |
| dest = "vulkan-cts-%03d.cmx" |
| },""" % (chunk_num, chunk_num)) |
| resources_list.append(""" |
| { |
| path = rebase_path("data/vulkan-%03d.txt") |
| dest = "vk-list-%03d.txt" |
| },""" % (chunk_num, chunk_num)) |
| |
| for current_index in range(len(cts_chunks)): |
| with open("split-cts/data/vulkan-%03d.txt" % current_index, "w") as f: |
| f.write("\n".join(cts_chunks[current_index])) |
| with open("split-cts/meta/vulkan-cts-%03d.cmx" % current_index, "w") as f: |
| f.write(""" |
| { |
| "facets": { |
| "fuchsia.test": { |
| "system-services": [ |
| "fuchsia.sysmem.Allocator", |
| "fuchsia.vulkan.loader.Loader" |
| ] |
| } |
| }, |
| "program": { |
| "args": [ |
| "--deqp-caselist-file=/pkg/data/vk-list-%03d.txt", |
| "--deqp-log-images=disable", |
| "--deqp-log-shader-sources=disable", |
| "--deqp-log-filename=/data/TestResults.qpa", |
| "--deqp-log-flush=disable" |
| ], |
| "binary": "test/vulkan-cts-%03d" |
| }, |
| "sandbox": { |
| "dev": [ |
| "class/framebuffer" |
| ], |
| "features": [ |
| "vulkan", |
| "isolated-persistent-storage", |
| "deprecated-ambient-replace-as-executable" |
| ], |
| "services": [ |
| "fuchsia.sysmem.Allocator", |
| "fuchsia.tracing.provider.Registry", |
| "fuchsia.logger.LogSink", |
| "fuchsia.vulkan.loader.Loader" |
| ] |
| } |
| } |
| """ % (current_index, current_index)) |
| |
| out_file.write(""" |
| package("vulkan-cts-split") { |
| deps = [ |
| "..:copy", |
| "..:vulkan_cts_build_id", |
| ] |
| tests = [%s |
| ] |
| meta = [%s |
| ] |
| resources = [%s |
| ] |
| resources += cts_resources |
| } |
| |
| group("split-cts") { |
| deps = [ |
| ":vulkan-cts-split", |
| ] |
| } |
| """ % ("".join(test_list), "".join(meta_list), "".join(resources_list))) |
| |
| out_file.close() |