Bug 18111 – unittests get different names depending on how the files are passed to dmd

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2017-12-22T02:03:23Z
Last change time
2018-01-16T04:41:37Z
Assigned to
No Owner
Creator
Atila Neves

Comments

Comment #0 by atila.neves — 2017-12-22T02:03:23Z
/tmp/foo.d: void _() { import dir1.dir2.bar; pragma(msg, __traits(getUnitTests, dir1.dir2.bar)); } /tmp/dir1/dir2/bar.d: module dir1.dir2.bar; unittest { } void _() { pragma(msg, __traits(getUnitTests, dir1.dir2.bar)); } When compiling foo.d: /tmp % dmd -c -unittest foo.d tuple(__unittest_dir1_dir2_bar_d_2_0) When compiling bar.d: /tmp % dmd -c -unittest /tmp/dir1/dir2/bar.d tuple(__unittest__tmp_dir1_dir2_bar_d_2_0) The symbol names don't match and a linker error ensues. This prevents __traits(getUnittests) from being used in certain separate compilation scenarios.
Comment #1 by github-bugzilla — 2018-01-08T15:46:36Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/3b551d3ce6d9d654ba64c11ce0c7c926b1197aa0 Fix issue 18111: use fully qualified name for modules in unittest names https://github.com/dlang/dmd/commit/e6038789f09d629bc2401569be88689dee665e3f Merge pull request #7496 from atilaneves/fix_issue_18111 Fix issue 18111: use fully qualified name for modules in unittest names merged-on-behalf-of: Mike Franklin <[email protected]>
Comment #2 by github-bugzilla — 2018-01-16T04:41:37Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/3b551d3ce6d9d654ba64c11ce0c7c926b1197aa0 Fix issue 18111: use fully qualified name for modules in unittest names https://github.com/dlang/dmd/commit/e6038789f09d629bc2401569be88689dee665e3f Merge pull request #7496 from atilaneves/fix_issue_18111