2
0
Fork 0
mirror of https://github.com/bazel-contrib/bazel-lib synced 2024-11-28 21:33:48 +00:00
bazel-lib/lib/tests/tar/asserts.bzl
Alex Eagle 472bf9b122
feat: tar includes runfiles (#595)
* feat: tar includes runfiles

* chore: try to fix red circleci

* fix: tracked down problem

* chore: document tar#srcs supports runfiles

* chore: add comment about logic for trimming manifest suffix

* chore: missed a replacement spot

* chore: give up on the listing test for now
2023-10-09 15:57:52 -07:00

31 lines
865 B
Python

"Make shorter assertions"
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
load("@bazel_skylib//rules:write_file.bzl", "write_file")
# buildifier: disable=function-docstring
def assert_tar_listing(name, actual, expected):
actual_listing = "_{}_listing".format(name)
expected_listing = "_{}_expected".format(name)
native.genrule(
name = actual_listing,
srcs = [actual],
outs = ["_{}.listing".format(name)],
cmd = "$(BSDTAR_BIN) -tvf $(execpath {}) >$@".format(actual),
toolchains = ["@bsd_tar_toolchains//:resolved_toolchain"],
)
write_file(
name = expected_listing,
out = "_{}.expected".format(name),
content = expected + [""],
)
diff_test(
name = name,
file1 = actual_listing,
file2 = expected_listing,
timeout = "short",
)