Fix tags used for determining file sets.

Updates #2569
Updates #2298

PiperOrigin-RevId: 310423629
This commit is contained in:
Adin Scannell 2020-05-07 13:17:33 -07:00 committed by gVisor bot
parent 28b5565fdd
commit 1f4087e7cd
1 changed files with 39 additions and 23 deletions

View File

@ -1,40 +1,56 @@
"""List of special Go suffixes."""
go_suffixes = [
def explode(tagset, suffixes):
"""explode combines tagset and suffixes in all ways.
Args:
tagset: Original suffixes.
suffixes: Suffixes to combine before and after.
Returns:
The set of possible combinations.
"""
result = [t for t in tagset]
result += [s for s in suffixes]
for t in tagset:
result += [t + s for s in suffixes]
result += [s + t for s in suffixes]
return result
archs = [
"_386",
"_386_unsafe",
"_aarch64",
"_aarch64_unsafe",
"_amd64",
"_amd64_unsafe",
"_arm",
"_arm64",
"_arm64_unsafe",
"_arm_unsafe",
"_impl",
"_impl_unsafe",
"_linux",
"_linux_unsafe",
"_mips",
"_mips64",
"_mips64_unsafe",
"_mips64le",
"_mips64le_unsafe",
"_mips_unsafe",
"_mipsle",
"_mipsle_unsafe",
"_opts",
"_opts_unsafe",
"_ppc64",
"_ppc64_unsafe",
"_ppc64le",
"_ppc64le_unsafe",
"_riscv64",
"_riscv64_unsafe",
"_s390x",
"_s390x_unsafe",
"_sparc64",
"_sparc64_unsafe",
"_wasm",
"_wasm_unsafe",
"_x86",
]
oses = [
"_linux",
]
generic = [
"_impl",
"_race",
"_norace",
"_unsafe",
"_opts",
]
# State explosion? Sure. This is approximately:
# len(archs) * (1 + 2 * len(oses) * (1 + 2 * len(generic))
#
# This evaluates to 495 at the time of writing. So it's a lot of different
# combinations, but not so much that it will cause issues. We can probably add
# quite a few more variants before this becomes a genuine problem.
go_suffixes = explode(explode(archs, oses), generic)