Starting with version 0.3.1, a cli for creating an exam boilerplate is available. Simply run examshell with the --new
or -N
:
./examshell --new
- Create a
exams
directory in the root of the application, or launch./examshell -C
- Create a folder that will contain your exam, for example
hello
- In this folder, create a file named
definition.json
. This file will contain all the information necessary for Examshell to know how it works.
Its structure is based on a precise interface, for example:
{
"id": "my_custom_exam",
"dirName": "hello",
"name": {
"en_US": "My exam",
"fr_FR": "Mon examen"
},
"goal": 100,
"time": "3h",
"exercises": [
[
...
],
...
]
}
Let's go into more detail:
id
: the id of your examdirName
: the name of the folder in which your exam is locatedname
: the different names of this one in the different languagesgoal
: the number of points needed by the user to complete your examtime
: the time you want to give the user to complete your exam. Accept daysd
, hoursh
, minutesm
, secondss
(3d 14h 41m 17s
)exercises
: the list containing your exercises. This list contains sub-lists containing your exams. Each sub-list represents a step in your exam. For example two sub-lists represent two steps. In each sub-list, one exam is randomly selected
Let's go into more detail on the definition of an exercise:
{
...
"exercises": [
[
{
"id": "one",
"dir"?: "subdir",
"name": {
"en_US": "one",
"fr_FR": "two"
},
"exponent": 2,
"trace": true,
"allowed_functions": [ "write", "free", "malloc" ],
"moulinette": true,
"leaks": true,
"copy": {
"user": ["hi.png"],
"check": ["test.c"]
}
},
...
],
]
}
id
: the id of your exercise, also represents the name of the folder in which it is locateddir
optional: the name of the folder in which your exercise is locatedname
: the different names of this one in the different languagesexponent
: represents the number of points you want to give to the exercise. For example if your goal is 100 and you want two exercises, the exponent will be 2trace
: the trace will be displayed in case of an errorallowed_functions
: a list of strings representing the names of the functions you want to allow in the codemoulinette
: pass the moulinette on the codeleaks
: check if the program does not leaks or has no file descriptor opencopy
: Represents the list of files of directories that will be copied to the user via the user argument, or during the correction via the check argument. Accept glob string
one
├─ subjects/
│ ├─ en_US
│ ├─ fr_FR
├─ make.bash
An exercise has at least a subjects
folder containing the subjects in several languages, and a file named make.bash
, which will be executed by examshell to check the exercise. You can add all the files and folders you want. These are the files and folders that are accessible via the copy option in the exercise definition.
The first argument ($1) sent to make.bash
is the path to the user's rendering folder, so you can compile his program :
clang -Wall -Werror -Wextra $1/hello/hello.c -o my_exec
During the correction, a bash script named leaks.bash
is copied into the correction folder.
This script as its name indicates will generate logs of valgrind. This one accepts two arguments minimum: first the executable you want to test, second the identifier of your current test (for example if you make 3 tests, you will be able to generate the log 1, 2 and 3). All other arguments will be passed to your program
For exemple:
bash leaks.bash my_exec $ID ...
- To test your exam, simply launch examshell and select your exam from the list. To save time, configure the
config.json
file by specifying your exam ID. - Your exam looks great and you want to add it to examshell ? Open an issue with the exam flag, and you will be in the list of contributors.
- Any questions ? Do not hesitate to ask your questions, I will answer them as soon as possible.