diff options
author | 2020-09-23 04:30:02 +0000 | |
---|---|---|
committer | 2020-10-19 01:26:50 -0400 | |
commit | ce679d29ec735058a0f655cd2dc5948dd521dd5c (patch) | |
tree | 9e710cff780ebb816c278930a49f641710ef8cd4 /android/module_test.go | |
parent | 509a9d35ac77b474088016327c21083239a4deb8 (diff) |
Add symlink_outputs support to Soong.
This CL adds symlink_outputs to various locations in Soong that creates
actions that creates symlink outputs, and explicitly mark them as such.
Test: m
Bug: 160568334
Change-Id: I322751bada52a9f49011c74731d84761586e03e7
Diffstat (limited to 'android/module_test.go')
-rw-r--r-- | android/module_test.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/android/module_test.go b/android/module_test.go index 6e648d7bb..3a039e29a 100644 --- a/android/module_test.go +++ b/android/module_test.go @@ -187,3 +187,49 @@ func TestErrorDependsOnDisabledModule(t *testing.T) { _, errs = ctx.PrepareBuildActions(config) FailIfNoMatchingErrors(t, `module "foo": depends on disabled module "bar"`, errs) } + +func TestValidateCorrectBuildParams(t *testing.T) { + config := TestConfig(buildDir, nil, "", nil) + pathContext := PathContextForTesting(config) + bparams := convertBuildParams(BuildParams{ + // Test with Output + Output: PathForOutput(pathContext, "undeclared_symlink"), + SymlinkOutput: PathForOutput(pathContext, "undeclared_symlink"), + }) + + err := validateBuildParams(bparams) + if err != nil { + t.Error(err) + } + + bparams = convertBuildParams(BuildParams{ + // Test with ImplicitOutput + ImplicitOutput: PathForOutput(pathContext, "undeclared_symlink"), + SymlinkOutput: PathForOutput(pathContext, "undeclared_symlink"), + }) + + err = validateBuildParams(bparams) + if err != nil { + t.Error(err) + } +} + +func TestValidateIncorrectBuildParams(t *testing.T) { + config := TestConfig(buildDir, nil, "", nil) + pathContext := PathContextForTesting(config) + params := BuildParams{ + Output: PathForOutput(pathContext, "regular_output"), + Outputs: PathsForOutput(pathContext, []string{"out1", "out2"}), + ImplicitOutput: PathForOutput(pathContext, "implicit_output"), + ImplicitOutputs: PathsForOutput(pathContext, []string{"i_out1", "_out2"}), + SymlinkOutput: PathForOutput(pathContext, "undeclared_symlink"), + } + + bparams := convertBuildParams(params) + err := validateBuildParams(bparams) + if err != nil { + FailIfNoMatchingErrors(t, "undeclared_symlink is not a declared output or implicit output", []error{err}) + } else { + t.Errorf("Expected build params to fail validation: %+v", bparams) + } +} |