mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Forward verbose flag to packetimpact tester
Forwards the testing verbose flag to the packetimpact test runner. This is necessary for debugging inside packetimpact tests. When this flag is present, all t.Logs in the packetimpact test wil be shown in the resulting test output. PiperOrigin-RevId: 377614550
This commit is contained in:
@@ -363,6 +363,9 @@ func TestWithDUT(ctx context.Context, t *testing.T, mkDevice func(*dockerutil.Co
|
||||
// and receives packets and also sends POSIX socket commands to the
|
||||
// posix_server to be executed on the DUT.
|
||||
testArgs := []string{containerTestbenchBinary}
|
||||
if testing.Verbose() {
|
||||
testArgs = append(testArgs, "-test.v")
|
||||
}
|
||||
testArgs = append(testArgs, extraTestArgs...)
|
||||
testArgs = append(testArgs,
|
||||
fmt.Sprintf("--native=%t", native),
|
||||
@@ -395,6 +398,8 @@ func TestWithDUT(ctx context.Context, t *testing.T, mkDevice func(*dockerutil.Co
|
||||
} else if expectFailure {
|
||||
t.Logf(`test failed as expected: %v
|
||||
%s`, err, testLogs)
|
||||
} else if testing.Verbose() {
|
||||
t.Log(testLogs)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -132,6 +132,7 @@ func registerFlags(fs *flag.FlagSet) {
|
||||
// Initialize initializes the testbench, it parse the flags and sets up the
|
||||
// pool of test networks for testbench's later use.
|
||||
func Initialize(fs *flag.FlagSet) {
|
||||
testing.Init()
|
||||
registerFlags(fs)
|
||||
flag.Parse()
|
||||
if err := loadDUTInfos(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user