MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / runTest

Method runTest

tools/BoxedWineRunner/src/boxedwine/org/Main.java:154–281  ·  view source on GitHub ↗
(String name, String filesPath, String path, Results results)

Source from the content-addressed store, hash-verified

152 }
153
154 public static void runTest(String name, String filesPath, String path, Results results) throws IOException {
155 File rootPath = new File(path+File.separator+"root");
156 if (rootPath.exists()) {
157 deleteDir(rootPath);
158 }
159 rootPath.mkdir();
160 File copiedFilesPath = new File(path+File.separator+"root"+File.separator+"files");
161 copyFolder(new File(filesPath).toPath(), copiedFilesPath.toPath());
162
163 String[] installLines = getLines(path + File.separator+"Install.txt");
164 String[] installLines2 = getLines(path + File.separator+"Install2.txt");
165 String[] playLines = getLines(path + File.separator+"Play.txt");
166
167 long startTime = System.currentTimeMillis();
168 if (installLines.length>0) {
169 if (installLines.length<2) {
170 throw new IOException(path+File.separator+"Install.txt needs to have 2 lines");
171 }
172 runBoxedWine(name, path, "install", installLines, results);
173 if (results.exitCode!=111) {
174 return;
175 }
176 }
177 if (installLines2.length>0) {
178 if (installLines2.length<2) {
179 throw new IOException(path+File.separator+"Install2.txt needs to have 2 lines");
180 }
181 runBoxedWine(name, path, "install2", installLines2, results);
182 if (results.exitCode!=111) {
183 return;
184 }
185 }
186 String parseFile = null;
187 String parseKey = null;
188
189 if (playLines.length>0) {
190 if (playLines.length<2) {
191 throw new IOException(path+File.separator+"Play.txt needs to have 2 lines");
192 }
193 if (playLines[0].startsWith("PARSE_FILE=")) {
194 parseFile = playLines[0].substring(11);
195 String[] tmp = new String[playLines.length - 1];
196 for (int i=0;i<playLines.length - 1;i++) {
197 tmp[i] = playLines[1+i];
198 }
199 playLines = tmp;
200 }
201 if (playLines[0].startsWith("PARSE_KEY=")) {
202 parseKey = playLines[0].substring(10);
203 String[] tmp = new String[playLines.length - 1];
204 for (int i=0;i<playLines.length - 1;i++) {
205 tmp[i] = playLines[1+i];
206 }
207 playLines = tmp;
208 }
209 runBoxedWine(name, path, "play", playLines, results);
210 }
211 results.timeToComplete = (int)((System.currentTimeMillis()-startTime)/1000);

Callers 1

mainMethod · 0.95

Calls 15

deleteDirMethod · 0.95
copyFolderMethod · 0.95
getLinesMethod · 0.95
runBoxedWineMethod · 0.95
mkdirMethod · 0.80
startsWithMethod · 0.80
getPathMethod · 0.80
isDirectoryMethod · 0.80
valueOfMethod · 0.80
indexOfMethod · 0.80
lengthMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected