2
0
Fork 0
mirror of https://github.com/bazel-contrib/rules_foreign_cc synced 2024-11-30 16:42:07 +00:00
rules_foreign_cc/test/BUILD.bazel
James Sharpe b136e6c52d
Add config for building with spawn_strategy=standalone (#603)
* Add config for building with spawn_strategy=standalone

* Always build RELEASE configuration to avoid having to select for the output due to change in artifact names for debug builds

* Fix for copy_contents_to_dir and symlink_contents_to_dir on macOS as per #512

* Update name of test files
2021-05-05 17:47:25 -07:00

66 lines
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$$"],
)
# 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"],
)
diff_test(
name = "shell_script_inner_fun_test",
file1 = ":shell_script_inner_fun",
file2 = select({
":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({
":macos": "expected/out_symlinked_dirs_macos.txt",
"//conditions:default": "expected/out_symlinked_dirs.txt",
}),
file2 = ":symlink_dirs",
)