Code coverage for smoke tests.

Allow non-circle people to build coverage reports.
This commit is contained in:
Tom Wilkie committed 2015-07-10 14:45:14 +00:00
1 parent da41604229
commit 00a7490a1d
12 files changed
+211 -14

No files matched your search

+15
View File
@@ -2,6 +2,7 @@ package testing
import (
"fmt"
"os"
"reflect"
"runtime"
"testing"
@@ -50,3 +51,17 @@ func RunWithTimeout(t *testing.T, d time.Duration, f func()) {
}()
<-ch
}
// TrimTestArgs finds the first -- in os.Args and trim all args before that
func TrimTestArgs() {
i, l := 0, len(os.Args)
for ; i < l; i++ {
if os.Args[i] == "--" {
break
}
}
if i == l {
panic("Specify weave args after --")
}
os.Args = append(os.Args[:1], os.Args[i+1:l]...)
}