Fix more tests when ANDROID_BUILD_TOP is set
The bpfix code (also used by androidmk) reads the ANDROID_BUILD_TOP environment variable, causing the tests to fail when it is set. Clear it in the bpfix and partner androidmk tests the same way the main androidmk tests do. Test: go test ./... Change-Id: Icc61f2c3ebdbecab34c1d18399c6846db207c6dd
This commit is contained in:
parent
935b4db4cb
commit
7b0975d42f
2 changed files with 10 additions and 0 deletions
|
@ -19,6 +19,7 @@ package bpfix
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -2215,3 +2216,9 @@ func TestRemoveResourceAndAssetsIfDefault(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMain(m *testing.M) {
|
||||||
|
// Skip checking Android.mk path with cleaning "ANDROID_BUILD_TOP"
|
||||||
|
os.Setenv("ANDROID_BUILD_TOP", "")
|
||||||
|
os.Exit(m.Run())
|
||||||
|
}
|
||||||
|
|
|
@ -54,6 +54,9 @@ cc_library_shared {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEndToEnd(t *testing.T) {
|
func TestEndToEnd(t *testing.T) {
|
||||||
|
// Skip checking Android.mk path with cleaning "ANDROID_BUILD_TOP"
|
||||||
|
t.Setenv("ANDROID_BUILD_TOP", "")
|
||||||
|
|
||||||
for i, test := range testCases {
|
for i, test := range testCases {
|
||||||
expected, err := bpfix.Reformat(test.expected)
|
expected, err := bpfix.Reformat(test.expected)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue