diff options
author | Paul Duffin <paulduffin@google.com> | 2021-03-22 17:31:52 +0000 |
---|---|---|
committer | Paul Duffin <paulduffin@google.com> | 2021-03-24 01:07:12 +0000 |
commit | 414ea5eb73acf15c37e3e3057f903e73cd3e2094 (patch) | |
tree | 6ab19ddbf9036dbd287f30c3a4ed36948d306314 /java/sdk_test.go | |
parent | fb0fe9f5cbb98c468b7aa82c4034ccf6b877d61a (diff) |
Remove uses of buildDir from java/java_test.go and java/sdk_test.go
Remove any uses, either direct (or indirect via testJavaConfig or
similar methods), of the package level buildDir variable from this
file.
Bug: 182885307
Test: m nothing
Change-Id: I4d9dc39d3b1e5c37ba1f9e72da94048949c0fd17
Diffstat (limited to 'java/sdk_test.go')
-rw-r--r-- | java/sdk_test.go | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/java/sdk_test.go b/java/sdk_test.go index 37875a43b..ff0a2039b 100644 --- a/java/sdk_test.go +++ b/java/sdk_test.go @@ -16,7 +16,6 @@ package java import ( "path/filepath" - "reflect" "strings" "testing" @@ -98,7 +97,7 @@ func TestClasspath(t *testing.T) { bootclasspath: []string{"android_stubs_current", "core-lambda-stubs"}, system: "core-current-stubs-system-modules", java9classpath: []string{"android_stubs_current"}, - aidl: "-p" + buildDir + "/framework.aidl", + aidl: "-pout/soong/framework.aidl", }, { @@ -107,7 +106,7 @@ func TestClasspath(t *testing.T) { bootclasspath: []string{"android_system_stubs_current", "core-lambda-stubs"}, system: "core-current-stubs-system-modules", java9classpath: []string{"android_system_stubs_current"}, - aidl: "-p" + buildDir + "/framework.aidl", + aidl: "-pout/soong/framework.aidl", }, { @@ -135,7 +134,7 @@ func TestClasspath(t *testing.T) { bootclasspath: []string{"android_test_stubs_current", "core-lambda-stubs"}, system: "core-current-stubs-system-modules", java9classpath: []string{"android_test_stubs_current"}, - aidl: "-p" + buildDir + "/framework.aidl", + aidl: "-pout/soong/framework.aidl", }, { @@ -222,7 +221,7 @@ func TestClasspath(t *testing.T) { bootclasspath: []string{"android_module_lib_stubs_current", "core-lambda-stubs"}, system: "core-current-stubs-system-modules", java9classpath: []string{"android_module_lib_stubs_current"}, - aidl: "-p" + buildDir + "/framework_non_updatable.aidl", + aidl: "-pout/soong/framework_non_updatable.aidl", }, { name: "system_server_current", @@ -230,7 +229,7 @@ func TestClasspath(t *testing.T) { bootclasspath: []string{"android_system_server_stubs_current", "core-lambda-stubs"}, system: "core-current-stubs-system-modules", java9classpath: []string{"android_system_server_stubs_current"}, - aidl: "-p" + buildDir + "/framework.aidl", + aidl: "-pout/soong/framework.aidl", }, } @@ -303,23 +302,23 @@ func TestClasspath(t *testing.T) { } else { dir = defaultJavaDir } - system = "--system=" + filepath.Join(buildDir, ".intermediates", dir, testcase.system, "android_common", "system") + system = "--system=" + filepath.Join("out", "soong", ".intermediates", dir, testcase.system, "android_common", "system") // The module-relative parts of these paths are hardcoded in system_modules.go: systemDeps = []string{ - filepath.Join(buildDir, ".intermediates", dir, testcase.system, "android_common", "system", "lib", "modules"), - filepath.Join(buildDir, ".intermediates", dir, testcase.system, "android_common", "system", "lib", "jrt-fs.jar"), - filepath.Join(buildDir, ".intermediates", dir, testcase.system, "android_common", "system", "release"), + filepath.Join("out", "soong", ".intermediates", dir, testcase.system, "android_common", "system", "lib", "modules"), + filepath.Join("out", "soong", ".intermediates", dir, testcase.system, "android_common", "system", "lib", "jrt-fs.jar"), + filepath.Join("out", "soong", ".intermediates", dir, testcase.system, "android_common", "system", "release"), } } checkClasspath := func(t *testing.T, result *android.TestResult, isJava8 bool) { foo := result.ModuleForTests("foo", variant) - javac := foo.Rule("javac") + javac := foo.Rule("javac").RelativeToTop() var deps []string - aidl := foo.MaybeRule("aidl") + aidl := foo.MaybeRule("aidl").RelativeToTop() if aidl.Rule != nil { - deps = append(deps, aidl.Output.String()) + deps = append(deps, android.PathRelativeToTop(aidl.Output)) } got := javac.Args["bootClasspath"] @@ -347,9 +346,7 @@ func TestClasspath(t *testing.T) { t.Errorf("classpath expected %q != got %q", expected, got) } - if !reflect.DeepEqual(javac.Implicits.Strings(), deps) { - t.Errorf("implicits expected %q != got %q", deps, javac.Implicits.Strings()) - } + android.AssertPathsRelativeToTopEquals(t, "implicits", deps, javac.Implicits) } fixtureFactory := javaFixtureFactory.Extend( @@ -378,7 +375,7 @@ func TestClasspath(t *testing.T) { checkClasspath(t, result, true /* isJava8 */) if testcase.host != android.Host { - aidl := result.ModuleForTests("foo", variant).Rule("aidl") + aidl := result.ModuleForTests("foo", variant).Rule("aidl").RelativeToTop() android.AssertStringDoesContain(t, "aidl command", aidl.RuleParams.Command, testcase.aidl+" -I.") } @@ -391,7 +388,7 @@ func TestClasspath(t *testing.T) { checkClasspath(t, result, false /* isJava8 */) if testcase.host != android.Host { - aidl := result.ModuleForTests("foo", variant).Rule("aidl") + aidl := result.ModuleForTests("foo", variant).Rule("aidl").RelativeToTop() android.AssertStringDoesContain(t, "aidl command", aidl.RuleParams.Command, testcase.aidl+" -I.") } |