How to unit-test a phobos module?

Steven Schveighoffer schveiguy at gmail.com
Thu Nov 26 12:46:42 UTC 2020


On 11/25/20 7:17 PM, Q. Schroll wrote:
> On Wednesday, 25 November 2020 at 21:57:12 UTC, H. S. Teoh wrote:
>> On Wed, Nov 25, 2020 at 09:49:12PM +0000, Paul Backus via 
>> Digitalmars-d-learn wrote:
>>> On Wednesday, 25 November 2020 at 21:16:06 UTC, Q. Schroll wrote:
>>> > On Wednesday, 25 November 2020 at 21:11:24 UTC, Paul Backus > wrote:
>>> > > On Wednesday, 25 November 2020 at 20:58:20 UTC, Q. Schroll > > 
>>> wrote:
>>> > > > My setup:
>>> > > > * A fresh DMD installed a few minutes ago.
>>> > > > * Clone of my Phobos fork with up-to-date changes from
>>> > > > dlang/phobos/master.
>>> > > > > Do you have clones of dmd and druntime too?
>>> > > Why would I need those? I haven't needed them back then.
>>>
>>> copyEmplace isn't in druntime 2.094.2.
>>
>> My guess is that the problem is caused by trying to compile Phobos 
>> with a compiler that uses an incompatible version of druntime.
> 
> One of the issues is, I don't know what DRuntime really is. As far as I 
> understand on the surface-level, it's functionality one would expect to 
> be implemented by the compiler, but actually implemented in plain D 
> code. A low-level Phobos if you want. So I'm a little confused why 
> there's even a need for it to be "built". Isn't it "just code" like Phobos?

Druntime is in many respects the library portion of the language. It's 
the glue that allows some language pieces to work (e.g. Object, 
associative arrays, TypeInfo, etc.). There are also pieces that are 
purely independent of the compiler.

But it used to be that just Phobos existed, and no Druntime. Druntime is 
actually the runtime portion of Tango, factored out so that both Phobos 
and Tango could use the same underlying runtime. It used to be, if you 
wanted to use a Tango-based library, you couldn't use a Phobos-based one 
as well.

At this point, it's a nice separation of the Language features that must 
be library implemented from the user library (Phobos).

> 
> I'm increasingly frustrated because, honestly, it seems I don't know 
> enough about the build processes or build tools used. The Wiki expects 
> Digital Mars make to be there, also says explicitly not to confuse it 
> with GNU make, but in my DMD folder there is none. Since it's a plain 
> install, I suspect the Wiki is outdated. How am I expected to figure 
> things out? It seems like everyone else knows how to do it, just I'm too 
> stupid.

Like any projects that are built over decades, Phobos and Druntime have 
accumulated esoteric build systems, and things you just "have to know". 
I honestly can't help you with your troubles, because I only ever use 
Windows when I have to. But I'm sure there are ways to get done what you 
want to get done. This might involve wrestling with the build system, or 
figuring out the correct command line based on the build system.

-Steve


More information about the Digitalmars-d-learn mailing list