helper: Escape test name in TF_LOG_PATH_MASK
This commit is contained in:
parent
a41d5d634d
commit
d39025b9d8
|
@ -382,7 +382,10 @@ func LogOutput(t TestT) (logOutput io.Writer, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if logPathMask := os.Getenv(EnvLogPathMask); logPathMask != "" {
|
if logPathMask := os.Getenv(EnvLogPathMask); logPathMask != "" {
|
||||||
logPath := fmt.Sprintf(logPathMask, t.Name())
|
// Escape special characters which may appear if we have subtests
|
||||||
|
testName := strings.Replace(t.Name(), "/", "__", -1)
|
||||||
|
|
||||||
|
logPath := fmt.Sprintf(logPathMask, testName)
|
||||||
var err error
|
var err error
|
||||||
logOutput, err = os.OpenFile(logPath, syscall.O_CREAT|syscall.O_RDWR|syscall.O_APPEND, 0666)
|
logOutput, err = os.OpenFile(logPath, syscall.O_CREAT|syscall.O_RDWR|syscall.O_APPEND, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue