diff options
author | Fabricio Voznika <fvoznika@google.com> | 2020-04-17 13:27:35 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-04-17 13:28:54 -0700 |
commit | a80cd4302337f1c3a807e127f5a6edc2f014f431 (patch) | |
tree | 488d12600f1bd1d20cd236846597f5e6c5f5aca5 /runsc/testutil/testutil.go | |
parent | 80deebb0bfde2a53c943deb8d8473239bb6de3eb (diff) |
Add test name to boot and gofer log files
This is to make easier to find corresponding logs in
case test fails.
PiperOrigin-RevId: 307104283
Diffstat (limited to 'runsc/testutil/testutil.go')
-rw-r--r-- | runsc/testutil/testutil.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/runsc/testutil/testutil.go b/runsc/testutil/testutil.go index 51e487715..5e09f8f16 100644 --- a/runsc/testutil/testutil.go +++ b/runsc/testutil/testutil.go @@ -31,11 +31,13 @@ import ( "os" "os/exec" "os/signal" + "path" "path/filepath" "strconv" "strings" "sync/atomic" "syscall" + "testing" "time" "github.com/cenkalti/backoff" @@ -81,17 +83,16 @@ func ConfigureExePath() error { // TestConfig returns the default configuration to use in tests. Note that // 'RootDir' must be set by caller if required. -func TestConfig() *boot.Config { +func TestConfig(t *testing.T) *boot.Config { logDir := "" if dir, ok := os.LookupEnv("TEST_UNDECLARED_OUTPUTS_DIR"); ok { logDir = dir + "/" } return &boot.Config{ Debug: true, - DebugLog: logDir, + DebugLog: path.Join(logDir, "runsc.log."+t.Name()+".%TIMESTAMP%.%COMMAND%"), LogFormat: "text", DebugLogFormat: "text", - AlsoLogToStderr: true, LogPackets: true, Network: boot.NetworkNone, Strace: true, |