Merge pull request #811 from acozzette:staleness-test

PiperOrigin-RevId: 477840652
pull/13171/head
Copybara-Service 2 years ago
commit ce3a28f75c
  1. 3
      cmake/BUILD.bazel
  2. 6
      cmake/build_defs.bzl

@ -40,6 +40,9 @@ py_library(
name = "staleness_test_lib", name = "staleness_test_lib",
testonly = 1, testonly = 1,
srcs = ["staleness_test_lib.py"], srcs = ["staleness_test_lib.py"],
# This is public only for use by the staleness_test() macro. Please do not
# depend on this target directly.
visibility = ["//visibility:public"],
) )
py_binary( py_binary(

@ -42,7 +42,7 @@ def staleness_test(name, outs, generated_pattern, **kwargs):
""" """
script_name = name + ".py" script_name = name + ".py"
script_src = ":staleness_test.py" script_src = Label("//cmake:staleness_test.py")
# Filter out non-existing rules so Blaze doesn't error out before we even # Filter out non-existing rules so Blaze doesn't error out before we even
# run the test. # run the test.
@ -57,7 +57,7 @@ def staleness_test(name, outs, generated_pattern, **kwargs):
outs = [script_name], outs = [script_name],
srcs = [script_src], srcs = [script_src],
testonly = 1, testonly = 1,
cmd = "cat $(location " + script_src + ") > $@; " + cmd = "cp $< $@; " +
"sed -i.bak -e 's|INSERT_FILE_LIST_HERE|" + "\\\n ".join(file_list) + "|' $@", "sed -i.bak -e 's|INSERT_FILE_LIST_HERE|" + "\\\n ".join(file_list) + "|' $@",
) )
@ -67,7 +67,7 @@ def staleness_test(name, outs, generated_pattern, **kwargs):
data = existing_outs + [generated_pattern % file for file in outs], data = existing_outs + [generated_pattern % file for file in outs],
python_version = "PY3", python_version = "PY3",
deps = [ deps = [
":staleness_test_lib", Label("//cmake:staleness_test_lib"),
], ],
**kwargs **kwargs
) )

Loading…
Cancel
Save