{"action":"created","issue":{"url":"https://api.github.com/repos/atilaneves/unit-threaded/issues/106","repository_url":"https://api.github.com/repos/atilaneves/unit-threaded","labels_url":"https://api.github.com/repos/atilaneves/unit-threaded/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/atilaneves/unit-threaded/issues/106/comments","events_url":"https://api.github.com/repos/atilaneves/unit-threaded/issues/106/events","html_url":"https://github.com/atilaneves/unit-threaded/issues/106","id":294305959,"number":106,"title":"Unit-threaded and Dub fight each other","user":{"login":"Abscissa","id":714873,"avatar_url":"https://avatars0.githubusercontent.com/u/714873?v=4","gravatar_id":"","url":"https://api.github.com/users/Abscissa","html_url":"https://github.com/Abscissa","followers_url":"https://api.github.com/users/Abscissa/followers","following_url":"https://api.github.com/users/Abscissa/following{/other_user}","gists_url":"https://api.github.com/users/Abscissa/gists{/gist_id}","starred_url":"https://api.github.com/users/Abscissa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Abscissa/subscriptions","organizations_url":"https://api.github.com/users/Abscissa/orgs","repos_url":"https://api.github.com/users/Abscissa/repos","events_url":"https://api.github.com/users/Abscissa/events{/privacy}","received_events_url":"https://api.github.com/users/Abscissa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-05T08:17:07Z","updated_at":"2018-02-06T03:52:31Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I tried to use the unit-threaded test runner in a project by directly following the \"Quick start with dub\" instructions from the README, but it didn't work: Dub wouldn't compile the generated \"bin/ut.d\" file, and instead used its own test runner.\r\n\r\nI think the problem is a combination of both dub and an outdated unit-threaded readme, so I'm pinging @s-ludwig (I hope that's the right person to ping, I know he's the original dub author, but I see a lot of commits there by other people now)\r\n\r\nHere are the steps I went through:\r\n\r\n- Upgraded dub from 1.6.0 to 1.7.1. Nothing changed.\r\n\r\n- Added the line `sourceFiles \"bin/ut.d\"`. Nothing changed.\r\n\r\n- Removed the line `mainSourceFile \"bin/ut.d\"`. This led to dub complaining that \r\nbin/ut.d wasn't found in any import path. Sounds like I'm starting to get somewhere, although by this point I'm already diverging from the instructions in unit-threaded's readme (that, presumably, used to work on some unknown version of dub).\r\n\r\n- Added the line `importPaths \"bin/\"`. Now it's at least compiling ut.d, but dub is still trying to add its own test runner:\r\n\r\n`bin/ut.d(5,5): Error: only one main allowed. Previously found main at /tmp/dub_test_root-00d69228-48f5-4f81-bdb3-a791e12823a9.d(26,12)`\r\n\r\n- I don't see anything on code.dlang.org on disabling dub's test runner. So I make another shot-in-the-dark guess and change `dub test -c my-unit-threaded-config` to `dub run -c my-unit-threaded-config`. *Now* it seems to be working.\r\n\r\nOh, another fun wrinkle: I have a `void main() {}` in one of my source files (for when I compile unittests via rdmd). On my original non-unit-threaded test configuration, I have a `mainSourceFile` directive pointing at that file, so `dub test -c no-unit-threaded` ignores that file works fine. But if I add the same `mainSourceFile` directive to the same file on the \"use unit-threaded\" config, it *doesn't* exclude the file and complains about multiple main()...ugh, probably because I had to trick dub into thinking that config isn't a unittest...\r\n\r\n(I'd also like to note, this has unfortunately been *very* characteristic of my experiences trying to use alternatives to *any* of dub's built-in features.)"},"comment":{"url":"https://api.github.com/repos/atilaneves/unit-threaded/issues/comments/363302951","html_url":"https://github.com/atilaneves/unit-threaded/issues/106#issuecomment-363302951","issue_url":"https://api.github.com/repos/atilaneves/unit-threaded/issues/106","id":363302951,"user":{"login":"Abscissa","id":714873,"avatar_url":"https://avatars0.githubusercontent.com/u/714873?v=4","gravatar_id":"","url":"https://api.github.com/users/Abscissa","html_url":"https://github.com/Abscissa","followers_url":"https://api.github.com/users/Abscissa/followers","following_url":"https://api.github.com/users/Abscissa/following{/other_user}","gists_url":"https://api.github.com/users/Abscissa/gists{/gist_id}","starred_url":"https://api.github.com/users/Abscissa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Abscissa/subscriptions","organizations_url":"https://api.github.com/users/Abscissa/orgs","repos_url":"https://api.github.com/users/Abscissa/repos","events_url":"https://api.github.com/users/Abscissa/events{/privacy}","received_events_url":"https://api.github.com/users/Abscissa/received_events","type":"User","site_admin":false},"created_at":"2018-02-06T03:52:31Z","updated_at":"2018-02-06T03:52:31Z","author_association":"CONTRIBUTOR","body":"source/foobar/a.d:\r\n```d\r\nmodule foobar.a;\r\nimport std.stdio;\r\n\r\nversion(BLANK_MAIN) \r\n\tvoid main() {}\r\n\r\nunittest\r\n{\r\n\twriteln(\"Hallo\");\r\n}\r\n```\r\n\r\ndub.sdl:\r\n```\r\nname \"foobar\"\r\n\r\n// basic test runner\r\nconfiguration \"unittest\" {\r\n\ttargetType \"executable\"\r\n\tversions \"BLANK_MAIN\"\r\n}\r\n\r\n// unit-threaded test runner\r\nconfiguration \"unittest-unit-threaded\" {\r\n\ttargetType \"executable\"\r\n\tmainSourceFile \"bin/ut.d\"\r\n\tdependency \"unit-threaded\" version=\"~>0.7.38\"\r\n\tpreBuildCommands \"dub run unit-threaded -c gen_ut_main -- -f bin/ut.d\"\r\n}\r\n```\r\n\r\nCmdline:\r\n```sh\r\n$ dub test -c unittest-unit-threaded -- --help\r\nGenerating test runner configuration 'foobar-test-unittest-unit-threaded' for 'unittest-unit-threaded' (executable).\r\nExcluding main source file bin/ut.d from test.\r\nPerforming \"unittest\" build using dmd for x86_64.\r\nunit-threaded 0.7.38: target for configuration \"library\" is up to date.\r\nfoobar ~master: building configuration \"foobar-test-unittest-unit-threaded\"...\r\nRunning pre-build commands...\r\nBuilding package unit-threaded in /home/nick/.dub/packages/unit-threaded-0.7.38/unit-threaded/\r\nPerforming \"$DFLAGS\" build using dmd for x86_64.\r\nunit-threaded 0.7.38: target for configuration \"gen_ut_main\" is up to date.\r\nTo force a rebuild of up-to-date targets, run again with --force.\r\nRunning ../../../../.dub/packages/unit-threaded-0.7.38/unit-threaded/gen_ut_main -f bin/ut.d\r\nLinking...\r\nTo force a rebuild of up-to-date targets, run again with --force.\r\nRunning ./foobar-test-unittest-unit-threaded --help\r\nHallo\r\nAll unit tests have been run successfully.\r\n```\r\n"}}
{"actor":{"display_login":"Abscissa"}}