Merge "Migrate sdk package to a per test build directory"
This commit is contained in:
@@ -31,7 +31,7 @@ func TestMain(m *testing.M) {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
runTestWithBuildDir(m)
|
os.Exit(m.Run())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDepNotInRequiredSdks(t *testing.T) {
|
func TestDepNotInRequiredSdks(t *testing.T) {
|
||||||
|
@@ -16,8 +16,6 @@ package sdk
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -30,7 +28,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var sdkFixtureFactory = android.NewFixtureFactory(
|
var sdkFixtureFactory = android.NewFixtureFactory(
|
||||||
&buildDir,
|
nil,
|
||||||
apex.PrepareForTestWithApexBuildComponents,
|
apex.PrepareForTestWithApexBuildComponents,
|
||||||
cc.PrepareForTestWithCcDefaultModules,
|
cc.PrepareForTestWithCcDefaultModules,
|
||||||
genrule.PrepareForTestWithGenRuleBuildComponents,
|
genrule.PrepareForTestWithGenRuleBuildComponents,
|
||||||
@@ -326,28 +324,3 @@ type snapshotBuildInfo struct {
|
|||||||
// The final output zip.
|
// The final output zip.
|
||||||
outputZip string
|
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())
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user