Jump to page: 1 2
Thread overview
How to unit-test a phobos module?
Nov 25, 2020
Q. Schroll
Nov 25, 2020
Paul Backus
Nov 25, 2020
Q. Schroll
Nov 25, 2020
Paul Backus
Nov 25, 2020
H. S. Teoh
Nov 26, 2020
Q. Schroll
Nov 26, 2020
Paul Backus
Nov 25, 2020
Q. Schroll
Nov 26, 2020
Max Haughton
Nov 26, 2020
Mike Parker
Nov 27, 2020
Q. Schroll
Nov 27, 2020
Vladimir Panteleev
Nov 27, 2020
aberba
November 25, 2020
When trying to unit-test an unchanged phobos module from phobos/master, I get errors such as

    module core.lifetime import copyEmplace not found

and template instantiation errors. What is the correct arguments to pass to (r)dmd? I know it worked for me some years ago, but somehow, it doesn't work now.

I've looked at [1], [2], [3] which didn't work (maybe outdated?). How do you do it and what am I doing wrong?

My setup:
* A fresh DMD installed a few minutes ago.
* Clone of my Phobos fork with up-to-date changes from dlang/phobos/master.

In the clone's folder, ~/dlang/phobos, I tried the following commands:

    $ dmd -main -unittest -version=StdUnittest -I. -run std/<module>.d

and

    $ rdmd -main -unittest -version=StdUnittest -I. std/<module>.d

I have the feeling I'm missing something quite obvious.

[1] https://wiki.dlang.org/Contributing_to_Phobos#Test_a_single_Phobos_module
[2] https://wiki.dlang.org/Building_under_Windows#Building_Phobos_2
[3] https://github.com/dlang/phobos/blob/master/CONTRIBUTING.md
November 25, 2020
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? If not, try following these instructions:

https://wiki.dlang.org/Starting_as_a_Contributor#Typical_Contributor_Workflow
November 25, 2020
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.
November 25, 2020
On 11/25/20 3:58 PM, Q. Schroll wrote:
> When trying to unit-test an unchanged phobos module from phobos/master, I get errors such as
> 
>      module core.lifetime import copyEmplace not found
> 
> and template instantiation errors. What is the correct arguments to pass to (r)dmd? I know it worked for me some years ago, but somehow, it doesn't work now.
> 
> I've looked at [1], [2], [3] which didn't work (maybe outdated?). How do you do it and what am I doing wrong?
> 
> My setup:
> * A fresh DMD installed a few minutes ago.
> * Clone of my Phobos fork with up-to-date changes from dlang/phobos/master.
> 
> In the clone's folder, ~/dlang/phobos, I tried the following commands:
> 
>      $ dmd -main -unittest -version=StdUnittest -I. -run std/<module>.d
> 
> and
> 
>      $ rdmd -main -unittest -version=StdUnittest -I. std/<module>.d
> 
> I have the feeling I'm missing something quite obvious.
> 
> [1] https://wiki.dlang.org/Contributing_to_Phobos#Test_a_single_Phobos_module
> [2] https://wiki.dlang.org/Building_under_Windows#Building_Phobos_2
> [3] https://github.com/dlang/phobos/blob/master/CONTRIBUTING.md

I typically do:

make -f posix.mak std/<module>.test

-Steve
November 25, 2020
On Wednesday, 25 November 2020 at 21:16:15 UTC, Steven Schveighoffer wrote:
> I typically do:
>
> make -f posix.mak std/<module>.test
>
> -Steve

For some reason, [1] says `make.exe` would be installed by the DMD installer, but I found none. It explicitly says not to use GNU make. (I'm on Windows.)

[1] https://wiki.dlang.org/Building_under_Windows
November 25, 2020
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.
November 25, 2020
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.


T

-- 
Insanity is doing the same thing over and over again and expecting different results.
November 26, 2020
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?

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.

> *ME* Why would I need those? I haven't needed them back then.

I wrote that not saying "do the work for me, guys" but "please tell me what changed".
November 26, 2020
On Thursday, 26 November 2020 at 00:17:26 UTC, Q. Schroll wrote:
>
> 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?

Phobos depends on DRuntime, and both Phobos and DRuntime depend on the D compiler. When you download version 2.094.2 of the compiler (the latest release), it comes with the corresponding versions of Phobos and DRuntime, and is configured to automatically include them in its import paths.

If you want to compile the development version of Phobos, you will generally need the development versions of DRuntime and DMD as well, because of the dependency relationships between them. If you try to compile the development version of Phobos using the latest released versions of DMD and DRuntime, you are liable to run into dependency issues like the one in your original post.

>> *ME* Why would I need those? I haven't needed them back then.
>
> I wrote that not saying "do the work for me, guys" but "please tell me what changed".

I have no idea what changed for *your* setup, because (a) I develop on Linux, not Windows, and (b) I've only been involved in D development since 2018. Personally, I followed the instructions on the "Starting as a Contributor" and "Contributing to Phobos" pages, and they worked for me.
November 26, 2020
On Wednesday, 25 November 2020 at 21:36:36 UTC, Q. Schroll wrote:
> On Wednesday, 25 November 2020 at 21:16:15 UTC, Steven Schveighoffer wrote:
>> I typically do:
>>
>> make -f posix.mak std/<module>.test
>>
>> -Steve
>
> For some reason, [1] says `make.exe` would be installed by the DMD installer, but I found none. It explicitly says not to use GNU make. (I'm on Windows.)
>
> [1] https://wiki.dlang.org/Building_under_Windows

The digital mars make is actually distributed with the c compiler.

Developing on Windows is such a complete pain e.g. setting it up so it can find the linker and cl. For that reason I currently just do all dmd/phobos/druntime hacking inside WSL because that way I can just press build (dmd has build.d which is cross-platform but druntime and phobos both aren't fun to build on windows unless you've done it recently)
« First   ‹ Prev
1 2