Don't panic on "go test" invocations from the command line.
Test: cd build/soong; go test ./android
Bug: 183650682
Change-Id: I2d1bbda21cb262eafc7f7d329206720809399985
diff --git a/android/paths.go b/android/paths.go
index 1278961..b457372 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -1642,16 +1642,10 @@
// Will panic if called from outside a test environment.
func ensureTestOnly() {
- // Normal soong test environment
- if InList("-test.short", os.Args) {
+ if PrefixInList(os.Args, "-test.") {
return
}
- // IntelliJ test environment
- if InList("-test.v", os.Args) {
- return
- }
-
- panic(fmt.Errorf("Not in test\n%s", strings.Join(os.Args, "\n")))
+ panic(fmt.Errorf("Not in test. Command line:\n %s", strings.Join(os.Args, "\n ")))
}
func (p InstallPath) RelativeToTop() Path {