Skip to content

Commit 9c4221c

Browse files
committed
Add feature: compile in release mode for exercises with a .meta flag
- Compile in release mode if .meta/test-in-release-mode exists - Add note to README documenting the above feature - Add .meta/test-in-release-mode to alphametics, which is the sore spot for debug-mode tests
1 parent 6e88ca2 commit 9c4221c

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ Note that:
9292
- An exercise may contain `.meta/hints.md`. This is optional and will appear after the normal exercise
9393
instructions if present. Rust is different in many ways from other languages. This is a place where the differences required for Rust are explained. If it is a large change, you may want to call this out as a comment at the top of `src/lib.rs`, so the user recognises to read this section before starting.
9494

95+
- If the test suite is appreciably sped up by running in release mode, and there is reason to be confident that the example implementation does not contain any overflow errors, consider adding a file `.meta/test-in-release-mode`. This should contain brief comments explaining the situation.
96+
9597
- `README.md` may be [regenerated](https://github.com/exercism/docs/blob/master/maintaining-a-track/regenerating-exercise-readmes.md) from Exercism data. The generator will use the `description.md` from the exercise directory in the [problem-specifications repository](https://github.com/exercism/problem-specifications/tree/master/exercises), then any hints in `.meta/hints.md`, then the [Rust-specific instructions](https://github.com/exercism/rust/blob/master/config/exercise-readme-insert.md). The `## Source` section comes from the `metadata.yml` in the same directory. Convention is that the description of the source remains text and the link is both name and hyperlink of the markdown link.
9698

9799
- Be sure to add the exercise to an appropriate place in the `config.json` file. The position in the file determines the order exercises are sent. Generate a unique UUID for the exercise. Current difficuly levels in use are 1, 4, 7 and 10.

_test/check-exercises.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ for exercise in $files; do
3333
# and that the primary module is named the same as the directory
3434
directory=$(dirname "${exercise}");
3535

36+
release=""
37+
if [ -z "$BENCHMARK" -a -f "$directory/.meta/test-in-release-mode" ]; then
38+
release="--release"
39+
fi
40+
3641
if [ -n "$DENYWARNINGS" ]; then
3742
# No-run mode so we see no test output.
3843
# Quiet mode so we see no compile output
@@ -47,7 +52,7 @@ for exercise in $files; do
4752
# the compile time for all exercises, it substantially improves
4853
# the runtime for certain exercises such as alphametics.
4954
# Overall this should be an improvement.
50-
./bin/test-exercise $directory
55+
./bin/test-exercise $directory $release
5156
return_code=$(($return_code | $?))
5257
fi
5358
done
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Takes a very long time to test in debug mode.
2+
Example implementation not known to encounter overflow errors.

0 commit comments

Comments
 (0)