gvisor/test: create a per-testcase directory for runsc logs

Otherwise it's hard to find a directory for a specific test case.

PiperOrigin-RevId: 252636901
This commit is contained in:
Andrei Vagin
2019-06-11 09:38:07 -07:00
committed by Shentubot
parent 74e397e39a
commit 307a9854ed
+5 -1
View File
@@ -200,7 +200,11 @@ func runTestCaseRunsc(testBin string, tc gtest.TestCase, t *testing.T) {
args = append(args, "-strace")
}
if outDir, ok := syscall.Getenv("TEST_UNDECLARED_OUTPUTS_DIR"); ok {
debugLogDir, err := ioutil.TempDir(outDir, "runsc")
tdir := filepath.Join(outDir, strings.Replace(tc.FullName(), "/", "_", -1))
if err := os.MkdirAll(tdir, 0755); err != nil {
t.Fatalf("could not create test dir: %v", err)
}
debugLogDir, err := ioutil.TempDir(tdir, "runsc")
if err != nil {
t.Fatalf("could not create temp dir: %v", err)
}