Writing a C++ Assignment Configuration

This is a quick-start guide to writing your own C++ Assignment Configuration YAML. Note that this document is by no means comprehensive; The Grader is much more extensible than what is advertised here.

Template

A starting template can be found here. The file will contain a one-liner description of which required option does. Alternatively, an unannotated version can be found here.

The following sections will all use the above template to briefly explain the meaning of each configuration option. Always refer to configuration-specific documents for more details on how to use each stage!

Settings

Full Documentation Here.

The _settings block is used to configure global grading options.

_settings:
  lang: cpp/g++:8
  use_template: FILENAMES
  template:
    - do_not_include.txt
  use_skeleton: true
  use_provided: true
  stage_wait_duration_secs: 10
  cpus: 1.0
  mem_gb: 2.0
  enable_features:
    network: false

Available languages and compilers are explained below. More info about other configuration keys are available in Writing an Assignment Configuration.

lang

This key determines the programming language which this grading pipeline is targeted for.

Certain stages, such as Compile and StdioTest, contain custom language-specific logic. By setting this key, it allows those stages to adapt its execution for the specified language.

The currently supported combinations are:

  • cpp/g++:<gcc_version>
    • Supports any GCC version 8 or above

    • <gcc_version> can be the full version (9.3.0), major+minor version (9.3), or major version only (9)

  • cpp/clang:<clang_version>
    • Supports any clang version 8 or above

Suggested Structure

Here is a minimum suggested structure for setting up the pipeline to grade a C++ assignment:

fileStructureValidation: {}
diffWithSkeleton: {}
compile:
# ...
stdioTest:
# ...
score:
# ...

To include more than one compilation stage, see Multiple Stages of Same Type.

Pre-Grading Stages

Pre-Grading Stages are pipeline stages which are performed before compilation and/or test execution. These stages are generally language-agnostic in nature.

fileStructureValidation

Full Documentation Here.

File Structure Validation is a stage which checks whether files submitted by the students matches the expected list of files that students should submit. If the student submission does not contain certain files, or the student submission contains additional files, this stage will emit a warning for students.

Note that in order to use this stage, _settings.use_template must not be null.

diffWithSkeleton

Full Documentation Here.

Diff With Skeleton is a stage which checks whether students have inadvertently submitted certain files from the skeleton code. If there are any files in the student submission which are identical to those in the skeleton code, this stage will emit a warning for students.

Note that in order to use this stage, _settings.use_skeleton must be true.

Grading Stages

Grading Stages are pipeline stages which are performed to either prepare or execute grading tasks. Some of these stages have the additional ability to be score-generating, i.e. a score can be generated from the stage based on its correctness.

Note that the following sections are not an exhaustive list of all supported stages. Refer to this page for a comprehensive list of supported stages and their configuration.

C++

Make

Full Documentation Here.

Ths Make stage is a stage which invokes GNU Make on Makefile for easier compilation.

Valgrind

Full Documentation Here.

The Valgrind stage is a stage which invokes Valgrind on an executable.

Note that the specification for Valgrind does not contain individual test cases. Instead, the Valgrind configuration is designed to be applied to all test cases within all stdioTest blocks. Fine-grained overrides can be configured using the stdioTest.testCases.valgrind key.

GTest

Full Documentation Here.

The GTest stage is a stage which compiles files containing GTest test cases and executes them.

Post-Grading Stages

Score

Full Documentation Here.

The Score stage performs aggregation on all score-generating stages preceding it.

Note

If this stage is not specified, an overall score will not be generated for submissions.