Skip to content

Commit acee1d7

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 - Remove now-irrelevant comment about release mode in initial BENCHMARK condition
1 parent 4ab7844 commit acee1d7

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ fi
2121
# $ BENCHMARK=1 rustup run nightly _test/check-exercises.sh
2222
if [ -n "$BENCHMARK" ]; then
2323
files=exercises/*/benches
24-
# cargo bench --release is an invalid command
2524
else
2625
files=exercises/*/tests
2726
fi
@@ -34,6 +33,11 @@ for exercise in $files; do
3433
# and that the primary module is named the same as the directory
3534
directory=$(dirname "${exercise}");
3635

36+
release=""
37+
if [ -z "$BENCHMARK" -a -f "$directory/.meta/test-in-release-mode" ]; then
38+
release="--release"
39+
fi
40+
3741
if [ -n "$DENYWARNINGS" ]; then
3842
# No-run mode so we see no test output.
3943
# Quiet mode so we see no compile output
@@ -48,11 +52,9 @@ for exercise in $files; do
4852
# the compile time for all exercises, it substantially improves
4953
# the runtime for certain exercises such as alphametics.
5054
# Overall this should be an improvement.
51-
./bin/test-exercise $directory
55+
./bin/test-exercise $directory $release
5256
return_code=$(($return_code | $?))
5357
fi
54-
# as the test-exercise command is the last one run in all cases,
55-
# its exit code is preserved automatically
5658
done
5759

5860
exit $return_code
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)