Skip to content

Commit

Permalink
Add file for compilation tests (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
keith authored Aug 12, 2024
1 parent 27149c8 commit 4cd9e15
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ load("//rules:apple_genrule.bzl", "apple_genrule")
load(":apple_support_test.bzl", "apple_support_test")
load(":available_xcodes_test.bzl", "available_xcodes_test")
load(":binary_tests.bzl", "binary_test_suite")
load(":compiling_tests.bzl", "compiling_test_suite")
load(":linking_tests.bzl", "linking_test_suite")
load(":starlark_apple_binary.bzl", "starlark_apple_binary")
load(":universal_binary_test.bzl", "universal_binary_test")
Expand All @@ -20,6 +21,8 @@ available_xcodes_test(name = "available_xcodes_test")

binary_test_suite(name = "binary")

compiling_test_suite(name = "compiling")

linking_test_suite(name = "linking")

xcode_config_test(name = "xcode_config_test")
Expand Down
32 changes: 32 additions & 0 deletions test/compiling_tests.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Tests for compilation behavior."""

load(
"//test/rules:action_command_line_test.bzl",
"make_action_command_line_test_rule",
)

default_test = make_action_command_line_test_rule()

def compiling_test_suite(name):
"""Tests for compilation behavior.
Args:
name: The name to be included in test names and tags.
"""
default_test(
name = "{}_default_apple_macos_compile_test".format(name),
tags = [name],
expected_argv = [
"-fdebug-prefix-map=__BAZEL_EXECUTION_ROOT__=.",
],
not_expected_argv = [
"-DNS_BLOCK_ASSERTIONS=1",
],
mnemonic = "CppCompile",
target_under_test = "//test/test_data:cc_main",
)

native.test_suite(
name = name,
tags = [name],
)

0 comments on commit 4cd9e15

Please sign in to comment.