blob: f241eb6fc7d8fb454fc17e3a132a6ede39dd5cc0 [file] [log] [blame]
# 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 = [
{
source = rebase_path("../external/vulkancts/mustpass/master/vk-default.txt")
dest = "data/vk-default.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(' source = rebase_path("%s")\n' % file)
out_file.write(' dest = "data/%s"\n' % "/".join(file_split))
out_file.write(" },\n")
out_file.write("]\n")
out_file.close()
cts_version = "master"
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/components/fuchsia_test_package.gni")
import("//src/graphics/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)
component_list = []
component_name_list = []
for chunk_num in range(len(cts_chunks)):
component_name = "vulkan-cts-%03d" % chunk_num
out_file.write(
"""
resource("%s-data") {
sources = [ "data/vulkan-%03d.txt" ]
outputs = [ "data/vk-list-%03d.txt" ]
}
fuchsia_component("%s") {
testonly = true
manifest = "meta/%s.cmx"
deps = [
":%s-data",
"..:cts-deps",
]
}
""" % (
component_name, chunk_num, chunk_num, component_name,
component_name, component_name))
component_name_list.append('":' + component_name + '"')
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-archive-dir=/pkg/data",
"--deqp-log-images=disable",
"--deqp-log-shader-sources=disable",
"--deqp-log-filename=/data/TestResults.qpa",
"--deqp-log-flush=disable",
"--deqp-shadercache-filename=/data/shadercache.bin"
],
"binary": "test/vulkan-cts"
},
"sandbox": {
"dev": [
"class/framebuffer"
],
"features": [
"isolated-persistent-storage",
"vulkan"
],
"services": [
"fuchsia.logger.LogSink",
"fuchsia.sysmem.Allocator",
"fuchsia.tracing.provider.Registry",
"fuchsia.vulkan.loader.Loader"
]
}
}
""" % (current_index))
combined_component_list = "".join(
" " + x + ",\n" for x in component_name_list)
out_file.write(
"""
fuchsia_test_package("vulkan-cts-split") {
test_components = [
%s ]
test_specs = {
environments = labeled_magma_hardware_envs
}
}
group("split-cts") {
testonly = true
deps = [ ":vulkan-cts-split" ]
}
""" % (combined_component_list))
out_file.close()