Skip to content

Update docs to reflect replacement of jinja by gyb #9807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 11 additions & 21 deletions benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Using the Harness Generator
`CMakeLists.txt` and `utils/main.swift` from single and multiple file tests
contained in the directories `single-source` and `multi-source`. It gathers
information about the tests and then generates the files from templates using
jinja2. The motivation for creating this script was to eliminate the need to
`gyb`. The motivation for creating this script was to eliminate the need to
manually add at least three lines to harness files (one to `CMakeLists.txt` and
two to `utils/main.swift`) for every new benchmark added.

Expand All @@ -110,34 +110,23 @@ two to `utils/main.swift`) for every new benchmark added.
Since `CMakeLists.txt` and `utils/main.swift` are now generated from templates,
they should not be directly modified. Work may be lost if the harness is
executed after making changes to derived files. Instead, modifications should
be made to the template files stored in the `scripts/generate_harness`
directory.
be made to the `*.gyb` template files.

### Generating harness files

Start by installing jinja2 if it isn't already installed:

$ sudo easy_install -U jinja2

To generate `CMakeLists.txt` and `utils/main.swift` from test sources, run the
command:

$ scripts/generate_harness/generate_harness.py

**Note:**

Ensure `generate_harness.py` remains in `scripts/generate_harness` as it
modifies files relative to its location instead of the current working
directory.

### Modifying CMakeLists.txt or utils/main.swift

To make changes to `CMakeLists.txt` or `utils/main.swift`, modify the template
files `CMakeLists.txt_template` and `main.swift_template` stored in the
`scripts/generate_harness` directory. These are jinja2 templates, rendered by
jinja2 calls in `generate_harness.py`, so ensure static changes don't interfere
with the template portions. Test changes by regenerating the harness
(*Generating harness files*) and rebuilding the repository with `build-script`.
files `CMakeLists.txt.gyb` and `main.swift.gyb` These are templates, rendered by
`gyb` in `generate_harness.py`, so ensure static changes don't interfere
with the template portions. Test changes by
[regenerating the harness](#generating-harness-files) and rebuilding the
repository with `build-script`.

Adding New Benchmarks
---------------------
Expand All @@ -149,7 +138,8 @@ To add a new single file test:
1. Add a new Swift file (`YourTestNameHere.swift`), built according to
the template below, to the `single-source` directory.
2. Regenerate harness files by following the directions in
*Generating harness files* before committing changes.
[Generating harness files](#generating-harness-files) before committing
changes.

To add a new multiple file test:

Expand All @@ -166,7 +156,8 @@ To add a new multiple file test:
exist in the files.

2. Regenerate harness files by following the directions in
*Generating harness files* before committing changes.
[Generating harness files](#generating-harness-files) before committing
changes.

**Note:**

Expand Down Expand Up @@ -204,4 +195,3 @@ public func run_YourTestNameHere(N: Int) {
# Assert with CheckResults that work was done
}
```