Quickstart

This introduction assumes that there already exists a running camisole server. See Installation to install camisole.

Once the camisole server is running, you can query it with an HTTP client like curl:

$ curl localhost:8080/run -d \
    '{"lang": "python", "source": "print(42)"}'

Result:

{
    "success": true,
    "tests": [
        {
            "exitcode": 0,
            "meta": {
                "cg-mem": 2664,
                "csw-forced": 4,
                "csw-voluntary": 3,
                "exitcode": 0,
                "exitsig": 0,
                "exitsig-message": null,
                "killed": false,
                "max-rss": 7416,
                "message": null,
                "status": "OK",
                "time": 0.017,
                "wall-time": 0.069
            },
            "name": "test000",
            "stderr": "",
            "stdout": "42\n"
        }
    ]
}

You can easily limit, on a global or per-test basis, the maximum execution time (user and wall), the available memory, the number of processes…

Those options are available both for the compilation and the tests.

Input:

{
    "lang": "ocaml",
    "source": "print_string \"Hello, world!\\\\n\"",
    "compile": {
        "wall-time": 10
    },
    "execute": {
        "time": 2,
        "wall-time": 5,
        "processes": 1,
        "mem": 100000
    }
}

Output:

{
    "compile": {
        "exitcode": 0,
        "meta": {
            "cg-mem": 14984,
            "csw-forced": 53,
            "csw-voluntary": 14,
            "exitcode": 0,
            "exitsig": 0,
            "exitsig-message": null,
            "killed": false,
            "max-rss": 15276,
            "message": null,
            "status": "OK",
            "time": 0.122,
            "wall-time": 0.344
        },
        "stderr": "",
        "stdout": ""
    },
    "success": true,
    "tests": [
        {
            "exitcode": 0,
            "meta": {
                "cg-mem": 504,
                "csw-forced": 4,
                "csw-voluntary": 3,
                "exitcode": 0,
                "exitsig": 0,
                "exitsig-message": null,
                "killed": false,
                "max-rss": 1820,
                "message": null,
                "status": "OK",
                "time": 0.002,
                "wall-time": 0.058
            },
            "name": "test000",
            "stderr": "",
            "stdout": "Hello, world!\\n"
        }
    ]
}

You can give a full testsuite with different inputs and constraints, and you will get a separate result for each test:

{
    "lang": "python",
    "source": "print(int(input()) * 2)",
    "tests": [{"name": "test_h2g2", "stdin": "42", "mem": 200000},
              {"name": "test_notfound", "stdin": "404"},
              {"name": "test_leet", "stdin": "1337"},
              {"name": "test_666", "stdin": "27972", "time": 1}]
}

Output:

{
    "success": true,
    "tests": [
        {
            "exitcode": 0,
            "meta": {
                "cg-mem": 2644,
                "csw-forced": 6,
                "csw-voluntary": 3,
                "exitcode": 0,
                "exitsig": 0,
                "exitsig-message": null,
                "killed": false,
                "max-rss": 7612,
                "message": null,
                "status": "OK",
                "time": 0.016,
                "wall-time": 0.05
            },
            "name": "test_h2g2",
            "stderr": "",
            "stdout": "84\n"
        },
        {
            "exitcode": 0,
            "meta": {
                "cg-mem": 2520,
                "csw-forced": 24,
                "csw-voluntary": 2,
                "exitcode": 0,
                "exitsig": 0,
                "exitsig-message": null,
                "killed": false,
                "max-rss": 7448,
                "message": null,
                "status": "OK",
                "time": 0.026,
                "wall-time": 0.072
            },
            "name": "test_notfound",
            "stderr": "",
            "stdout": "808\n"
        },
        {
            "exitcode": 0,
            "meta": {
                "cg-mem": 2520,
                "csw-forced": 4,
                "csw-voluntary": 3,
                "exitcode": 0,
                "exitsig": 0,
                "exitsig-message": null,
                "killed": false,
                "max-rss": 7428,
                "message": null,
                "status": "OK",
                "time": 0.026,
                "wall-time": 0.083
            },
            "name": "test_leet",
            "stderr": "",
            "stdout": "2674\n"
        },
        {
            "exitcode": 0,
            "meta": {
                "cg-mem": 2644,
                "csw-forced": 34,
                "csw-voluntary": 3,
                "exitcode": 0,
                "exitsig": 0,
                "exitsig-message": null,
                "killed": false,
                "max-rss": 7736,
                "message": null,
                "status": "OK",
                "time": 0.029,
                "wall-time": 0.092
            },
            "name": "test_666",
            "stderr": "",
            "stdout": "55944\n"
        }
    ]
}