summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2021-09-13 15:31:52 -0700
committergVisor bot <gvisor-bot@google.com>2021-09-13 15:35:22 -0700
commit95fe4fea19f30281a3ff53f62c9fcda533c4e04a (patch)
tree3f2f1f5a70dc4d48d0a6190b97d6810479785cfb
parente07fd058ec474d801748a849d9c5d1c6118c3c11 (diff)
tools/show_paths.bzl: check that provider_map isn't None
Otherwise it can fail: $ bazel cquery pkg/p9/... --output=starlark --starlark:file=tools/show_paths.bzl ... ERROR: Starlark evaluation error for //pkg/p9/p9test:mockgen: Traceback (most recent call last): File "tools/show_paths.bzl", line 8, column 32, in format Error: 'NoneType' value has no field or method 'get' PiperOrigin-RevId: 396457764
-rw-r--r--.buildkite/pipeline.yaml5
-rw-r--r--test/util/BUILD1
-rw-r--r--test/util/benchmark_main.cc64
-rw-r--r--tools/bazel.mk4
-rw-r--r--tools/show_paths.bzl2
5 files changed, 9 insertions, 67 deletions
diff --git a/.buildkite/pipeline.yaml b/.buildkite/pipeline.yaml
index c1b478dc3..adff70fee 100644
--- a/.buildkite/pipeline.yaml
+++ b/.buildkite/pipeline.yaml
@@ -169,6 +169,11 @@ steps:
label: ":mechanical_arm: ARM"
command: make arm-qemu-smoke-test
+ # Build everything.
+ - <<: *common
+ label: ":world_map: Build everything"
+ command: "make build OPTIONS=--build_tag_filters=-nogo TARGETS=//..."
+
# Run basic benchmarks smoke tests (no upload).
- <<: *common
label: ":fire: Benchmarks smoke test"
diff --git a/test/util/BUILD b/test/util/BUILD
index 0c151c5a1..5b6bcb32c 100644
--- a/test/util/BUILD
+++ b/test/util/BUILD
@@ -352,7 +352,6 @@ cc_library(
cc_library(
name = "benchmark_main",
testonly = 1,
- srcs = ["benchmark_main.cc"],
linkstatic = 1,
deps = [
":test_util",
diff --git a/test/util/benchmark_main.cc b/test/util/benchmark_main.cc
deleted file mode 100644
index 2d4af6251..000000000
--- a/test/util/benchmark_main.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2018 The gVisor Authors.
-//
-// 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
-//
-// http://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 "gtest/gtest.h"
-#include "absl/flags/flag.h"
-#include "third_party/benchmark/src/commandlineflags.h"
-#include "test/util/test_util.h"
-
-DECLARE_bool(benchmark_list_internal);
-DECLARE_string(benchmark_filter_internal);
-ABSL_FLAG(bool, benchmark_enable_random_interleaving_internal, false,
- "forward");
-ABSL_FLAG(double, benchmark_min_time_internal, -1.0, "forward");
-ABSL_FLAG(int, benchmark_repetitions_internal, 1, "forward");
-
-// From //third_party/benchmark.
-//
-// These conflict with the internal definitions, but all the benchmark binaries
-// link against the external benchmark library for compatibility with the open
-// source build. We massage the internal-only flags into the external ones, and
-// call the function to actually run all registered external benchmarks.
-namespace benchmark {
-BM_DECLARE_bool(benchmark_list_tests);
-BM_DECLARE_string(benchmark_filter);
-BM_DECLARE_int32(benchmark_repetitions);
-BM_DECLARE_double(benchmark_min_time);
-BM_DECLARE_bool(benchmark_enable_random_interleaving);
-extern size_t RunSpecifiedBenchmarks();
-} // namespace benchmark
-
-using benchmark::FLAGS_benchmark_enable_random_interleaving;
-using benchmark::FLAGS_benchmark_filter;
-using benchmark::FLAGS_benchmark_list_tests;
-using benchmark::FLAGS_benchmark_min_time;
-using benchmark::FLAGS_benchmark_repetitions;
-
-int main(int argc, char** argv) {
- gvisor::testing::TestInit(&argc, &argv);
- absl::SetFlag(&FLAGS_benchmark_list_tests,
- absl::GetFlag(FLAGS_benchmark_list_internal));
- absl::SetFlag(&FLAGS_benchmark_filter,
- absl::GetFlag(FLAGS_benchmark_filter_internal));
- absl::SetFlag(&FLAGS_benchmark_repetitions,
- absl::GetFlag(FLAGS_benchmark_repetitions_internal));
- absl::SetFlag(
- &FLAGS_benchmark_enable_random_interleaving,
- absl::GetFlag(FLAGS_benchmark_enable_random_interleaving_internal));
- absl::SetFlag(&FLAGS_benchmark_min_time,
- absl::GetFlag(FLAGS_benchmark_min_time_internal));
-
- benchmark::RunSpecifiedBenchmarks();
- return 0;
-}
diff --git a/tools/bazel.mk b/tools/bazel.mk
index 4f979bbeb..1444423e4 100644
--- a/tools/bazel.mk
+++ b/tools/bazel.mk
@@ -186,8 +186,8 @@ build_paths = \
(set -euo pipefail; \
$(call wrapper,$(BAZEL) build $(BASE_OPTIONS) $(BAZEL_OPTIONS) $(1)) && \
$(call wrapper,$(BAZEL) cquery $(BASE_OPTIONS) $(BAZEL_OPTIONS) $(1) --output=starlark --starlark:file=tools/show_paths.bzl) \
- | xargs -r -n 1 -I {} readlink -f "{}" \
- | xargs -r -n 1 -I {} bash -c 'set -xeuo pipefail; $(2)')
+ | xargs -r -n 1 -I {} bash -c 'test -e "{}" || exit 0; readlink -f "{}"' \
+ | xargs -r -n 1 -I {} bash -c 'set -euo pipefail; $(2)')
clean = $(call header,CLEAN) && $(call wrapper,$(BAZEL) clean)
build = $(call header,BUILD $(1)) && $(call build_paths,$(1),echo {})
diff --git a/tools/show_paths.bzl b/tools/show_paths.bzl
index ba78d3494..f0126ac7b 100644
--- a/tools/show_paths.bzl
+++ b/tools/show_paths.bzl
@@ -2,6 +2,8 @@
def format(target):
provider_map = providers(target)
+ if not provider_map:
+ return ""
outputs = dict()
# Try to resolve in order.