Remove ioutil.TempDir from each android/soong/android test

android_test.go already sets up a global buildDir, no need to create
one in each test.

Test: All soong tests
Change-Id: Ib85cbf78c604ad3cef64aa00b6bd812a81496e9e
This commit is contained in:
Colin Cross
2019-07-02 11:31:37 -07:00
parent 9d42425f25
commit fa07821d88
3 changed files with 2 additions and 26 deletions

View File

@@ -1,8 +1,6 @@
package android
import (
"io/ioutil"
"os"
"testing"
)
@@ -58,15 +56,9 @@ var packageTests = []struct {
}
func TestPackage(t *testing.T) {
buildDir, err := ioutil.TempDir("", "soong_package_test")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(buildDir)
for _, test := range packageTests {
t.Run(test.name, func(t *testing.T) {
_, errs := testPackage(buildDir, test.fs)
_, errs := testPackage(test.fs)
expectedErrors := test.expectedErrors
if expectedErrors == nil {
@@ -89,7 +81,7 @@ func TestPackage(t *testing.T) {
}
}
func testPackage(buildDir string, fs map[string][]byte) (*TestContext, []error) {
func testPackage(fs map[string][]byte) (*TestContext, []error) {
// Create a new config per test as visibility information is stored in the config.
config := TestArchConfig(buildDir, nil)