Skip to content

Commit

Permalink
cargo_build_script: Split CFLASG in test
Browse files Browse the repository at this point in the history
As `flag in cflags` is a just substring search
and very weak test for abs path.
  • Loading branch information
vitalybuka committed Oct 14, 2024
1 parent 95563e5 commit 131867d
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def _cc_args_and_env_analysis_test_impl(ctx):
env = analysistest.begin(ctx)
tut = analysistest.target_under_test(env)
cargo_action = tut[DepActionsInfo].actions[0]
cflags = cargo_action.env["CFLAGS"]
cflags = cargo_action.env["CFLAGS"].split(" ")
for flag in ctx.attr.expected_cflags:
asserts.true(
env,
Expand Down Expand Up @@ -181,7 +181,7 @@ def isystem_relative_test(name):
cc_args_and_env_analysis_test(
name = name,
target_under_test = "%s/cargo_build_script" % name,
expected_cflags = ["-isystem ${pwd}/test/relative/path"],
expected_cflags = ["-isystem", "${pwd}/test/relative/path"],
)

def isystem_absolute_test(name):
Expand All @@ -192,5 +192,5 @@ def isystem_absolute_test(name):
cc_args_and_env_analysis_test(
name = name,
target_under_test = "%s/cargo_build_script" % name,
expected_cflags = ["-isystem /test/absolute/path"],
expected_cflags = ["-isystem", "/test/absolute/path"],
)

0 comments on commit 131867d

Please sign in to comment.