1
Fork 0

rules/ remove run_under

rules/ were never meant to be added to the release. Now that we are not
*running* multi-arch binaries, we can remove the infrastructure that was
necessary to do so.

I may get back to this -- but we need to dust quite a bit off before
that happens.
main
Motiejus Jakštys 2023-03-21 10:13:57 +02:00 committed by Motiejus Jakštys
parent 9779650a78
commit 3630f62053
3 changed files with 13 additions and 37 deletions

View File

@ -17,7 +17,7 @@ tools/bazel build "$@" \
--experimental_use_hermetic_linux_sandbox \
--sandbox_writable_path="$cache_prefix" \
--sandbox_add_mount_pair=/proc \
//test/c:which_libc_linux_amd64_gnu.2.19
//test/c:which_libc
# then test everything else with the standard sandbox
echo "--- bazel test $* ..."

View File

@ -1,12 +1,7 @@
# Copyright 2023 Uber Technologies, Inc.
# Licensed under the MIT License
def _vars_script(env, run_under, cmd):
ret = ["#!/bin/sh"]
for k, v in env.items():
ret += ['export {}="{}"'.format(k, v)]
ret += ['exec {} {} "$@"'.format(run_under, cmd)]
return "\n".join(ret) + "\n" # trailing newline is easier on the eyes
load("@bazel_skylib//lib:paths.bzl", "paths")
def _platform_transition_impl(settings, attr):
_ignore = settings
@ -23,22 +18,18 @@ _platform_transition = transition(
)
def _platform_binary_impl(ctx):
source_info = ctx.attr.src[DefaultInfo]
executable = None
if source_info.files_to_run and source_info.files_to_run.executable:
command = _vars_script(ctx.attr.env, ctx.attr.run_under, source_info.files_to_run.executable.short_path)
executable = ctx.actions.declare_file("{}_{}".format(ctx.file.src.basename, ctx.attr.platform))
ctx.actions.write(
output = executable,
content = command,
is_executable = True,
)
platform_sanitized = ctx.attr.platform.replace("/", "_").replace(":", "_")
dst = ctx.actions.declare_file("{}-{}".format(paths.basename(ctx.file.src.path), platform_sanitized))
src = ctx.file.src
ctx.actions.run_shell(
outputs = [dst],
inputs = [src],
command = "cp $1 $2",
arguments = [src.path, dst.path],
)
return [DefaultInfo(
executable = executable,
files = depset([executable]),
runfiles = ctx.runfiles(files = ctx.files.src),
files = depset([dst]),
executable = dst,
)]
_attrs = {
@ -50,12 +41,6 @@ _attrs = {
"platform": attr.string(
doc = "The platform to build the target for.",
),
"run_under": attr.string(
doc = "wrapper executable",
),
"env": attr.string_dict(
doc = "Environment variables for the test",
),
"_allowlist_function_transition": attr.label(
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
),

View File

@ -9,15 +9,6 @@ cc_binary(
tags = ["manual"],
)
# TODO(motiejus): bring back windows tests, not only builds
#platform_test(
# name = "winver_windows_amd64",
# src = "winver",
# platform = "//platform:windows_amd64",
# run_under = "wine64-stable",
# tags = ["no-sandbox"],
#)
platform_binary(
name = "winver_windows_amd64",
src = "winver",