2021-11-11 13:54:42 +00:00
|
|
|
"tests for libs"
|
|
|
|
|
2022-03-31 04:04:14 +00:00
|
|
|
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
2021-11-11 13:54:42 +00:00
|
|
|
load("@bazel_skylib//rules:write_file.bzl", "write_file")
|
|
|
|
load("//lib:expand_make_vars.bzl", "expand_template")
|
2022-08-05 00:53:22 +00:00
|
|
|
load("//lib:testing.bzl", "assert_contains")
|
2021-11-08 15:22:47 +00:00
|
|
|
load(":expand_make_vars_test.bzl", "expand_make_vars_test_suite")
|
2021-11-09 23:13:30 +00:00
|
|
|
load(":utils_test.bzl", "utils_test_suite")
|
|
|
|
load(":paths_test.bzl", "paths_test_suite")
|
2022-07-28 01:48:02 +00:00
|
|
|
load(":glob_match_test.bzl", "glob_match_test_suite")
|
2021-11-08 15:22:47 +00:00
|
|
|
|
2021-11-09 23:13:30 +00:00
|
|
|
expand_make_vars_test_suite()
|
|
|
|
|
|
|
|
paths_test_suite()
|
|
|
|
|
|
|
|
utils_test_suite()
|
2021-11-11 13:54:42 +00:00
|
|
|
|
2022-07-28 01:48:02 +00:00
|
|
|
glob_match_test_suite()
|
|
|
|
|
2021-11-11 13:54:42 +00:00
|
|
|
write_file(
|
|
|
|
name = "gen_template",
|
|
|
|
out = "template.txt",
|
|
|
|
content = [
|
|
|
|
"#!/bin/bash",
|
|
|
|
"set -o errexit",
|
|
|
|
"""[ "{thing}" == "stuff" ]""",
|
2022-08-12 02:30:45 +00:00
|
|
|
"""[ "%path%" == "{BINDIR}/lib/tests/template.txt" ]""",
|
2021-11-11 13:54:42 +00:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
expand_template(
|
|
|
|
name = "expand_template",
|
|
|
|
out = "expand_template_test.sh",
|
|
|
|
data = [":gen_template"],
|
|
|
|
is_executable = True,
|
|
|
|
substitutions = {
|
|
|
|
"{thing}": "stuff",
|
|
|
|
"%path%": "$(execpath :gen_template)",
|
2022-08-12 02:30:45 +00:00
|
|
|
"{BINDIR}": "$(BINDIR)",
|
2021-11-11 13:54:42 +00:00
|
|
|
},
|
|
|
|
template = "template.txt",
|
|
|
|
)
|
|
|
|
|
|
|
|
sh_test(
|
|
|
|
name = "expand_template_test",
|
2022-08-20 19:53:12 +00:00
|
|
|
timeout = "short",
|
2021-11-11 13:54:42 +00:00
|
|
|
srcs = ["expand_template"],
|
|
|
|
)
|
2022-03-31 04:04:14 +00:00
|
|
|
|
2022-08-05 00:53:22 +00:00
|
|
|
assert_contains(
|
|
|
|
name = "expand_template_contains",
|
|
|
|
actual = "expand_template_test.sh",
|
|
|
|
expected = "stuff",
|
|
|
|
)
|
|
|
|
|
2022-03-31 04:04:14 +00:00
|
|
|
bzl_library(
|
|
|
|
name = "generate_outputs",
|
|
|
|
srcs = ["generate_outputs.bzl"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|