Migrate sdk package to a per test build directory

Bug: 182885307
Test: m nothing
Change-Id: I051f2572ce5e94e2a3a66cf7663797178b7d1506
This commit is contained in:
Paul Duffin 2021-03-18 01:47:31 +00:00
parent 45a4971808
commit abbf63d650
2 changed files with 2 additions and 29 deletions

View File

@ -31,7 +31,7 @@ func TestMain(m *testing.M) {
os.Exit(0)
}
runTestWithBuildDir(m)
os.Exit(m.Run())
}
func TestDepNotInRequiredSdks(t *testing.T) {

View File

@ -16,8 +16,6 @@ package sdk
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"testing"
@ -30,7 +28,7 @@ import (
)
var sdkFixtureFactory = android.NewFixtureFactory(
&buildDir,
nil,
apex.PrepareForTestWithApexBuildComponents,
cc.PrepareForTestWithCcDefaultModules,
genrule.PrepareForTestWithGenRuleBuildComponents,
@ -326,28 +324,3 @@ type snapshotBuildInfo struct {
// The final output zip.
outputZip string
}
var buildDir string
func setUp() {
var err error
buildDir, err = ioutil.TempDir("", "soong_sdk_test")
if err != nil {
panic(err)
}
}
func tearDown() {
_ = os.RemoveAll(buildDir)
}
func runTestWithBuildDir(m *testing.M) {
run := func() int {
setUp()
defer tearDown()
return m.Run()
}
os.Exit(run())
}