-
-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make -lowmem optional and prefer building d_do_test with the host compiler #11519
Conversation
|
Thanks for your pull request, @wilzbach! Bugzilla references
|
149aa35 to
edf1cc8
Compare
|
Interesting ... wasn't |
Yeah, very good point - f9a4e89 |
5be1a02 to
2870019
Compare
It's still the case: |
Yeah, but at that time I've also enabled parallel building of d_do_test unittests + normal executable, which isn't parallelized anymore. |
|
The test failure here is: |
|
@wilzbach The main memory requirement stems from the CTFE done for regex. We could disable it without diff --git a/test/tools/d_do_test.d b/test/tools/d_do_test.d
index aecb61173..14111c8c1 100755
--- a/test/tools/d_do_test.d
+++ b/test/tools/d_do_test.d
@@ -613,13 +613,14 @@ string unifyNewLine(string str)
// On Windows, Outbuffer.writenl() puts `\r\n` into the buffer,
// then fprintf() adds another `\r` when formatting the message.
// This is why there's a match for `\r\r\n` in this regex.
- static re = regex(`\r\r\n|\r\n|\r|\n`, "g");
+ static re = buildRegex(`\r\r\n|\r\n|\r|\n`, "g");
return std.regex.replace(str, re, "\n");
}
string unifyDirSep(string str, string sep)
{
- static re = regex(`(?<=[-\w{}][-\w{}]*)/(?=[-\w][-\w/]*\.(di?|mixin)\b)`, "g");
+ static re = buildRegex(`(?<=[-\w{}][-\w{}]*)/(?=[-\w][-\w/]*\.(di?|mixin)\b)`, "g");
+
return std.regex.replace(str, re, sep);
}
unittest
@@ -1662,3 +1663,26 @@ void printCppSources (in const(char)[][] compiled)
}
}
}
+
+version (LazyRegex)
+{
+ struct buildRegex
+ {
+ string pattern, flags;
+ typeof(regex(pattern, flags)) re = void;
+
+ auto ref getRegex()
+ {
+ if (pattern !is null)
+ {
+ re = regex(pattern, flags);
+ pattern = null;
+ }
+ return re;
+ }
+
+ alias getRegex this;
+ }
+}
+else
+ alias buildRegex = regex;Don't think no-CTFE should be the default because it implies a startup penalty for every invocation of |
AFAICT the I like your approach too and it's definitely the a good fallback if we have to use the regex. |
e4ae971 to
d1eda99
Compare
So it looks like this works for all test suites. It's less elegant than the regular expression, but reduces the memory consumption from 1.5G to 740M (without -lowmem). I kept it rather verbose, s.t. it's easier to understand, but if line-count is an issue, it could be condensed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use Phobos style to keep this code consistent.
Otherwise LGTM.
d1eda99 to
3c404d0
Compare
… with the host compiler
3c404d0 to
28e6d84
Compare
I had another look at this and found a more elegant non-regex approach which should be good enough for this use. Let's see what the CIs say. |
6dc0329 to
9fd02a8
Compare
|
Nice but not enough: -compilable\ddoc_markdown_links_verbose.d(28): Ddoc: found link reference 'dub' to 'https:\\code.dlang.org'
+compilable\ddoc_markdown_links_verbose.d(28): Ddoc: found link reference 'dub' to 'https://code.dlang.org'Maybe add a lookahead to check that the suffix is an actual file extension? |
9fd02a8 to
fbfb001
Compare
Added. Looks like the CIs are happy with it (: |
|
CC @thewilsonator. This is ready and as the d_do_test segfaults keep happening randomly, maybe this can get a bit of priority? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To get the CI working for other PR's.
Not sure if there are other edge cases for unifyDirSep but it should work for dmd's error messages AFAICT.

CC @MoonlightSentinel