diff options
author | 2025-03-06 19:15:11 -0800 | |
---|---|---|
committer | 2025-03-06 19:15:11 -0800 | |
commit | ea4fe2c3bdd274f7c6830e3c842d303134b81a1d (patch) | |
tree | bf5cba76e38944954b7ae509dae32bb3383d597e /cc | |
parent | 268e50860191a1f9f9e476dc5c11a5b8e5dd3078 (diff) | |
parent | 2e704899b085c22a4ef203f0a743e3c380320a68 (diff) |
Merge "Allow genrules to depend on tools with symlinks" into main am: 2e704899b0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3529559
Change-Id: I3e74da9d48321d8990945d8ed5a1f8fad2e53689
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'cc')
-rw-r--r-- | cc/genrule_test.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/cc/genrule_test.go b/cc/genrule_test.go index 438eb9880..4e700a2cd 100644 --- a/cc/genrule_test.go +++ b/cc/genrule_test.go @@ -17,6 +17,7 @@ package cc import ( "reflect" "slices" + "strings" "testing" "android/soong/android" @@ -254,3 +255,42 @@ func TestMultilibGenruleOut(t *testing.T) { gen_64bit, ) } + +// Test that a genrule can depend on a tool with symlinks. The symlinks are ignored, but +// at least it doesn't cause errors. +func TestGenruleToolWithSymlinks(t *testing.T) { + bp := ` + genrule { + name: "gen", + tools: ["tool_with_symlinks"], + cmd: "$(location tool_with_symlinks) $(in) $(out)", + out: ["out"], + } + + cc_binary_host { + name: "tool_with_symlinks", + symlinks: ["symlink1", "symlink2"], + } + ` + ctx := PrepareForIntegrationTestWithCc. + ExtendWithErrorHandler(android.FixtureExpectsNoErrors). + RunTestWithBp(t, bp) + gen := ctx.ModuleForTests(t, "gen", "").Output("out") + toolFound := false + symlinkFound := false + for _, dep := range gen.RuleParams.CommandDeps { + if strings.HasSuffix(dep, "/tool_with_symlinks") { + toolFound = true + } + if strings.HasSuffix(dep, "/symlink1") || strings.HasSuffix(dep, "/symlink2") { + symlinkFound = true + } + } + if !toolFound { + t.Errorf("Tool not found") + } + // We may want to change genrules to include symlinks later + if symlinkFound { + t.Errorf("Symlinks found") + } +} |