-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add dub test #56
Add dub test #56
Conversation
| @@ -75,9 +82,9 @@ if grep -q "^--- .*d" "$onlineapp" > /dev/null 2>&1 ; then | |||
| exec timeout -s KILL ${TIMEOUT:-30} bash -c "${DLANG_EXEC} -g $args "${d_files[@]:1}" $with_run "${d_files[0]}" ${run_args} | tail -n100000" | |||
| fi | |||
| elif grep -qE "dub[.](sdl|json):" "$onlineapp" > /dev/null 2>&1 ; then | |||
| exec timeout -s KILL ${TIMEOUT:-30} dub -q --compiler=${DLANG_EXEC} --single --skip-registry=all "$onlineapp" ${run_args} | tail -n10000 | |||
| exec timeout -s KILL ${TIMEOUT:-30} dub ${DUB_COMMAND} -q --compiler=${DLANG_EXEC} --single --skip-registry=all "$onlineapp" ${run_args} | tail -n10000 | |||
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.
I don't think test works with --single.
% dub test --single source/scpp/build.d
Package cpp_build (configuration "application") defines no import paths, use {"importPaths": [...]} or the default package directory structure to fix this.
Generating test runner configuration 'cpp_build-test-application' for 'application' (executable).
Source file '/Users/geod24/projects/bpfk/agora/source/scpp/build.d' not found in any import path.Script used is 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.
Do you think that is a dub bug? It is listed as an option under the test docs.
I see some issues in the dub repo about single. It rebuilds every time, it doesn't work for dynamic libraries, and it can fail when the network is bad.
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.
@Geod24 After actually being able to run it myself, I can confirm that I run into that issue.
Using the most recent branch, I built with docker build -t dlangtour/core-exec:dmd . and ran
source="/++dub.sdl: name\"foo\" \n dependency\"mir\" version=\"*\"+/ unittest { import mir.combinatorics, std.stdio; writeln([0, 1].permutations); } void main() {}"
bsource=$(echo -e "$source" | base64 -w0)
DOCKER_FLAGS="-unittest" docker run -e DOCKER_FLAGS --rm dlangtour/core-exec:dmd "$bsource"
and it printed
Package foo (configuration "application") defines no import paths, use {"importPaths": [...]} or the default package directory structure to fix this.
Source file '/sandbox/onlineapp.d' not found in any import path.
When excluding dependencies (code below), I get the same error.
source="/++dub.sdl: name\"foo\" \n +/ unittest { assert(1 > 0); } void main() {}"
bsource=$(echo -e "$source" | base64 -w0)
DOCKER_FLAGS="-unittest" docker run -e DOCKER_FLAGS --rm dlangtour/core-exec:dmd "$bsource"
It's not as if you can remove --single when handling dub test only. That doesn't work. And you need --single when using dub run.
|
@Geod24 This is now passing on dmd after v2.096 fixed Two questions:
|
|
@Geod24 Fixed the first issue I mentioned above. Now passing for |
Even though Dub is shipped with the compiler, it really is a separate project (which supports multiple compiler versions), so we shouldn't use the bundled version of Dub, but instead always use the latest Dub version. I'm not sure, but I think changing this line: Line 31 in 58ae79e
to: should do the trick, according to: Edit: That said, we really need to fix the GH releases of Dub, as the latest one is 1.23.0 (https://github.com/dlang/dub/releases), and the install script won't be able to install a newer one - see https://github.com/dlang/installer/blob/7b71542a59b6ae095fc867d4e6eb5e8b6a04573a/script/install.sh#L1245. |
|
@PetarKirov I have incorporated your suggestion with respect to putting things in terms of |
|
To the second point I raised with @Geod24 regarding I'm still not entirely sure how this relates to the |
|
For the dmd runs, I see a line in the "Build Image" output about dub 1.22.0 being installed Even though dmd-2.096 is getting installed and 1.23.0 is the latest release on github. I find it a little strange that these are compiling without error, given that I assumed the problems with |
|
Looks like the dub install version is driven by https://dlang.github.io/dub/LATEST. Not sure why that is behind the releases. Not sure how to update it. |
|
I fixed an issue related to The only failing unittest right now seems to be an unrelated issue. |
|
Current passing version removes the The |
|
Current version installs dmd and the requested compiler. However, it seems that the dub that comes with dmd is not being used (why the ldc versions are currently failing). I don't know how to force that to be used. |
|
I tried to add dub to the path with the line below but I get the output that dmd is not installed, though it looks like it was installed earlier. |
|
I am able to install the DMD dub. To get the path to it to use later in the Dockerfile, I needed to save it to a file (/tmp/dub_dmd_bin_path). I only want to add it to the path if the file exists (which only should happen when the dlang version isn't dmd). What I have below isn't working (and it fails early) on either dmd or ldc. Any idea what I need to do to fix? The error message is a bit mysterious. |
|
I think I'm out of guesses at this point as to how to get this to work on ldc until the new release comes with dub 1.25.0. Basically, I was trying to download dmd separately and then add the path to dmd's dub to the path. I couldn't figure out how to get this to work in docker (the problem is that if you run a bash command, then it doesn't persist, apparently I'm not the only one with this issue). So, I tried hard coding it to the front of the PATH and that didn't work either. I will try again when ldc-1.26 is released. |
|
@jmh I will try to dedicate some time later this week to help you get this through the finish line. |
|
@PetarKirov I wouldn't spend too much time on it though. The issue will resolve itself soon enough. |
|
@PetarKirov Passing with ldc-beta! |
|
@jmh530 great, than I guess we can just wait for the official 1.26 to be released and then merge this PR. |
|
@PetarKirov I'll probably squash it when the official ldc release comes out. |
|
New LDC released today, waiting on maintainer to approve running workflow to ensure it passes. |
|
@PetarKirov @Geod24 Can I get workflow approval to test the new LDC release? |
|
Done |
|
@Geod24 Thanks! It's passing now! |
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.
Thanks for your work on this! Just one comment, rest LGTM!
envwrapper
Outdated
| #!/bin/bash | ||
| TEMP=$(cat /tmp/dub_dmd_bin_path) | ||
| export DUB_DMD_BIN_PATH=$(TEMP:+:) | ||
| $* |
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.
You might want to exec here (and add newline) so that signals are passed down properly
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.
That file isn't used anymore. I had forgotten to remove. Needs another approval to run CI again.
I am marking this as a WIP per here. I have not been able to test this on my own yet.