Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update examples for new validator library
- Loading branch information
Showing
16 changed files
with
161 additions
and
464 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <stdio.h> | ||
|
||
int main(int argc, char** argv) { | ||
printf("Hello World\n"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
''' | ||
Example for an OpenSubmit validator. | ||
Install opensubmit-exec and try it out: | ||
opensubmit-exec test examples/helloworld/ | ||
When something goes wrong, an exception is generated by | ||
the functions below. The root cause for this exception, | ||
such as timeout or unsuccessful compilation, | ||
is reported to the student. | ||
When no exception occured until the end of validate(), | ||
a positive feedback is sent. | ||
''' | ||
|
||
def validate(job): | ||
# Build the input files provided by the student | ||
# with GCC, and generate an output file 'helloworld'. | ||
job.run_build(inputs=['helloworld.c'], output='helloworld') | ||
|
||
# Run the compilation result. | ||
job.run_program('./helloworld') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <stdio.h> | ||
|
||
int main(int argc, char** argv) { | ||
// Semikolon is missing | ||
printf("Hello World\n") | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
''' | ||
Example for an OpenSubmit validator. | ||
Install opensubmit-exec and try it out: | ||
opensubmit-exec test examples/helloworld_broken/ | ||
When something goes wrong, an exception is generated by | ||
the functions below. The root cause for this exception, | ||
such as timeout or unsuccessful compilation, | ||
is reported to the student. | ||
When no exception occured until the end of validate(), | ||
a positive feedback is sent. | ||
''' | ||
|
||
def validate(job): | ||
# Build the input files provided by the student | ||
# with GCC, and generate an output file 'helloworld'. | ||
job.run_build(inputs=['helloworld.c'], output='helloworld') | ||
|
||
# Run the compilation result. | ||
job.run_program('./helloworld') |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.