Building and running DMD tests
Jonathan M Davis
newsgroup.d at jmdavisprog.com
Sun Dec 1 22:59:30 UTC 2019
On Sunday, December 1, 2019 8:20:42 AM MST Per Nordlöw via Digitalmars-d-
> Is it possible to compile and run unittest of dmd without
> druntime and phobos?
> If so, how?
> I'm trying the following under dmd root:
> make -C src -f posix.mak unittest
> but that doesn't compile my file of interest
> How can I make sure that all the files under /test/compilable
dmd's tests are designed to be run after you've built druntime and Phobos.
If you look at the tests, many of them import modules from both druntime
and/or Phobos. IIRC, there has been some discussion about whether that
should be changed, but AFAIK, there has been no agreement to do so. I'm also
not sure that it even _can_ be done with regards to druntime, because every
D program that isn't compiled with -betterC requires at least druntime. So,
at most, it would probably mean not requiring Phobos, but either way, at the
moment, the tests in general expect Phobos to have been built and be
available. I don't know how possible it is to get around that with a
specific test module that doesn't actually use Phobos, but that's not how
the tests are normally run, and you'd need druntime regardless.
In addition, I believe that the unittest target that you're trying to build
is specifically for running all of the unittest blocks in the dmd source
code, not for running the tests in the test folder. Those are built using
the makefile in the test folder or by running the test target from the
primary makefile with the target test (which also runs the unittest blocks
in the src folder), whereas you're specifically using the makefile in src.
- Jonathan M Davis
More information about the Digitalmars-d-learn