diff --git a/internal/pkg/consts/consts.go b/internal/pkg/consts/consts.go index 33b265a440a6680d240546845d1af57a6504aa31..47ccca6114fac1026196e0b94f312a3e8d59f478 100644 --- a/internal/pkg/consts/consts.go +++ b/internal/pkg/consts/consts.go @@ -11,8 +11,9 @@ const ( Ip = "127.0.0.1" Port = 8085 - JobTimeoutTime = 60 * 30 - JobRetryTime = 3 + LevelToScanScriptFile = 8 + JobTimeoutTime = 60 * 30 + JobRetryTime = 3 ConfigVersion = "3.0" ConfigDir = "conf" diff --git a/internal/pkg/helper/exec/ztf.go b/internal/pkg/helper/exec/ztf.go index 03e5c4f08b2353fc5caa073faefbd106fb23320b..d1a1b148224bcf6da17cb25a7c0487388210b279 100644 --- a/internal/pkg/helper/exec/ztf.go +++ b/internal/pkg/helper/exec/ztf.go @@ -2,7 +2,6 @@ package execHelper import ( "path" - "path/filepath" "strconv" "time" @@ -26,31 +25,24 @@ import ( ) func ExecCases(ch chan int, testSet serverDomain.TestSet, msg *websocket.Message) (report commDomain.ZtfReport, pathMaxWidth int, err error) { - // if testSet.Cmd != "" { - // err = execCmd(testSet.Cmd, testSet.WorkspacePath) - // if err != nil { - // return - // } - // } - return RunZtf(ch, testSet.WorkspacePath, 0, 0, commConsts.Case, testSet.Cases, msg) } -func execCmd(cmd string, workspacePath string) (err error) { - pth := filepath.Join(workspacePath, ".cmd.tmp") - fileUtils.WriteFile(pth, cmd) - - conf := configHelper.LoadByWorkspacePath(workspacePath) - - stdOutput, errOutput := RunFile(pth, workspacePath, conf, nil, nil) - if errOutput != "" { - logUtils.Infof("failed to exec command '%s' without output %s, err %v.", pth, stdOutput, errOutput) - } else { - logUtils.Infof("exec command '%s' with output %v.", pth, stdOutput) - } - - return -} +//func execCmd(cmd string, workspacePath string) (err error) { +// pth := filepath.Join(workspacePath, ".cmd.tmp") +// fileUtils.WriteFile(pth, cmd) +// +// conf := configHelper.LoadByWorkspacePath(workspacePath) +// +// stdOutput, errOutput := RunFile(pth, workspacePath, conf, nil, nil) +// if errOutput != "" { +// logUtils.Infof("failed to exec command '%s' without output %s, err %v.", pth, stdOutput, errOutput) +// } else { +// logUtils.Infof("exec command '%s' with output %v.", pth, stdOutput) +// } +// +// return +//} func ExecModule(ch chan int, testSet serverDomain.TestSet, msg *websocket.Message) ( report commDomain.ZtfReport, pathMaxWidth int, err error) { diff --git a/internal/pkg/helper/script/asset.go b/internal/pkg/helper/script/asset.go index b4b06529e49c8bf62a7c34a32e25c25326aa5789..55ebf564dacbb474ae1c996d09e1aa209c861c30 100644 --- a/internal/pkg/helper/script/asset.go +++ b/internal/pkg/helper/script/asset.go @@ -138,7 +138,7 @@ func LoadScriptListInDir(path string, files *[]string, level int) error { continue } - if fi.IsDir() && level < 3 { // 目录, 递归遍历 + if fi.IsDir() && level < commConsts.LevelToScanScriptFile { // 目录, 递归遍历 LoadScriptListInDir(path+name+consts.FilePthSep, files, level+1) continue }