25
25
public class MakefileExerciseRunner extends AbstractExerciseRunner {
26
26
27
27
private static final Logger log = Logger .getLogger (MakefileExerciseRunner .class .getName ());
28
-
28
+
29
29
@ Override
30
30
public Callable <Optional <TestRunResult >> getTestRunningTask (final TmcProjectInfo projectInfo ) {
31
- return new Callable < Optional < TestRunResult >>() {
31
+ final InputOutput io = IOProvider . getDefault (). getIO ( projectInfo . getProjectName (), false );
32
32
33
+ return new Callable <Optional <TestRunResult >>() {
33
34
@ Override
34
35
public Optional <TestRunResult > call () throws Exception {
35
36
log .log (Level .INFO , "Compiling project {0}" , projectInfo .getProjectName ());
36
37
Project project = projectInfo .getProject ();
37
38
FileObject makeFile = project .getProjectDirectory ().getFileObject ("Makefile" );
38
-
39
+
39
40
if (makeFile == null ) {
40
41
log .log (INFO , "Project has no Makefile" );
41
42
return Optional .absent ();
42
43
}
43
-
44
+
44
45
File workDir = projectInfo .getProjectDirAsFile ();
45
46
String [] command = {"make" , "test" };
46
-
47
- final InputOutput io = IOProvider .getDefault ().getIO (projectInfo .getProjectName (), false );
47
+
48
48
final ProcessRunner runner = new ProcessRunner (command , workDir , io );
49
-
49
+
50
50
try {
51
51
ProcessResult result = runner .call ();
52
52
int ret = result .statusCode ;
@@ -65,7 +65,7 @@ public Optional<TestRunResult> call() throws Exception {
65
65
}
66
66
};
67
67
}
68
-
68
+
69
69
// TODO: use make
70
70
private TestRunResult runTests (final TmcProjectInfo projectInfo , final boolean withValgrind ) throws Exception {
71
71
log .log (INFO , "Running tests {0}" , projectInfo .getProjectName ());
@@ -115,4 +115,4 @@ private TestRunResult runTests(final TmcProjectInfo projectInfo, final boolean w
115
115
return resultParser .parseCTestResults (resultsFile , valgrindLog , null );
116
116
}
117
117
}
118
- }
118
+ }
0 commit comments