(test Test)
| 93 | } |
| 94 | |
| 95 | func TestFrame(test Test) { |
| 96 | |
| 97 | var killCommand string |
| 98 | app := GetApp(test.TargetID) |
| 99 | |
| 100 | if !test.NoBuild { |
| 101 | // attempt to |
| 102 | log.Println("Attempting to kill any previous processes.") |
| 103 | |
| 104 | if !isWindows { |
| 105 | killCommand = fmt.Sprintf("killall -3 %s-cleo", test.ID) |
| 106 | } else { |
| 107 | killCommand = fmt.Sprintf("taskkill /f /im %s-cleo.exe", test.ID) |
| 108 | } |
| 109 | core.RunCmd(killCommand) |
| 110 | |
| 111 | pathtemp := filepath.Join(dfd, "src", app.Path) |
| 112 | pkgpath := strings.Split(pathtemp, "/") |
| 113 | pkgpath = append(pkgpath, Utilname) |
| 114 | if app.FetchOntest { |
| 115 | core.RunCmd(fmt.Sprintf("go get -u %s", app.Path)) |
| 116 | } |
| 117 | os.Remove(filepath.Join(cleoWorkspace, fmt.Sprintf("%s-cleo", test.ID))) |
| 118 | os.Remove(filepath.Join(cleoWorkspace, fmt.Sprintf("%s.test", test.ID))) |
| 119 | |
| 120 | var pathToUtil string |
| 121 | |
| 122 | if !isWindows { |
| 123 | pathToUtil = fmt.Sprintf("/%s", filepath.Join(pkgpath...)) |
| 124 | } else { |
| 125 | pathToUtil = fmt.Sprintf("%s", filepath.Join(pkgpath...)) |
| 126 | } |
| 127 | |
| 128 | defer os.Remove(pathToUtil) |
| 129 | |
| 130 | err := ioutil.WriteFile(pathToUtil, CleoUtil, 0700) |
| 131 | if err != nil { |
| 132 | test.Working = false |
| 133 | test.Finished = true |
| 134 | test.End = time.Now() |
| 135 | |
| 136 | AlertSys(true, "Error during setup of application.", time.Now(), test) |
| 137 | return |
| 138 | } |
| 139 | |
| 140 | var dotExe string |
| 141 | if isWindows { |
| 142 | dotExe = ".exe" |
| 143 | } |
| 144 | logd, err := core.RunCmdSmart(fmt.Sprintf("go build -o %s-cleo%s %s", filepath.Join(cleoWorkspace, test.ID), dotExe ,app.Path)) |
| 145 | |
| 146 | if err != nil { |
| 147 | test.Working = false |
| 148 | test.Finished = true |
| 149 | test.End = time.Now() |
| 150 | AlertSys(true, fmt.Sprintf("Error installing web application. Log : %s", logd), time.Now(),test) |
| 151 | return |
| 152 | } |
no test coverage detected