From 886c7b680928276d7f925d30fc206ca27d9a97d1 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Fri, 9 Dec 2022 15:24:55 +0100 Subject: Add tests and readme --- tests/test_rules/README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/test_rules/README.md (limited to 'tests/test_rules/README.md') diff --git a/tests/test_rules/README.md b/tests/test_rules/README.md new file mode 100644 index 0000000..8ed8f91 --- /dev/null +++ b/tests/test_rules/README.md @@ -0,0 +1,25 @@ +# Test Rules + +This is a test rule that supports building and installing multiple targets with +a given set of rules. For each target, it can be specified whether building it +should fail or succeed. After processing all targets, additional assertions +(list of shell commands) can be run. + +## Setup + +The test rules expect to find the following two bindings: + - `[["@", "test-rules", "", "tree"]]`, which contains a single tree artifact + with the rules to test. + - `[["@", "test-just", "", ""]]`, which contains a single executable artifact + that is the JustBuild binary to use for the tests. + +## Rule `["test_rules", "test_case"]` + +Define a test case for rule tests. + +| Field | Description | +| ----- | ----------- | +| `"name"` | Name of the test (multiple entries are joined). | +| `"targets"` | Target names to build and install. Each target name is prefixed by `"+"` or `"-"`, indicating if the build should fail or not. Targets that build successfully will be installed to a directory named identical to the target name (without the prefix). | +| `"asserts"` | List of commands to execute after all targets were processed. To access artifacts from installed targets, use the corresponding target name as prefix dir (e.g., target `"+foo"` installs to `"./foo/"`). | +| `"data"` | The directory that contains the project with the targets to test. | -- cgit v1.2.3