-
-
Notifications
You must be signed in to change notification settings - Fork 707
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
Allow @betterC tests in Phobos #6645
Conversation
Thanks for your pull request, @wilzbach! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + phobos#6645" |
I guess having a separate folder is good primary for integration tests or test code that doesn't fit into any particular |
@@ -73,7 +73,7 @@ setup_repos() | |||
git checkout -f FETCH_HEAD | |||
fi | |||
|
|||
for proj in dmd druntime ; do | |||
for proj in dmd druntime tools ; do |
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.
The auto-tester and other CI behave like this already anyhow.
(Also locking tools to a specific version was done initially because it seemed as a good idea at the time, but in practice it just made updates more annoying.)
################################################################################ | ||
|
||
betterc-phobos-tests: $(addsuffix .betterc,$(D_MODULES)) | ||
betterc: betterc-phobos-tests betterc-run-tests |
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.
We could add an alias betterC: betterc
if wanted.
posix.mak
Outdated
-defaultlib= -debuglib= $(LINKDL) $< | ||
./$(ROOT)/unittest/betterC/$(notdir $(basename $<)) | ||
|
||
betterc-run-tests: $(subst .d,.run,$(wildcard test/betterC/*.d)) |
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.
There's probably not much value in keeping these separate tests anymore as @betterC
is almost as powerful and we avoid lots of redundant declarations.
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.
Yep, I'm ok with removing this target.
@@ -116,7 +118,7 @@ if (isExpressionTuple!values) | |||
} | |||
|
|||
/// | |||
@safe unittest | |||
@safe @betterC unittest |
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.
This won't be displayed on dlang.org yet, but the next step would be to figure out how to get Ddoc / Ddox to do so.
(it will be a lot easier for Ddox though.)
66f1585
to
35a2d0d
Compare
Yep, but do we have examples where we would actually need to do this for Phobos? |
35a2d0d
to
789b245
Compare
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.
LGTM, feel free to zero in on the details in review. Thanks Seb!
789b245
to
f6dd1e8
Compare
With dlang/tools#357 merged, this should be green now :) |
f6dd1e8
to
a9cecac
Compare
std/internal/attributes.d
Outdated
@@ -0,0 +1,4 @@ | |||
module std.internal.attributes; | |||
|
|||
// Internal attributes to be to e.g. annotate unittest blocks |
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.
What does this attribute mean? That it only works with betterC, or that it works with regular D or betterC?
@WalterBright, the intention is similar to other languages attributes like |
std/internal/attributes.d
Outdated
@@ -0,0 +1,4 @@ | |||
module std.internal.attributes; | |||
|
|||
// Internal attributes to be to e.g. annotate unittest blocks |
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.
/**
Used to annotate `unittest`s which need to be tested in a `-betterC` environment.
Such `unittest`s will be compiled and executed without linking druntime in, with a
`__traits(getUnitTests, mixin(__MODULE__))` style test runner.
Note that just like any other `unittest` in phobos, they will also be compiled and executed
without `-betterC`.
*/
package(std) enum betterC = 1;
posix.mak
Outdated
test/betterC/%.run: test/betterC/%.d $(DMD) $(LIB) | ||
mkdir -p $(ROOT)/unittest/betterC | ||
$(DMD) $(DFLAGS) -of$(ROOT)/unittest/betterC/$(notdir $(basename $<)) -betterC $(UDFLAGS) \ | ||
-defaultlib= -debuglib= $(LINKDL) $< |
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.
-defaultlib= -debuglib=
-> $(NODEFAULTLIB)
posix.mak
Outdated
-defaultlib= -debuglib= $(LINKDL) $< | ||
./$(ROOT)/unittest/betterC/$(notdir $(basename $<)) | ||
|
||
betterc-run-tests: $(subst .d,.run,$(wildcard test/betterC/*.d)) |
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.
Yep, I'm ok with removing this target.
posix.mak
Outdated
DUB_PATH=$(abspath $(shell which $(DUB))) | ||
ifeq (,$(DUB_PATH)) | ||
DUB_PATH=$(DUB_DIR)/bin/dub | ||
DUB=$(DUB_DIR)/bin/dub |
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.
DUB=$(DUB_PATH)
?
posix.mak
Outdated
endif | ||
|
||
$(DUB): | $(DUB_DIR) $(LIB) | ||
cd $(DUB_DIR) && DFLAGS="$(DFLAGS) $(LIB) $(NODEFAULTLIB) $(LINKDL)" DMD=$${PWD}/$(DMD) ./build.sh |
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.
Why is $(NODEFAULTLIB)
necessary here?
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.
Ah, I guess because you want to use the version of druntime and phobos that were just built.
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.
Well, I have to build dub
from source, because auto-tester doesn't come with a dub
version (kinda silly) and also no globally installed dmd (HOST_DMD
is only exposed when building dmd and my PR to fix that has remained unanswered: braddr/at-client#9).
dcf15af
to
28e322c
Compare
28e322c
to
fda5cba
Compare
This is sadly blocked until I figure out a reliable way to use or build |
fda5cba
to
8628390
Compare
Ah well, I want to start adding |
39ed40e
to
4fded99
Compare
4fded99
to
eb777d5
Compare
Buildkite for now.
With #6669 and dlang/ci#287 merged, Buildkite will now run the |
$(NODEFAULTLIB) $(LINKDL) $< | ||
./$(ROOT)/unittest/betterC/$(notdir $(basename $<)) | ||
|
||
betterc-run-tests: $(subst .d,.run,$(wildcard test/betterC/*.d)) |
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.
As mentioned in earlier discussions, there's no real need to for these separate betterC
tests anymore and I would be ok with removing them either in this PR or a follow-up.
Open questions:
test/betterC
folder? (the @BetterC test extraction is imho a better replacement)Requires: dlang/tools#357