Skip to content

Commit 857156d

Browse files
authored
Merge pull request #3492 from ntrel/runnable-race
Fix possible data race with runnable example tester Signed-off-by: Dennis <[email protected]> Merged-on-behalf-of: Dennis <[email protected]>
2 parents c0dc37a + 3ee5dfb commit 857156d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/dspec_tester.d

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ int main(string[] args)
9696
const rootDir = __FILE_FULL_PATH__.dirName.dirName;
9797
const specDir = rootDir.buildPath("spec");
9898
const stdDir = rootDir.buildPath("..", "phobos", "std");
99-
bool hasFailed;
10099

101100
config.dmdBinPath = environment.get("DMD", "dmd");
102101
auto helpInformation = getopt(
@@ -122,6 +121,7 @@ int main(string[] args)
122121
];
123122
auto files = chain(specDir.dirEntries("*.dd", SpanMode.depth),
124123
stdDir.dirEntries("*.d", SpanMode.depth));
124+
shared bool hasFailed;
125125
foreach (file; files.parallel(1))
126126
{
127127
// auto-import current module if in phobos
@@ -143,9 +143,10 @@ int main(string[] args)
143143
.joiner;
144144
if (!allTests.empty)
145145
{
146+
import core.atomic;
146147
writefln("%s: %d examples found", file[rootDir.length+1..$], allTests.walkLength);
147148
if (allTests.any!(a => a != 0))
148-
hasFailed = true;
149+
atomicStore(hasFailed, true);
149150
}
150151
}
151152
return hasFailed;

0 commit comments

Comments
 (0)