Thread overview
Building and running DMD tests
Dec 01, 2019
Per Nordlöw
Dec 01, 2019
Jonathan M Davis
Dec 02, 2019
Suleyman
Dec 04, 2019
Per Nordlöw
December 01, 2019
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
    ./generated/linux/release/64/dmd-unittest

but that doesn't compile my file of interest

test/compilable/traits.d

.

How can I make sure that all the files under /test/compilable compiles?
December 01, 2019
On Sunday, December 1, 2019 8:20:42 AM MST Per Nordlöw via Digitalmars-d- learn wrote:
> 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
>      ./generated/linux/release/64/dmd-unittest
>
> but that doesn't compile my file of interest
>
> test/compilable/traits.d
>
> .
>
> How can I make sure that all the files under /test/compilable compiles?

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




December 02, 2019
On Sunday, 1 December 2019 at 15:20:42 UTC, Per Nordlöw wrote:
> 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
>     ./generated/linux/release/64/dmd-unittest
>
> but that doesn't compile my file of interest
>
> test/compilable/traits.d
>
> .
>
> How can I make sure that all the files under /test/compilable compiles?

The command you need is "make -Ctest". Or you can run a specific test manually using run.d.
```
cd test/
./run.d compilable/traits.d
```

December 04, 2019
On Monday, 2 December 2019 at 02:15:36 UTC, Suleyman wrote:
> The command you need is "make -Ctest". Or you can run a specific test manually using run.d.
> ```
> cd test/
> ./run.d compilable/traits.d
> ```

Thanks