Remove unused test methods and buildDir
Bug: 182885307
Test: m nothing
Change-Id: I251145a82479428a82f19cbde6b415d149acd619
diff --git a/java/app_test.go b/java/app_test.go
index a7ebbee..609ddf1 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -29,15 +29,6 @@
"android/soong/genrule"
)
-// testAppConfig is a legacy way of creating a test Config for testing java app modules.
-//
-// See testJava for an explanation as to how to stop using this deprecated method.
-//
-// deprecated
-func testAppConfig(env map[string]string, bp string, fs map[string][]byte) android.Config {
- return testConfig(env, bp, fs)
-}
-
// testApp runs tests using the javaFixtureFactory
//
// See testJava for an explanation as to how to stop using this deprecated method.
diff --git a/java/java_test.go b/java/java_test.go
index df2dab9..a907c82 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -16,7 +16,6 @@
import (
"fmt"
- "io/ioutil"
"os"
"path/filepath"
"reflect"
@@ -34,25 +33,11 @@
"android/soong/python"
)
-var buildDir string
-
-func setUp() {
- var err error
- buildDir, err = ioutil.TempDir("", "soong_java_test")
- if err != nil {
- panic(err)
- }
-}
-
-func tearDown() {
- os.RemoveAll(buildDir)
-}
-
// Legacy factory to use to create fixtures for tests in this package.
//
// deprecated: See prepareForJavaTest
var javaFixtureFactory = android.NewFixtureFactory(
- &buildDir,
+ nil,
prepareForJavaTest,
)
@@ -80,69 +65,7 @@
)
func TestMain(m *testing.M) {
- run := func() int {
- setUp()
- defer tearDown()
-
- return m.Run()
- }
-
- os.Exit(run())
-}
-
-// testConfig is a legacy way of creating a test Config for testing java modules.
-//
-// See testJava for an explanation as to how to stop using this deprecated method.
-//
-// deprecated
-func testConfig(env map[string]string, bp string, fs map[string][]byte) android.Config {
- return TestConfig(buildDir, env, bp, fs)
-}
-
-// testContext is a legacy way of creating a TestContext for testing java modules.
-//
-// See testJava for an explanation as to how to stop using this deprecated method.
-//
-// deprecated
-func testContext(config android.Config) *android.TestContext {
-
- ctx := android.NewTestArchContext(config)
- RegisterRequiredBuildComponentsForTest(ctx)
- ctx.RegisterModuleType("java_plugin", PluginFactory)
- ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
- ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
- ctx.PreArchMutators(android.RegisterComponentsMutator)
-
- ctx.PostDepsMutators(android.RegisterOverridePostDepsMutators)
- ctx.RegisterPreSingletonType("overlay", OverlaySingletonFactory)
- ctx.RegisterPreSingletonType("sdk_versions", sdkPreSingletonFactory)
-
- android.RegisterPrebuiltMutators(ctx)
-
- genrule.RegisterGenruleBuildComponents(ctx)
-
- // Register module types and mutators from cc needed for JNI testing
- cc.RegisterRequiredBuildComponentsForTest(ctx)
-
- return ctx
-}
-
-// run is a legacy way of running tests of java modules.
-//
-// See testJava for an explanation as to how to stop using this deprecated method.
-//
-// deprecated
-func run(t *testing.T, ctx *android.TestContext, config android.Config) {
- t.Helper()
-
- pathCtx := android.PathContextForTesting(config)
- dexpreopt.SetTestGlobalConfig(config, dexpreopt.GlobalConfigForTests(pathCtx))
-
- ctx.Register()
- _, errs := ctx.ParseBlueprintsFiles("Android.bp")
- android.FailIfErrored(t, errs)
- _, errs = ctx.PrepareBuildActions(config)
- android.FailIfErrored(t, errs)
+ os.Exit(m.Run())
}
// testJavaError is a legacy way of running tests of java modules that expect errors.
@@ -176,28 +99,6 @@
return result.TestContext, result.Config
}
-// runWithErrors is a legacy way of running tests of java modules that expect errors.
-//
-// See testJava for an explanation as to how to stop using this deprecated method.
-//
-// deprecated
-func runWithErrors(t *testing.T, ctx *android.TestContext, config android.Config, pattern string) {
- ctx.Register()
- _, errs := ctx.ParseBlueprintsFiles("Android.bp")
- if len(errs) > 0 {
- android.FailIfNoMatchingErrors(t, pattern, errs)
- return
- }
- _, errs = ctx.PrepareBuildActions(config)
- if len(errs) > 0 {
- android.FailIfNoMatchingErrors(t, pattern, errs)
- return
- }
-
- t.Fatalf("missing expected error %q (0 errors are returned)", pattern)
- return
-}
-
// testJavaWithFS runs tests using the javaFixtureFactory
//
// See testJava for an explanation as to how to stop using this deprecated method.
@@ -226,28 +127,6 @@
return result.TestContext, result.Config
}
-// testJavaWithConfig runs tests using the javaFixtureFactory
-//
-// See testJava for an explanation as to how to stop using this deprecated method.
-//
-// deprecated
-func testJavaWithConfig(t *testing.T, config android.Config) (*android.TestContext, android.Config) {
- t.Helper()
- result := javaFixtureFactory.RunTestWithConfig(t, config)
- return result.TestContext, result.Config
-}
-
-func moduleToPath(name string) string {
- switch {
- case name == `""`:
- return name
- case strings.HasSuffix(name, ".jar"):
- return name
- default:
- return filepath.Join(buildDir, ".intermediates", name, "android_common", "turbine-combined", name+".jar")
- }
-}
-
// defaultModuleToPath constructs a path to the turbine generate jar for a default test module that
// is defined in PrepareForIntegrationTestWithJava
func defaultModuleToPath(name string) string {