diff --git a/elisp/BUILD b/elisp/BUILD index 51a96718..0951fc00 100644 --- a/elisp/BUILD +++ b/elisp/BUILD @@ -1,4 +1,4 @@ -# Copyright 2020, 2021 Google LLC +# Copyright 2020, 2021, 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -258,7 +258,7 @@ cc_test( data = [ "binary.cc", "binary.h", - ":test_wrap_launcher", + "//tests/wrap", ], features = LAUNCHER_FEATURES, linkopts = LINKOPTS, @@ -270,26 +270,6 @@ cc_test( ], ) -# I think this wrapper is only necessary because of the changes made in -# https://github.com/bazelbuild/bazel/commit/bfdfa6ebfd21b388f1c91f512291c848e1a92a96. -# See https://github.com/bazelbuild/bazel/issues/14500. -# TODO(phst): Remove this wrapper once -# https://github.com/bazelbuild/bazel/issues/14500 is fixed. -cc_binary( - name = "test_wrap_launcher", - testonly = 1, - srcs = ["test_wrap_launcher.cc"], - copts = LAUNCHER_COPTS, - data = ["//tests/wrap"], - features = LAUNCHER_FEATURES, - linkopts = LAUNCHER_LINKOPTS, - linkstatic = True, - deps = [ - ":platform", - ":process", - ], -) - py_binary( name = "run_binary", srcs = ["run_binary.py"], diff --git a/elisp/binary_test.cc b/elisp/binary_test.cc index 073b1105..03efec1b 100644 --- a/elisp/binary_test.cc +++ b/elisp/binary_test.cc @@ -1,4 +1,4 @@ -// Copyright 2020, 2021 Google LLC +// Copyright 2020, 2021, 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -30,8 +30,8 @@ using ::testing::Eq; TEST(Executor, RunBinaryWrap) { const absl::StatusOr runfiles = Runfiles::CreateForTest(); ASSERT_TRUE(runfiles.ok()) << runfiles.status(); - NativeString wrapper = PHST_RULES_ELISP_NATIVE_LITERAL( - "phst_rules_elisp/elisp/test_wrap_launcher"); + NativeString wrapper = + PHST_RULES_ELISP_NATIVE_LITERAL("phst_rules_elisp/tests/wrap/wrap"); #ifdef PHST_RULES_ELISP_WINDOWS wrapper += L".exe"; #endif diff --git a/elisp/test_wrap_launcher.cc b/elisp/test_wrap_launcher.cc deleted file mode 100644 index 0e4983ae..00000000 --- a/elisp/test_wrap_launcher.cc +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "elisp/platform.h" -#include "elisp/process.h" - -using phst_rules_elisp::NativeChar; -using phst_rules_elisp::NativeString; - -int PHST_RULES_ELISP_MAIN(int argc, NativeChar** argv) { - using phst_rules_elisp::Runfiles; - using phst_rules_elisp::Run; - if (argc < 1) { - std::cerr << "Too few command-line arguments" << std::endl; - return EXIT_FAILURE; - } - const absl::StatusOr runfiles = Runfiles::Create(argv[0]); - if (!runfiles.ok()) { - std::cerr << runfiles.status() << std::endl; - return EXIT_FAILURE; - } - std::string name = "phst_rules_elisp/tests/wrap/wrap"; -#ifdef PHST_RULES_ELISP_WINDOWS - name += ".exe"; -#endif - const absl::StatusOr program = runfiles->Resolve(name); - if (!program.ok()) { - std::cerr << runfiles.status() << std::endl; - return EXIT_FAILURE; - } - std::vector args = {*program}; - args.insert(args.end(), argv + 1, argv + argc); - const absl::StatusOr result = Run(args, *runfiles); - if (!result.ok()) { - std::cerr << result.status() << std::endl; - return EXIT_FAILURE; - } - return *result; -}