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:
@@ -334,9 +334,7 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string
|
||||
},
|
||||
|
||||
outDir: buildDir,
|
||||
// soongOutDir is inconsistent with production (it should be buildDir + "/soong")
|
||||
// but a lot of tests assume this :(
|
||||
soongOutDir: buildDir,
|
||||
soongOutDir: filepath.Join(buildDir, "soong"),
|
||||
captureBuild: true,
|
||||
env: envCopy,
|
||||
|
||||
|
@@ -993,7 +993,7 @@ func TestPathForSource(t *testing.T) {
|
||||
{
|
||||
name: "in out dir",
|
||||
buildDir: "out",
|
||||
src: "out/a/b/c",
|
||||
src: "out/soong/a/b/c",
|
||||
err: "is in output",
|
||||
},
|
||||
}
|
||||
@@ -1525,7 +1525,7 @@ func ExampleOutputPath_ReplaceExtension() {
|
||||
fmt.Println(p.Rel(), p2.Rel())
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -1539,7 +1539,7 @@ func ExampleOutputPath_InSameDir() {
|
||||
fmt.Println(p.Rel(), p2.Rel())
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
|
@@ -64,10 +64,10 @@ func ExampleRuleBuilder() {
|
||||
fmt.Printf("outputs: %q\n", rule.Outputs())
|
||||
|
||||
// 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"]
|
||||
// inputs: ["a.o" "b.o"]
|
||||
// outputs: ["out/linked"]
|
||||
// outputs: ["out/soong/linked"]
|
||||
}
|
||||
|
||||
func ExampleRuleBuilder_SymlinkOutputs() {
|
||||
@@ -79,7 +79,7 @@ func ExampleRuleBuilder_SymlinkOutputs() {
|
||||
Tool(PathForSource(ctx, "ln")).
|
||||
FlagWithInput("-s ", PathForTesting("a.o")).
|
||||
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"))
|
||||
|
||||
fmt.Printf("commands: %q\n", strings.Join(rule.Commands(), " && "))
|
||||
@@ -89,11 +89,11 @@ func ExampleRuleBuilder_SymlinkOutputs() {
|
||||
fmt.Printf("symlink_outputs: %q\n", rule.SymlinkOutputs())
|
||||
|
||||
// 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"]
|
||||
// inputs: ["a.o"]
|
||||
// outputs: ["out/a" "out/b"]
|
||||
// symlink_outputs: ["out/a" "out/b"]
|
||||
// outputs: ["out/soong/a" "out/soong/b"]
|
||||
// symlink_outputs: ["out/soong/a" "out/soong/b"]
|
||||
}
|
||||
|
||||
func ExampleRuleBuilder_Temporary() {
|
||||
@@ -117,10 +117,10 @@ func ExampleRuleBuilder_Temporary() {
|
||||
fmt.Printf("outputs: %q\n", rule.Outputs())
|
||||
|
||||
// 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"]
|
||||
// inputs: ["a"]
|
||||
// outputs: ["out/c"]
|
||||
// outputs: ["out/soong/c"]
|
||||
}
|
||||
|
||||
func ExampleRuleBuilder_DeleteTemporaryFiles() {
|
||||
@@ -145,10 +145,10 @@ func ExampleRuleBuilder_DeleteTemporaryFiles() {
|
||||
fmt.Printf("outputs: %q\n", rule.Outputs())
|
||||
|
||||
// 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"]
|
||||
// inputs: ["a"]
|
||||
// outputs: ["out/c"]
|
||||
// outputs: ["out/soong/c"]
|
||||
}
|
||||
|
||||
func ExampleRuleBuilder_Installs() {
|
||||
@@ -168,7 +168,7 @@ func ExampleRuleBuilder_Installs() {
|
||||
fmt.Printf("rule.Installs().String() = %q\n", rule.Installs().String())
|
||||
|
||||
// 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() {
|
||||
@@ -271,7 +271,7 @@ func ExampleRuleBuilderCommand_FlagWithRspFileInputList() {
|
||||
FlagWithRspFileInputList("@", PathForOutput(ctx, "foo.rsp"), PathsForTesting("a.java", "b.java")).
|
||||
String())
|
||||
// Output:
|
||||
// javac @out/foo.rsp
|
||||
// javac @out/soong/foo.rsp
|
||||
}
|
||||
|
||||
func ExampleRuleBuilderCommand_String() {
|
||||
@@ -371,15 +371,15 @@ func TestRuleBuilder(t *testing.T) {
|
||||
addCommands(rule)
|
||||
|
||||
wantCommands := []string{
|
||||
"out_local/module/DepFile Flag FlagWithArg=arg FlagWithDepFile=out_local/module/depfile " +
|
||||
"FlagWithInput=input FlagWithOutput=out_local/module/output FlagWithRspFileInputList=out_local/rsp " +
|
||||
"Input out_local/module/Output out_local/module/SymlinkOutput Text Tool after command2 old cmd",
|
||||
"command2 out_local/module/depfile2 input2 out_local/module/output2 tool2",
|
||||
"command3 input3 out_local/module/output2 out_local/module/output3 input3 out_local/module/output2",
|
||||
"out_local/soong/module/DepFile Flag FlagWithArg=arg FlagWithDepFile=out_local/soong/module/depfile " +
|
||||
"FlagWithInput=input FlagWithOutput=out_local/soong/module/output FlagWithRspFileInputList=out_local/soong/rsp " +
|
||||
"Input out_local/soong/module/Output out_local/soong/module/SymlinkOutput Text Tool after command2 old cmd",
|
||||
"command2 out_local/soong/module/depfile2 input2 out_local/soong/module/output2 tool2",
|
||||
"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 " +
|
||||
"out_local/module/DepFile out_local/module/depfile out_local/module/ImplicitDepFile out_local/module/depfile2"
|
||||
wantDepMergerCommand := "out_local/soong/host/" + ctx.Config().PrebuiltOS() + "/bin/dep_fixer " +
|
||||
"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())
|
||||
|
||||
@@ -403,13 +403,13 @@ func TestRuleBuilder(t *testing.T) {
|
||||
wantCommands := []string{
|
||||
"__SBOX_SANDBOX_DIR__/out/DepFile Flag FlagWithArg=arg FlagWithDepFile=__SBOX_SANDBOX_DIR__/out/depfile " +
|
||||
"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",
|
||||
"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",
|
||||
}
|
||||
|
||||
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())
|
||||
|
||||
@@ -433,7 +433,7 @@ func TestRuleBuilder(t *testing.T) {
|
||||
wantCommands := []string{
|
||||
"__SBOX_SANDBOX_DIR__/out/DepFile Flag FlagWithArg=arg FlagWithDepFile=__SBOX_SANDBOX_DIR__/out/depfile " +
|
||||
"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",
|
||||
"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",
|
||||
|
@@ -115,16 +115,16 @@ func TestCLC(t *testing.T) {
|
||||
// Test that class loader context structure is correct.
|
||||
t.Run("string", func(t *testing.T) {
|
||||
wantStr := " --host-context-for-sdk 29 " +
|
||||
"PCL[out/" + AndroidHidlManager + ".jar]#" +
|
||||
"PCL[out/" + AndroidHidlBase + ".jar]" +
|
||||
"PCL[out/soong/" + AndroidHidlManager + ".jar]#" +
|
||||
"PCL[out/soong/" + AndroidHidlBase + ".jar]" +
|
||||
" --target-context-for-sdk 29 " +
|
||||
"PCL[/system/framework/" + AndroidHidlManager + ".jar]#" +
|
||||
"PCL[/system/framework/" + AndroidHidlBase + ".jar]" +
|
||||
" --host-context-for-sdk any " +
|
||||
"PCL[out/a.jar]#PCL[out/b.jar]#PCL[out/c.jar]#PCL[out/d.jar]" +
|
||||
"{PCL[out/a2.jar]#PCL[out/b2.jar]#PCL[out/c2.jar]" +
|
||||
"{PCL[out/a1.jar]#PCL[out/b1.jar]}}#" +
|
||||
"PCL[out/f.jar]#PCL[out/a3.jar]#PCL[out/b3.jar]" +
|
||||
"PCL[out/soong/a.jar]#PCL[out/soong/b.jar]#PCL[out/soong/c.jar]#PCL[out/soong/d.jar]" +
|
||||
"{PCL[out/soong/a2.jar]#PCL[out/soong/b2.jar]#PCL[out/soong/c2.jar]" +
|
||||
"{PCL[out/soong/a1.jar]#PCL[out/soong/b1.jar]}}#" +
|
||||
"PCL[out/soong/f.jar]#PCL[out/soong/a3.jar]#PCL[out/soong/b3.jar]" +
|
||||
" --target-context-for-sdk any " +
|
||||
"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]" +
|
||||
@@ -138,11 +138,11 @@ func TestCLC(t *testing.T) {
|
||||
// Test that all expected build paths are gathered.
|
||||
t.Run("paths", func(t *testing.T) {
|
||||
wantPaths := []string{
|
||||
"out/android.hidl.manager-V1.0-java.jar", "out/android.hidl.base-V1.0-java.jar",
|
||||
"out/a.jar", "out/b.jar", "out/c.jar", "out/d.jar",
|
||||
"out/a2.jar", "out/b2.jar", "out/c2.jar",
|
||||
"out/a1.jar", "out/b1.jar",
|
||||
"out/f.jar", "out/a3.jar", "out/b3.jar",
|
||||
"out/soong/android.hidl.manager-V1.0-java.jar", "out/soong/android.hidl.base-V1.0-java.jar",
|
||||
"out/soong/a.jar", "out/soong/b.jar", "out/soong/c.jar", "out/soong/d.jar",
|
||||
"out/soong/a2.jar", "out/soong/b2.jar", "out/soong/c2.jar",
|
||||
"out/soong/a1.jar", "out/soong/b1.jar",
|
||||
"out/soong/f.jar", "out/soong/a3.jar", "out/soong/b3.jar",
|
||||
}
|
||||
if !reflect.DeepEqual(wantPaths, havePaths.Strings()) {
|
||||
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.
|
||||
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]" +
|
||||
" --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]" +
|
||||
" --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]" +
|
||||
" --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]"
|
||||
if wantStr != haveStr {
|
||||
t.Errorf("\nwant class loader context: %s\nhave class loader context: %s", wantStr, haveStr)
|
||||
|
Reference in New Issue
Block a user