Convert DUB package test into a Makefile test and run it with the proper compiler flags#6999
Convert DUB package test into a Makefile test and run it with the proper compiler flags#6999wilzbach wants to merge 1 commit intodlang:masterfrom
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. |
test/Makefile
Outdated
There was a problem hiding this comment.
CC @RazvanN7 - we really need to get this migration finished...
test/Makefile
Outdated
There was a problem hiding this comment.
--root didn't work & we should get Travis green ASAP:
> DFLAGS="-m64" dub test --compiler=/home/seb/dlang/dmd/generated/linux/release/64/dmd --force --root=/home/seb/dlang/dmd/test/dub_package
DFLAGS="-m64" dub test --compiler=/home/seb/dlang/dmd/generated/linux/release/64/dmd --force --root=/home/seb/dlang/dmd/test/dub_package
Failed to invoke the compiler /home/seb/dlang/dmd/generated/linux/release/64/dmd to determine the build platform: {
/tmp/dub_platform_probe-b1b52c05-da2e-4097-892b-89a1507f1d3a.d(86): Error: undefined identifier `string`
/tmp/dub_platform_probe-b1b52c05-da2e-4097-892b-89a1507f1d3a.d(7): while evaluating pragma(msg, " \"compiler\": \"" ~ determineCompiler() ~ "\",")
"frontendVersion": 2075,
"compilerVendor": "Digital Mars D",
"platform": [
/tmp/dub_platform_probe-b1b52c05-da2e-4097-892b-89a1507f1d3a.d(18): Error: undefined identifier `string`
/tmp/dub_platform_probe-b1b52c05-da2e-4097-892b-89a1507f1d3a.d(11): while evaluating pragma(msg, " " ~ determinePlatform())
],
"architecture": [
/tmp/dub_platform_probe-b1b52c05-da2e-4097-892b-89a1507f1d3a.d(43): Error: undefined identifier `string`
/tmp/dub_platform_probe-b1b52c05-da2e-4097-892b-89a1507f1d3a.d(14): while evaluating pragma(msg, " " ~ determineArchitecture())
],
}
There was a problem hiding this comment.
Also I decided to avoid overwriting the DFLAGS as the -fPIC by default is lost then.
travis.sh
Outdated
There was a problem hiding this comment.
I didn't add test_dub to the default all target as it would then by run on the auto-tester as well. While we do want to test this on the long run, I wasn't sure whether dub is available on the auto-tester, so I left testing this open for another PR.
There was a problem hiding this comment.
Yeah, that's why I only added it to the Travis CI tests from the beginning.
|
CC @CyberShadow @andralex |
| export RESULTS_DIR=test_results | ||
| export MODEL | ||
| export REQUIRED_ARGS= | ||
| BUILD=release |
There was a problem hiding this comment.
Yep, I had to do quite a few try to figure out a working setup and in the one you reviewed I temporarily removed the new changes with $(BUILD)
863c4f7 to
9cb8b85
Compare
0d09528 to
2d5eba5
Compare
| else | ||
| REAL_MODEL=64 | ||
| endif | ||
| export DMD=../generated/$(OS)/$(BUILD)/$(REAL_MODEL)/dmd |
There was a problem hiding this comment.
I already bumped into this before: #6870
This is required as dub doesn't forward the -L-L DFLAGS to the linker (in this case dmd again) and thus we need the dmd.conf, which isn't generated for src/dmd by default anymore.
Linking...
/home/seb/dlang/dmd/generated/linux/release/64/dmd -of.dub/build/application-$DFLAGS-linux.posix-x86_64-dmd_2075-1833BAD8BC30CEBFE35D7CC6DA0FFC50/dmd-dub-test .dub/build/application-$DFLAGS-linux.posix-x86_64-dmd_2075-1833BAD8BC30CEBFE35D7CC6DA0FFC50/dmd-dub-test.o ../../.dub/build/library-$DFLAGS-linux.posix-x86_64-dmd_2075-3768A66D24D1220DBE5011CA9AC1DEA7/libdmd_parser.a ../../.dub/build/library-$DFLAGS-linux.posix-x86_64-dmd_2075-00BFCF605E8D9C274B8361919B5DB43D/libdmd_lexer.a ../../.dub/build/library-$DFLAGS-linux.posix-x86_64-dmd_2075-831C9FFAA175BCEDD4C554013935344A/libdmd_root.a -L--no-as-needed -m64 -defaultlib=libphobos2.so
Copying target from /home/seb/dlang/dmd/test/dub_package/.dub/build/application-$DFLAGS-linux.posix-x86_64-dmd_2075-1833BAD8BC30CEBFE35D7CC6DA0FFC50/dmd-dub-test to /home/seb/dlang/dmd/test/dub_package
Running ./dmd-dub-test
./dmd-dub-test: error while loading shared libraries: libphobos2.so.0.75: cannot open shared object file: No such file or directory
There was a problem hiding this comment.
Wait, so you want to build the Dub library with the built DMD, not the host DMD?
I guess testing that the compiler can auto-bootstrap is interesting, but wouldn't it be easier and more consistent to use the host DMD? Or is that difficult because only dmd's posix.mak knows what it is?
There was a problem hiding this comment.
to use the host DMD
We should test both, but this entire issue exits because gdc's fronted is too old and has bugs.
There was a problem hiding this comment.
As the goal is to check whether the dub package recipe works we should just use the host compiler and avoid additional complications.
|
@CyberShadow instead of discussing in length the hypothetical problem of bootstrapping with an unsecure host, could we maybe move our focus to the fact that Travis is broken on master? I already had quite some "fun" with the Makefiles and auto-tester here, but I think I finally found a setup that's working and testing the DUB package properly. |
|
Sorry Sebastian, I'm currently dealing with a broken dev box at home and replying to emails is all I can do, and this looks like I'd need to sit down and wrap my head around this change to review it properly. If you'd like to submit a PR that simply disables the broken test for now I could merge that now, or someone else could look at this instead. |
|
You could of course also revert the bad PR instead of trying to rush in a fix. |
Didn't know that. If it's related to
Sounds like a good idea: #7001
Nay, I like DUB support too much for this ;-) |
No, actually, @Earnestly on #archlinux let me know of a simple workaround. Just create a #!/bin/bash
set -eu
next=/usr/sbin/$(basename "$0")
for arg in "$@"
do
if [[ "$arg" == -L$HOME/data/software/dmd/* || "$arg" == -L$HOME/opt/dmd/* ]]
then
exec "$next" -no-pie "$@"
fi
done
exec "$next" "$@"Add/symlink this to |
| else | ||
| export ARGS=-inline -release -g -O -fPIC | ||
| export DMD=../src/dmd | ||
| # hack around the fact that on auto-tester MODEL isn't set for the testsuite |
There was a problem hiding this comment.
That doesn't sound right.
https://github.com/braddr/at-client/blob/master/src/do_test_dmd.sh#L33-L37
There's certainly a MODEL parameter there.
Generally, if things can be fixed in the AT scripts, they should be. I think Brad has generally been responsive in merging AT pull requests as long as they don't require more involved things like merging some pull requests simultaneously or manually updating test machines.
There was a problem hiding this comment.
As mentioned I have bumped into this before: #6870
And no I don't think that we want to wait for another one or two months here. If this gets fixed at the auto-tester's side, the workaround can easily be removed.
There was a problem hiding this comment.
Yes that looks wrong, osmodel.mak will already determine a default MODEL, unless one is explicity specified via make MODEL=64. Not sure what fails for you, but you can use $(error ${MODEL}) to inspect variables.
| else | ||
| REAL_MODEL=64 | ||
| endif | ||
| export DMD=../generated/$(OS)/$(BUILD)/$(REAL_MODEL)/dmd |
There was a problem hiding this comment.
Wait, so you want to build the Dub library with the built DMD, not the host DMD?
I guess testing that the compiler can auto-bootstrap is interesting, but wouldn't it be easier and more consistent to use the host DMD? Or is that difficult because only dmd's posix.mak knows what it is?
| license "BSL-1.0" | ||
|
|
||
| targetType "none" | ||
| targetType "library" |
There was a problem hiding this comment.
I was told by Sönke to not do this #6771 (comment).
There was a problem hiding this comment.
It doesn't copy all DFLAGS otherwise.
There was a problem hiding this comment.
Who doesn't copy what DFLAGS?
MartinNowak
left a comment
There was a problem hiding this comment.
I'd say let's move this out of the test/Makefile mess and leave it in src/posix.mak as a test_dub target.
Furthermore there is no need to deal with the -conf= complications or raw DFLAGS, just testing that the dub recipe works with the HOST_DMD compiler is sufficient (we shouldn't generate a dmd.conf in the src folder during testing).
| else | ||
| REAL_MODEL=64 | ||
| endif | ||
| export DMD=../generated/$(OS)/$(BUILD)/$(REAL_MODEL)/dmd |
There was a problem hiding this comment.
As the goal is to check whether the dub package recipe works we should just use the host compiler and avoid additional complications.
| else | ||
| export ARGS=-inline -release -g -O -fPIC | ||
| export DMD=../src/dmd | ||
| # hack around the fact that on auto-tester MODEL isn't set for the testsuite |
There was a problem hiding this comment.
Yes that looks wrong, osmodel.mak will already determine a default MODEL, unless one is explicity specified via make MODEL=64. Not sure what fails for you, but you can use $(error ${MODEL}) to inspect variables.
| license "BSL-1.0" | ||
|
|
||
| targetType "none" | ||
| targetType "library" |
There was a problem hiding this comment.
Who doesn't copy what DFLAGS?
| @@ -97,6 +97,7 @@ QUIET=@ | |||
| export RESULTS_DIR=test_results | |||
| export MODEL | |||
| export REQUIRED_ARGS= | |||
There was a problem hiding this comment.
BTW, working with exported env parameters is really annoying when reading a log failure and not being able to rerun a command.
|
Superseded by #7415 which simply uses the host dmd as suggested. |
Fix-up to #6771 (comment)
I think it's reasonable to test the new DUB package with the newly build D compiler and not the host compiler.