Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions changelog/dustmite-timeout.dd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Added `--timeout` option to `dub dustmite` command.

Adds a timeout (in seconds) for each oracle invocation, preventing
the dustmite process from hanging indefinitely when the test command
does not terminate. Requires the `timeout` command to be available
(coreutils on Linux/macOS).
1 change: 1 addition & 0 deletions scripts/fish-completion/dub.fish
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ for cmd in dustmite
complete -c dub -n "contains '$cmd' (commandline -poc)" -l program-status -x -d "Expected program status code"
complete -c dub -n "contains '$cmd' (commandline -poc)" -l program-regex -x -d "Program output regular expression"
complete -c dub -n "contains '$cmd' (commandline -poc)" -l test-package -x -d "Perform a test run"
complete -c dub -n "contains '$cmd' (commandline -poc)" -l timeout -x -d "Timeout for each oracle invocation in seconds"
end

for cmd in fetch remove
Expand Down
1 change: 1 addition & 0 deletions scripts/zsh-completion/_dub
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ _dub_dustmite() {
'--linker-regex=[A regular expression used to match against the linker output]:regex: '
'--program-status=[The expected status code of the built executable]:status code: '
'--program-regex=[A regular expression used to match against the program output]:regex: '
'--timeout=[Timeout for each oracle invocation in seconds]:seconds: '
'--[End of dub arguments, the following will be sent to the program]'
)

Expand Down
4 changes: 4 additions & 0 deletions source/dub/commandline.d
Original file line number Diff line number Diff line change
Expand Up @@ -2726,6 +2726,7 @@ class DustmiteCommand : PackageBuildCommand {
string m_strategy;
uint m_jobCount; // zero means not specified
bool m_trace;
uint m_timeout; // in seconds, zero means not specified
}

this() @safe pure nothrow
Expand Down Expand Up @@ -2757,6 +2758,7 @@ class DustmiteCommand : PackageBuildCommand {
args.getopt("strategy", &m_strategy, ["Set strategy (careful/lookback/pingpong/indepth/inbreadth)"]);
args.getopt("j", &m_jobCount, ["Set number of look-ahead processes"]);
args.getopt("trace", &m_trace, ["Save all attempted reductions to DIR.trace"]);
args.getopt("timeout", &m_timeout, ["Timeout for each oracle invocation in seconds"]);
super.prepare(args);

// speed up loading when in test mode
Expand Down Expand Up @@ -2875,6 +2877,8 @@ class DustmiteCommand : PackageBuildCommand {

logInfo("Starting", Color.light_green, "Executing dustmite...");
auto testcmd = appender!string();
if (m_timeout)
testcmd.formattedWrite("timeout %s ", m_timeout);
testcmd.formattedWrite("%s dustmite --test-package=%s --build=%s --config=%s",
std.file.thisExePath, prj.name, this.baseSettings.buildType, this.baseSettings.config);

Expand Down
2 changes: 1 addition & 1 deletion test/dustmite-no-redirect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ LOG="$DM_TEST.log"

rm -rf $DM_TMP $DM_TMP.*

$DUB --root=$DM_TEST dustmite --no-redirect --program-status=1 $DM_TMP &> $LOG || true
$DUB --root=$DM_TEST dustmite --no-redirect --program-status=1 --timeout=60 $DM_TMP &> $LOG || true

if ! grep -q "$EXPECTED" "$LOG"
then
Expand Down
Loading