Fix OutDir vs SoongOutDir in tests
Tests were using the same value for OutDir and SoongOutDir, separate them to allow a test that needs to distinguish between them. Test: all soong tests Change-Id: Ibd78758c133a7f07bead3f51b699052676f92fbd
This commit is contained in:
@@ -333,10 +333,8 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string
|
|||||||
ShippingApiLevel: stringPtr("30"),
|
ShippingApiLevel: stringPtr("30"),
|
||||||
},
|
},
|
||||||
|
|
||||||
outDir: buildDir,
|
outDir: buildDir,
|
||||||
// soongOutDir is inconsistent with production (it should be buildDir + "/soong")
|
soongOutDir: filepath.Join(buildDir, "soong"),
|
||||||
// but a lot of tests assume this :(
|
|
||||||
soongOutDir: buildDir,
|
|
||||||
captureBuild: true,
|
captureBuild: true,
|
||||||
env: envCopy,
|
env: envCopy,
|
||||||
|
|
||||||
|
@@ -993,7 +993,7 @@ func TestPathForSource(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "in out dir",
|
name: "in out dir",
|
||||||
buildDir: "out",
|
buildDir: "out",
|
||||||
src: "out/a/b/c",
|
src: "out/soong/a/b/c",
|
||||||
err: "is in output",
|
err: "is in output",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -1525,7 +1525,7 @@ func ExampleOutputPath_ReplaceExtension() {
|
|||||||
fmt.Println(p.Rel(), p2.Rel())
|
fmt.Println(p.Rel(), p2.Rel())
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// out/system/framework/boot.art out/system/framework/boot.oat
|
// out/soong/system/framework/boot.art out/soong/system/framework/boot.oat
|
||||||
// boot.art boot.oat
|
// boot.art boot.oat
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1539,7 +1539,7 @@ func ExampleOutputPath_InSameDir() {
|
|||||||
fmt.Println(p.Rel(), p2.Rel())
|
fmt.Println(p.Rel(), p2.Rel())
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// out/system/framework/boot.art out/system/framework/oat/arm/boot.vdex
|
// out/soong/system/framework/boot.art out/soong/system/framework/oat/arm/boot.vdex
|
||||||
// boot.art oat/arm/boot.vdex
|
// boot.art oat/arm/boot.vdex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -64,10 +64,10 @@ func ExampleRuleBuilder() {
|
|||||||
fmt.Printf("outputs: %q\n", rule.Outputs())
|
fmt.Printf("outputs: %q\n", rule.Outputs())
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// commands: "ld a.o b.o -o out/linked && echo success"
|
// commands: "ld a.o b.o -o out/soong/linked && echo success"
|
||||||
// tools: ["ld"]
|
// tools: ["ld"]
|
||||||
// inputs: ["a.o" "b.o"]
|
// inputs: ["a.o" "b.o"]
|
||||||
// outputs: ["out/linked"]
|
// outputs: ["out/soong/linked"]
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilder_SymlinkOutputs() {
|
func ExampleRuleBuilder_SymlinkOutputs() {
|
||||||
@@ -79,7 +79,7 @@ func ExampleRuleBuilder_SymlinkOutputs() {
|
|||||||
Tool(PathForSource(ctx, "ln")).
|
Tool(PathForSource(ctx, "ln")).
|
||||||
FlagWithInput("-s ", PathForTesting("a.o")).
|
FlagWithInput("-s ", PathForTesting("a.o")).
|
||||||
SymlinkOutput(PathForOutput(ctx, "a"))
|
SymlinkOutput(PathForOutput(ctx, "a"))
|
||||||
rule.Command().Text("cp out/a out/b").
|
rule.Command().Text("cp out/soong/a out/soong/b").
|
||||||
ImplicitSymlinkOutput(PathForOutput(ctx, "b"))
|
ImplicitSymlinkOutput(PathForOutput(ctx, "b"))
|
||||||
|
|
||||||
fmt.Printf("commands: %q\n", strings.Join(rule.Commands(), " && "))
|
fmt.Printf("commands: %q\n", strings.Join(rule.Commands(), " && "))
|
||||||
@@ -89,11 +89,11 @@ func ExampleRuleBuilder_SymlinkOutputs() {
|
|||||||
fmt.Printf("symlink_outputs: %q\n", rule.SymlinkOutputs())
|
fmt.Printf("symlink_outputs: %q\n", rule.SymlinkOutputs())
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// commands: "ln -s a.o out/a && cp out/a out/b"
|
// commands: "ln -s a.o out/soong/a && cp out/soong/a out/soong/b"
|
||||||
// tools: ["ln"]
|
// tools: ["ln"]
|
||||||
// inputs: ["a.o"]
|
// inputs: ["a.o"]
|
||||||
// outputs: ["out/a" "out/b"]
|
// outputs: ["out/soong/a" "out/soong/b"]
|
||||||
// symlink_outputs: ["out/a" "out/b"]
|
// symlink_outputs: ["out/soong/a" "out/soong/b"]
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilder_Temporary() {
|
func ExampleRuleBuilder_Temporary() {
|
||||||
@@ -117,10 +117,10 @@ func ExampleRuleBuilder_Temporary() {
|
|||||||
fmt.Printf("outputs: %q\n", rule.Outputs())
|
fmt.Printf("outputs: %q\n", rule.Outputs())
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// commands: "cp a out/b && cp out/b out/c"
|
// commands: "cp a out/soong/b && cp out/soong/b out/soong/c"
|
||||||
// tools: ["cp"]
|
// tools: ["cp"]
|
||||||
// inputs: ["a"]
|
// inputs: ["a"]
|
||||||
// outputs: ["out/c"]
|
// outputs: ["out/soong/c"]
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilder_DeleteTemporaryFiles() {
|
func ExampleRuleBuilder_DeleteTemporaryFiles() {
|
||||||
@@ -145,10 +145,10 @@ func ExampleRuleBuilder_DeleteTemporaryFiles() {
|
|||||||
fmt.Printf("outputs: %q\n", rule.Outputs())
|
fmt.Printf("outputs: %q\n", rule.Outputs())
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// commands: "cp a out/b && cp out/b out/c && rm -f out/b"
|
// commands: "cp a out/soong/b && cp out/soong/b out/soong/c && rm -f out/soong/b"
|
||||||
// tools: ["cp"]
|
// tools: ["cp"]
|
||||||
// inputs: ["a"]
|
// inputs: ["a"]
|
||||||
// outputs: ["out/c"]
|
// outputs: ["out/soong/c"]
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilder_Installs() {
|
func ExampleRuleBuilder_Installs() {
|
||||||
@@ -168,7 +168,7 @@ func ExampleRuleBuilder_Installs() {
|
|||||||
fmt.Printf("rule.Installs().String() = %q\n", rule.Installs().String())
|
fmt.Printf("rule.Installs().String() = %q\n", rule.Installs().String())
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// rule.Installs().String() = "out/linked:/bin/linked out/linked:/sbin/linked"
|
// rule.Installs().String() = "out/soong/linked:/bin/linked out/soong/linked:/sbin/linked"
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilderCommand() {
|
func ExampleRuleBuilderCommand() {
|
||||||
@@ -271,7 +271,7 @@ func ExampleRuleBuilderCommand_FlagWithRspFileInputList() {
|
|||||||
FlagWithRspFileInputList("@", PathForOutput(ctx, "foo.rsp"), PathsForTesting("a.java", "b.java")).
|
FlagWithRspFileInputList("@", PathForOutput(ctx, "foo.rsp"), PathsForTesting("a.java", "b.java")).
|
||||||
String())
|
String())
|
||||||
// Output:
|
// Output:
|
||||||
// javac @out/foo.rsp
|
// javac @out/soong/foo.rsp
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRuleBuilderCommand_String() {
|
func ExampleRuleBuilderCommand_String() {
|
||||||
@@ -371,15 +371,15 @@ func TestRuleBuilder(t *testing.T) {
|
|||||||
addCommands(rule)
|
addCommands(rule)
|
||||||
|
|
||||||
wantCommands := []string{
|
wantCommands := []string{
|
||||||
"out_local/module/DepFile Flag FlagWithArg=arg FlagWithDepFile=out_local/module/depfile " +
|
"out_local/soong/module/DepFile Flag FlagWithArg=arg FlagWithDepFile=out_local/soong/module/depfile " +
|
||||||
"FlagWithInput=input FlagWithOutput=out_local/module/output FlagWithRspFileInputList=out_local/rsp " +
|
"FlagWithInput=input FlagWithOutput=out_local/soong/module/output FlagWithRspFileInputList=out_local/soong/rsp " +
|
||||||
"Input out_local/module/Output out_local/module/SymlinkOutput Text Tool after command2 old cmd",
|
"Input out_local/soong/module/Output out_local/soong/module/SymlinkOutput Text Tool after command2 old cmd",
|
||||||
"command2 out_local/module/depfile2 input2 out_local/module/output2 tool2",
|
"command2 out_local/soong/module/depfile2 input2 out_local/soong/module/output2 tool2",
|
||||||
"command3 input3 out_local/module/output2 out_local/module/output3 input3 out_local/module/output2",
|
"command3 input3 out_local/soong/module/output2 out_local/soong/module/output3 input3 out_local/soong/module/output2",
|
||||||
}
|
}
|
||||||
|
|
||||||
wantDepMergerCommand := "out_local/host/" + ctx.Config().PrebuiltOS() + "/bin/dep_fixer " +
|
wantDepMergerCommand := "out_local/soong/host/" + ctx.Config().PrebuiltOS() + "/bin/dep_fixer " +
|
||||||
"out_local/module/DepFile out_local/module/depfile out_local/module/ImplicitDepFile out_local/module/depfile2"
|
"out_local/soong/module/DepFile out_local/soong/module/depfile out_local/soong/module/ImplicitDepFile out_local/soong/module/depfile2"
|
||||||
|
|
||||||
AssertDeepEquals(t, "rule.Commands()", wantCommands, rule.Commands())
|
AssertDeepEquals(t, "rule.Commands()", wantCommands, rule.Commands())
|
||||||
|
|
||||||
@@ -403,13 +403,13 @@ func TestRuleBuilder(t *testing.T) {
|
|||||||
wantCommands := []string{
|
wantCommands := []string{
|
||||||
"__SBOX_SANDBOX_DIR__/out/DepFile Flag FlagWithArg=arg FlagWithDepFile=__SBOX_SANDBOX_DIR__/out/depfile " +
|
"__SBOX_SANDBOX_DIR__/out/DepFile Flag FlagWithArg=arg FlagWithDepFile=__SBOX_SANDBOX_DIR__/out/depfile " +
|
||||||
"FlagWithInput=input FlagWithOutput=__SBOX_SANDBOX_DIR__/out/output " +
|
"FlagWithInput=input FlagWithOutput=__SBOX_SANDBOX_DIR__/out/output " +
|
||||||
"FlagWithRspFileInputList=out_local/rsp Input __SBOX_SANDBOX_DIR__/out/Output " +
|
"FlagWithRspFileInputList=out_local/soong/rsp Input __SBOX_SANDBOX_DIR__/out/Output " +
|
||||||
"__SBOX_SANDBOX_DIR__/out/SymlinkOutput Text Tool after command2 old cmd",
|
"__SBOX_SANDBOX_DIR__/out/SymlinkOutput Text Tool after command2 old cmd",
|
||||||
"command2 __SBOX_SANDBOX_DIR__/out/depfile2 input2 __SBOX_SANDBOX_DIR__/out/output2 tool2",
|
"command2 __SBOX_SANDBOX_DIR__/out/depfile2 input2 __SBOX_SANDBOX_DIR__/out/output2 tool2",
|
||||||
"command3 input3 __SBOX_SANDBOX_DIR__/out/output2 __SBOX_SANDBOX_DIR__/out/output3 input3 __SBOX_SANDBOX_DIR__/out/output2",
|
"command3 input3 __SBOX_SANDBOX_DIR__/out/output2 __SBOX_SANDBOX_DIR__/out/output3 input3 __SBOX_SANDBOX_DIR__/out/output2",
|
||||||
}
|
}
|
||||||
|
|
||||||
wantDepMergerCommand := "out_local/host/" + ctx.Config().PrebuiltOS() + "/bin/dep_fixer __SBOX_SANDBOX_DIR__/out/DepFile __SBOX_SANDBOX_DIR__/out/depfile __SBOX_SANDBOX_DIR__/out/ImplicitDepFile __SBOX_SANDBOX_DIR__/out/depfile2"
|
wantDepMergerCommand := "out_local/soong/host/" + ctx.Config().PrebuiltOS() + "/bin/dep_fixer __SBOX_SANDBOX_DIR__/out/DepFile __SBOX_SANDBOX_DIR__/out/depfile __SBOX_SANDBOX_DIR__/out/ImplicitDepFile __SBOX_SANDBOX_DIR__/out/depfile2"
|
||||||
|
|
||||||
AssertDeepEquals(t, "rule.Commands()", wantCommands, rule.Commands())
|
AssertDeepEquals(t, "rule.Commands()", wantCommands, rule.Commands())
|
||||||
|
|
||||||
@@ -433,7 +433,7 @@ func TestRuleBuilder(t *testing.T) {
|
|||||||
wantCommands := []string{
|
wantCommands := []string{
|
||||||
"__SBOX_SANDBOX_DIR__/out/DepFile Flag FlagWithArg=arg FlagWithDepFile=__SBOX_SANDBOX_DIR__/out/depfile " +
|
"__SBOX_SANDBOX_DIR__/out/DepFile Flag FlagWithArg=arg FlagWithDepFile=__SBOX_SANDBOX_DIR__/out/depfile " +
|
||||||
"FlagWithInput=input FlagWithOutput=__SBOX_SANDBOX_DIR__/out/output " +
|
"FlagWithInput=input FlagWithOutput=__SBOX_SANDBOX_DIR__/out/output " +
|
||||||
"FlagWithRspFileInputList=out_local/rsp Input __SBOX_SANDBOX_DIR__/out/Output " +
|
"FlagWithRspFileInputList=out_local/soong/rsp Input __SBOX_SANDBOX_DIR__/out/Output " +
|
||||||
"__SBOX_SANDBOX_DIR__/out/SymlinkOutput Text __SBOX_SANDBOX_DIR__/tools/src/Tool after command2 old cmd",
|
"__SBOX_SANDBOX_DIR__/out/SymlinkOutput Text __SBOX_SANDBOX_DIR__/tools/src/Tool after command2 old cmd",
|
||||||
"command2 __SBOX_SANDBOX_DIR__/out/depfile2 input2 __SBOX_SANDBOX_DIR__/out/output2 __SBOX_SANDBOX_DIR__/tools/src/tool2",
|
"command2 __SBOX_SANDBOX_DIR__/out/depfile2 input2 __SBOX_SANDBOX_DIR__/out/output2 __SBOX_SANDBOX_DIR__/tools/src/tool2",
|
||||||
"command3 input3 __SBOX_SANDBOX_DIR__/out/output2 __SBOX_SANDBOX_DIR__/out/output3 input3 __SBOX_SANDBOX_DIR__/out/output2",
|
"command3 input3 __SBOX_SANDBOX_DIR__/out/output2 __SBOX_SANDBOX_DIR__/out/output3 input3 __SBOX_SANDBOX_DIR__/out/output2",
|
||||||
|
@@ -115,16 +115,16 @@ func TestCLC(t *testing.T) {
|
|||||||
// Test that class loader context structure is correct.
|
// Test that class loader context structure is correct.
|
||||||
t.Run("string", func(t *testing.T) {
|
t.Run("string", func(t *testing.T) {
|
||||||
wantStr := " --host-context-for-sdk 29 " +
|
wantStr := " --host-context-for-sdk 29 " +
|
||||||
"PCL[out/" + AndroidHidlManager + ".jar]#" +
|
"PCL[out/soong/" + AndroidHidlManager + ".jar]#" +
|
||||||
"PCL[out/" + AndroidHidlBase + ".jar]" +
|
"PCL[out/soong/" + AndroidHidlBase + ".jar]" +
|
||||||
" --target-context-for-sdk 29 " +
|
" --target-context-for-sdk 29 " +
|
||||||
"PCL[/system/framework/" + AndroidHidlManager + ".jar]#" +
|
"PCL[/system/framework/" + AndroidHidlManager + ".jar]#" +
|
||||||
"PCL[/system/framework/" + AndroidHidlBase + ".jar]" +
|
"PCL[/system/framework/" + AndroidHidlBase + ".jar]" +
|
||||||
" --host-context-for-sdk any " +
|
" --host-context-for-sdk any " +
|
||||||
"PCL[out/a.jar]#PCL[out/b.jar]#PCL[out/c.jar]#PCL[out/d.jar]" +
|
"PCL[out/soong/a.jar]#PCL[out/soong/b.jar]#PCL[out/soong/c.jar]#PCL[out/soong/d.jar]" +
|
||||||
"{PCL[out/a2.jar]#PCL[out/b2.jar]#PCL[out/c2.jar]" +
|
"{PCL[out/soong/a2.jar]#PCL[out/soong/b2.jar]#PCL[out/soong/c2.jar]" +
|
||||||
"{PCL[out/a1.jar]#PCL[out/b1.jar]}}#" +
|
"{PCL[out/soong/a1.jar]#PCL[out/soong/b1.jar]}}#" +
|
||||||
"PCL[out/f.jar]#PCL[out/a3.jar]#PCL[out/b3.jar]" +
|
"PCL[out/soong/f.jar]#PCL[out/soong/a3.jar]#PCL[out/soong/b3.jar]" +
|
||||||
" --target-context-for-sdk any " +
|
" --target-context-for-sdk any " +
|
||||||
"PCL[/system/a.jar]#PCL[/system/b.jar]#PCL[/system/c.jar]#PCL[/system/d.jar]" +
|
"PCL[/system/a.jar]#PCL[/system/b.jar]#PCL[/system/c.jar]#PCL[/system/d.jar]" +
|
||||||
"{PCL[/system/a2.jar]#PCL[/system/b2.jar]#PCL[/system/c2.jar]" +
|
"{PCL[/system/a2.jar]#PCL[/system/b2.jar]#PCL[/system/c2.jar]" +
|
||||||
@@ -138,11 +138,11 @@ func TestCLC(t *testing.T) {
|
|||||||
// Test that all expected build paths are gathered.
|
// Test that all expected build paths are gathered.
|
||||||
t.Run("paths", func(t *testing.T) {
|
t.Run("paths", func(t *testing.T) {
|
||||||
wantPaths := []string{
|
wantPaths := []string{
|
||||||
"out/android.hidl.manager-V1.0-java.jar", "out/android.hidl.base-V1.0-java.jar",
|
"out/soong/android.hidl.manager-V1.0-java.jar", "out/soong/android.hidl.base-V1.0-java.jar",
|
||||||
"out/a.jar", "out/b.jar", "out/c.jar", "out/d.jar",
|
"out/soong/a.jar", "out/soong/b.jar", "out/soong/c.jar", "out/soong/d.jar",
|
||||||
"out/a2.jar", "out/b2.jar", "out/c2.jar",
|
"out/soong/a2.jar", "out/soong/b2.jar", "out/soong/c2.jar",
|
||||||
"out/a1.jar", "out/b1.jar",
|
"out/soong/a1.jar", "out/soong/b1.jar",
|
||||||
"out/f.jar", "out/a3.jar", "out/b3.jar",
|
"out/soong/f.jar", "out/soong/a3.jar", "out/soong/b3.jar",
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(wantPaths, havePaths.Strings()) {
|
if !reflect.DeepEqual(wantPaths, havePaths.Strings()) {
|
||||||
t.Errorf("\nwant paths: %s\nhave paths: %s", wantPaths, havePaths)
|
t.Errorf("\nwant paths: %s\nhave paths: %s", wantPaths, havePaths)
|
||||||
@@ -270,13 +270,13 @@ func TestCLCSdkVersionOrder(t *testing.T) {
|
|||||||
|
|
||||||
// Test that class loader context structure is correct.
|
// Test that class loader context structure is correct.
|
||||||
t.Run("string", func(t *testing.T) {
|
t.Run("string", func(t *testing.T) {
|
||||||
wantStr := " --host-context-for-sdk 30 PCL[out/c.jar]" +
|
wantStr := " --host-context-for-sdk 30 PCL[out/soong/c.jar]" +
|
||||||
" --target-context-for-sdk 30 PCL[/system/c.jar]" +
|
" --target-context-for-sdk 30 PCL[/system/c.jar]" +
|
||||||
" --host-context-for-sdk 29 PCL[out/b.jar]" +
|
" --host-context-for-sdk 29 PCL[out/soong/b.jar]" +
|
||||||
" --target-context-for-sdk 29 PCL[/system/b.jar]" +
|
" --target-context-for-sdk 29 PCL[/system/b.jar]" +
|
||||||
" --host-context-for-sdk 28 PCL[out/a.jar]" +
|
" --host-context-for-sdk 28 PCL[out/soong/a.jar]" +
|
||||||
" --target-context-for-sdk 28 PCL[/system/a.jar]" +
|
" --target-context-for-sdk 28 PCL[/system/a.jar]" +
|
||||||
" --host-context-for-sdk any PCL[out/d.jar]" +
|
" --host-context-for-sdk any PCL[out/soong/d.jar]" +
|
||||||
" --target-context-for-sdk any PCL[/system/d.jar]"
|
" --target-context-for-sdk any PCL[/system/d.jar]"
|
||||||
if wantStr != haveStr {
|
if wantStr != haveStr {
|
||||||
t.Errorf("\nwant class loader context: %s\nhave class loader context: %s", wantStr, haveStr)
|
t.Errorf("\nwant class loader context: %s\nhave class loader context: %s", wantStr, haveStr)
|
||||||
|
Reference in New Issue
Block a user