-
-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cache the generated test main file: dub_test_root.d
these changes prevent dub from rebuilding a project every time it runs a unittest.
- Loading branch information
Showing
9 changed files
with
87 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Caching of generated unittest runner (dub test) | ||
|
||
For projects without a user-defined unittest configuration `dub test` generates a main file automatically. | ||
This main file is now being cached and won't be regenerated won subsequent runs without file changes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
. $(dirname "${BASH_SOURCE[0]}")/common.sh | ||
cd ${CURR_DIR}/cache-generated-test-config | ||
rm -rf .dub | ||
|
||
${DUB} test --compiler=${DC} | ||
|
||
STAT="stat -c '%Y'" | ||
[[ "$OSTYPE" == "darwin"* ]] && STAT="stat -f '%m' -t '%Y'" | ||
|
||
EXECUTABLE_TIME="$(${STAT} cache-generated-test-config-test-library)" | ||
[ -z "$EXECUTABLE_TIME" ] && die $LINENO 'no EXECUTABLE_TIME was found' | ||
MAIN_TIME="$(${STAT} "$(ls .dub/code/*dub_test_root.d)")" | ||
[ -z "$MAIN_TIME" ] && die $LINENO 'no MAIN_TIME was found' | ||
|
||
${DUB} test --compiler=${DC} | ||
MAIN_FILES_COUNT=$(ls .dub/code/*dub_test_root.d | wc -l) | ||
|
||
[ $MAIN_FILES_COUNT -ne 1 ] && die $LINENO 'DUB generated more then one main file' | ||
[ "$EXECUTABLE_TIME" != "$(${STAT} cache-generated-test-config-test-library)" ] && die $LINENO 'The executable has been rebuilt' | ||
[ "$MAIN_TIME" != "$(${STAT} "$(ls .dub/code/*dub_test_root.d | head -n1)")" ] && die $LINENO 'The test main file has been rebuilt' | ||
|
||
exit 0 |
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name "cache-generated-test-config" | ||
|
||
targetType "staticLibrary" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module test; | ||
|
||
unittest | ||
{ | ||
assert(true); | ||
} |