Skip to content
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

dub test overrides binary created by dub build #840

Closed
ximion opened this issue May 8, 2016 · 5 comments
Closed

dub test overrides binary created by dub build #840

ximion opened this issue May 8, 2016 · 5 comments

Comments

@ximion
Copy link
Contributor

ximion commented May 8, 2016

dub version: 0.9.24

When packaging software, it's quite common to run the build-time tests after the software was built.
Doing that with dub results in dub build and dub test to be executed in order.
Unfortunately, dub test seems to override the actual binary we install on the system later with the test-binary, which is pretty annoying.
Would it be possible to give the test-binary a different name, to make it not override the existing, previously built, actual binary?
Something like

dub build => foobar
dub test => foobar.test

Thanks for looking into this!

@s-ludwig
Copy link
Member

By default, DUB picks the first library configuration and generates a test executable configuration from that. The executable is then named __test__<config>__. Only if the package recipe provides a custom "unittest" configuration, or only provides an executable configuration, the executable name will not be generated and may be the same as the usual executable name. However, IMO it is the task of the package author to decide on a proper executable name in that case.

@ximion
Copy link
Contributor Author

ximion commented Dec 21, 2016

When I reported this, the dub.json file I could use to reproduce this was:

{
    "name": "foobar",

    "sourcePaths": ["src"],

    "buildTypes": {
        "debug": {
            "buildOptions": ["debugMode", "debugInfo", "optimize", "inline"]
        },
        "debug-nooptimize": {
            "buildOptions": ["debugMode", "debugInfo"]
        }
    },

    "targetPath": "build",
    "targetType": "executable",
    "buildRequirements": ["disallowDeprecations"]
}

@s-ludwig
Copy link
Member

Okay, it's the "targetType": "executable" in that case. But I guess it actually wouldn't hurt to let "dub test" override the "targetName" when generating from an executable configuration either...

@s-ludwig
Copy link
Member

I've opened a PR: #1029

@MartinNowak
Copy link
Member

Fixed by 9e73284

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants