diff --git a/res/res.go b/res/res.go index 6f5e5be501c79a302f66a674354adacbcfc9640a..09a0bbd13e9daed9b95320157340d4710da058d4 100644 --- a/res/res.go +++ b/res/res.go @@ -138,7 +138,7 @@ func resResGo() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "res/res.go", size: 12288, mode: os.FileMode(420), modTime: time.Unix(1565242287, 0)} + info := bindataFileInfo{name: "res/res.go", size: 12288, mode: os.FileMode(420), modTime: time.Unix(1565256982, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/src/action/run.go b/src/action/run.go index 2808af9a8dd9e03b7f79180f58e5a8c3bdea0af0..5018f256216ef59cd24d187c46ba1283d4982c03 100644 --- a/src/action/run.go +++ b/src/action/run.go @@ -33,11 +33,11 @@ func Run(scriptDir string, fileNames []string, langType string) { utils.RunDir = utils.PathToRunName(scriptDir) } - var report = model.TestReport{Path: scriptDir, Env: utils.GetOs(), + var report = model.TestReport{Path: utils.Prefer.WorkDir, Env: utils.GetOs(), Pass: 0, Fail: 0, Total: 0, Cases: make([]model.CaseLog, 0)} - biz.ExeScripts(files, scriptDir, langType, &report) + biz.ExeScripts(files, utils.Prefer.WorkDir, langType, &report) - biz.CheckResults(files, scriptDir, langType, &report) - biz.Print(report, scriptDir) + biz.CheckResults(files, utils.Prefer.WorkDir, langType, &report) + biz.Print(report, utils.Prefer.WorkDir) } diff --git a/src/biz/report.go b/src/biz/report.go index 44681a28458336ad07854e9a66bc7e719623ffd9..939a8fec912c06bf69f4df7187d6c4effb0b0280 100644 --- a/src/biz/report.go +++ b/src/biz/report.go @@ -5,7 +5,6 @@ import ( "github.com/easysoft/zentaoatf/src/model" "github.com/easysoft/zentaoatf/src/utils" "github.com/fatih/color" - "os" "strings" "time" ) @@ -73,5 +72,5 @@ func Print(report model.TestReport, workDir string) { } } - utils.WriteFile(workDir+string(os.PathSeparator)+utils.LogDir+utils.RunDir+"result.txt", strings.Join(logs, "\n")) + utils.WriteFile(workDir+utils.LogDir+utils.RunDir+"result.txt", strings.Join(logs, "\n")) } diff --git a/src/test.go b/src/test.go index d6972213f7b3518bef800d6daffe5ad71dc7dc24..d3df8355c22ec15630521e00041f7cbf2d5ff59f 100644 --- a/src/test.go +++ b/src/test.go @@ -2,7 +2,6 @@ package main import ( "fmt" - "github.com/easysoft/zentaoatf/src/utils" ) func main() { @@ -16,6 +15,6 @@ func main() { // //fmt.Println(arr[1]) - a := utils.ConvertWorkDir("/sdf") - fmt.Println(a) + a := "." + fmt.Println(a == ".") } diff --git a/src/utils/file.go b/src/utils/file.go index 72a446ae91d1aac6df5d89b4f7efe93d1bb4732b..c85511df27a83a2e94bb6d5bd5bb6d0d852e3fc5 100644 --- a/src/utils/file.go +++ b/src/utils/file.go @@ -50,7 +50,6 @@ func FileExist(path string) bool { func GetAllFiles(dirPth string, ext string, files *[]string) error { sep := string(os.PathSeparator) - var dirs []string dir, err := ioutil.ReadDir(dirPth) if err != nil { return err @@ -63,7 +62,6 @@ func GetAllFiles(dirPth string, ext string, files *[]string) error { continue } - dirs = append(dirs, dirPth+fi.Name()) GetAllFiles(dirPth+name+sep, ext, files) } else { // 过滤指定格式 diff --git a/src/utils/utils.go b/src/utils/utils.go index 52bf1ab7e4ddcdda4c53e1aac0b1be58f3f14898..e4bcff7d1fdc4fb9dc6e5face898c1e7bcb71893 100644 --- a/src/utils/utils.go +++ b/src/utils/utils.go @@ -124,19 +124,19 @@ func ConvertWorkDir(p string) string { // base on workdir func ConvertRunDir(p string) string { sepa := string(os.PathSeparator) - var temp string + if p == "." { return Prefer.WorkDir } - if IsRelativePath(p) { - temp = Prefer.WorkDir + p - } + //if IsRelativePath(p) { + // temp = Prefer.WorkDir + p + //} if !PathEndWithSeparator(p) { - temp = p + sepa + p = p + sepa } - return temp + return p } func IsRelativePath(path string) bool {