74 lines
2.2 KiB
Python
74 lines
2.2 KiB
Python
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
|
|
load(":cmake_text_tests.bzl", "cmake_script_test_suite")
|
|
load(":convert_shell_script_test.bzl", "shell_script_conversion_suite")
|
|
load(":shell_script_helper_test_rule.bzl", "shell_script_helper_test_rule")
|
|
load(":symlink_contents_to_dir_test_rule.bzl", "symlink_contents_to_dir_test_rule")
|
|
load(":utils_test.bzl", "utils_test_suite")
|
|
|
|
cmake_script_test_suite()
|
|
|
|
shell_script_conversion_suite()
|
|
|
|
utils_test_suite()
|
|
|
|
shell_script_helper_test_rule(
|
|
name = "shell_script_inner_fun",
|
|
out = "inner_fun_text.txt",
|
|
script = ["##symlink_contents_to_dir## $$SOURCE_DIR$$ $$TARGET_DIR$$ False"],
|
|
)
|
|
|
|
# TODO: This should not be necessary but there appears to be some inconsistent
|
|
# behavior with the use of `constraint_value`s in `select` statements. A support
|
|
# thread was started at the end of https://github.com/bazelbuild/bazel/pull/12071
|
|
# Once it is possible to replace `:macos` with `@platforms//os:macos` that
|
|
# should be done for this file. Note actioning on this will set the minimum
|
|
# supported version of Bazel to 4.0.0 for these examples.
|
|
config_setting(
|
|
name = "macos",
|
|
constraint_values = ["@platforms//os:macos"],
|
|
visibility = ["//visibility:private"],
|
|
)
|
|
|
|
config_setting(
|
|
name = "freebsd",
|
|
constraint_values = ["@platforms//os:freebsd"],
|
|
visibility = ["//visibility:private"],
|
|
)
|
|
|
|
diff_test(
|
|
name = "shell_script_inner_fun_test",
|
|
file1 = ":shell_script_inner_fun",
|
|
file2 = select({
|
|
":freebsd": "expected/inner_fun_text_freebsd.txt",
|
|
":macos": "expected/inner_fun_text_macos.txt",
|
|
"//conditions:default": "expected/inner_fun_text.txt",
|
|
}),
|
|
)
|
|
|
|
filegroup(
|
|
name = "dir1_fg",
|
|
srcs = glob(["dir1/**"]),
|
|
)
|
|
|
|
filegroup(
|
|
name = "dir2_fg",
|
|
srcs = glob(["dir2/**"]),
|
|
)
|
|
|
|
symlink_contents_to_dir_test_rule(
|
|
name = "symlink_dirs",
|
|
out = "out_symlinked_dirs.txt",
|
|
dir1 = ":dir1_fg",
|
|
dir2 = ":dir2_fg",
|
|
)
|
|
|
|
diff_test(
|
|
name = "shell_method_symlink_contents_to_dir_test",
|
|
file1 = select({
|
|
":freebsd": "expected/out_symlinked_dirs_freebsd.txt",
|
|
":macos": "expected/out_symlinked_dirs_macos.txt",
|
|
"//conditions:default": "expected/out_symlinked_dirs.txt",
|
|
}),
|
|
file2 = ":symlink_dirs",
|
|
)
|