2
0
Fork 0
mirror of https://github.com/bazel-contrib/rules_foreign_cc synced 2024-11-27 02:43:28 +00:00
rules_foreign_cc/test/BUILD.bazel
Yesudeep Mangalapilly a2f1e5d8c3
Adds toolchain for freebsd. (#794)
* Adds toolchain for freebsd.

* Address buildifier lint warnings.

* Use /usr/bin/env bash

* Leave the Linux-specific shebang alone.

* Adds note about Bazel CI issue requesting for FreeBSD support and experimental status.

* Fix typo.

* Clean up trailing whitespace.

* Updates bazel-skylib version for tests to pass on FreeBSD.

* Update foreign_cc/repositories.bzl

Co-authored-by: UebelAndre <github@uebelandre.com>
2021-11-29 10:54:06 +00:00

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$$"],
)
# 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",
)