September 03, 2021

On Friday, 3 September 2021 at 01:08:25 UTC, deadalnix wrote:

>

The current flag's behavior make no sense. They are not useful. They don't so something sensible. They don't serve typical use cases.

The behavior is good for custom test runners or incremental compilation of unittests. Dub projects can use silly to filter tests, and maybe the default dub test runner should be able to do the same. That wouldn't require a change to the -unittest flag though.

>

And here is the root problem: something is complete trash and yet, not only I'm told this is normal and expected, but I'm supposed to be happy with it.

I'm sorry to hear you're frustrated with the current situation, but I can't just open a dmd pull request breaking the CLI and dismissing everyone else's use cases and get that merged. If you want to rant a bit to vent your frustration, that's fine by me, but if you want this thread to result in an improvement, you'll need to come up with a specific, feasible proposal.

>

In fact, people went through the length of migrating the whole standard library to use the StdUnittest version to work around the problem I'm pointing.

No, see Steven's post.

September 03, 2021

On 9/2/21 9:08 PM, deadalnix wrote:

>

By yourself, by Walter, by Steven. You guys are obviously smart, but you aren't looking at this straight or even at all. Or you are drowning in so much trash you don't even see it anymore, like a fish in water.

Or I haven't thought about or cared about a problem with unittests ever. I just use dub test or dub -b unittest, and it works as I expect -- all unittests in my project are run, no unittests in dependencies are run. No trash to drown in.

I'm not too concerned with your use cases, as the current system runs just fine for me, and if you don't like it, you can use a fancier test runner that provides more control. I don't see a problem with the existence of external unittest systems. The basic system is designed to allow you complete control if you don't like the default, and the default is fine for most people.

I'm kinda done with this thread anyway, about to kill it...

-Steve

September 03, 2021

On Friday, 3 September 2021 at 01:08:25 UTC, deadalnix wrote:

>

WAKE UP!

This is bad. This is really bad. Stop making excuses. It's time to ask, how did this get this way and what can be done so that this never ever happens again.

The set of flags the compiler propose is complete nonsense that do not serve users, it has cause major rewrite in the standard library, and motivated the creating of a new test framework per large project. This needs to stop.

First of all, I fully agree.

Second, I was digging out my DMD bug 18843 ("-deps -unittest causes cataclysmic memory usage"), just to throw some more fuel on this trash fire of a debate, and good news: dmd -deps -unittest helloworld.d no longer causes cataclysmic memory usage:

$ cat helloworld.d
import std.stdio; void main() { writeln("Hello World"); }
$ dmd --version
DMD64 D Compiler v2.097.2
Copyright (C) 1999-2021 by The D Language Foundation, All Rights Reserved written by Walter Bright
$ dmd -deps -unittest helloworld.d
dmd2/linux/bin64/../../src/phobos/std/stdio.d(578): Error: undefined identifier `testFilename`
*snip 20 more semi-identical errors*

I don't think I need to add anything here...

September 03, 2021

On Friday, 3 September 2021 at 12:49:05 UTC, FeepingCreature wrote:

>

Second, I was digging out my DMD bug 18843 ("-deps -unittest causes cataclysmic memory usage"), just to throw some more fuel on this trash fire of a debate, and good news: dmd -deps -unittest helloworld.d no longer causes cataclysmic memory usage:

[...]

I don't think I need to add anything here...

Well, we could add that even though it cause cataclysmic memory usage, the dependency tracking is not done properly, at least for rdmd: https://issues.dlang.org/show_bug.cgi?id=22268

September 05, 2021
On 8/31/2021 4:04 AM, deadalnix wrote:
> No, because it'll run the unittests, and the user will see "X test passed" or something similar when running the executable, understand that they ran the uni tests and go ahead and run the executable that has been built without the unitests flag.
> 
> If the user doesn't have any unitests in the executable, then saying "0 test run, 0 passed, 0 failed" is enough to indicated to the user that this was a unitests build.

The unittest feature doesn't do any of those things unless you code it to.
September 05, 2021
On Sunday, 5 September 2021 at 21:00:15 UTC, Walter Bright wrote:
> On 8/31/2021 4:04 AM, deadalnix wrote:
>> No, because it'll run the unittests, and the user will see "X test passed" or something similar when running the executable, understand that they ran the uni tests and go ahead and run the executable that has been built without the unitests flag.
>> 
>> If the user doesn't have any unitests in the executable, then saying "0 test run, 0 passed, 0 failed" is enough to indicated to the user that this was a unitests build.
>
> The unittest feature doesn't do any of those things unless you code it to.

It already output a very similar message: "15 modules passed unittests"

The specifics of the message do not matter here.
September 06, 2021
On 9/5/2021 3:00 PM, deadalnix wrote:
> On Sunday, 5 September 2021 at 21:00:15 UTC, Walter Bright wrote:
>> The unittest feature doesn't do any of those things unless you code it to.
> 
> It already output a very similar message: "15 modules passed unittests"

That must be a fairly recent change I wasn't aware of.

September 06, 2021

On Monday, 6 September 2021 at 16:35:03 UTC, Walter Bright wrote:

>

On 9/5/2021 3:00 PM, deadalnix wrote:

>

On Sunday, 5 September 2021 at 21:00:15 UTC, Walter Bright wrote:

>

The unittest feature doesn't do any of those things unless you code it to.

It already output a very similar message: "15 modules passed unittests"

That must be a fairly recent change I wasn't aware of.

It came in with https://github.com/dlang/druntime/pull/1685 , which also added a lot more control over how the tests could be run.

Old behavior: adding -unittest causes unittest functions to be compiled in and to run before main, and that's it: the program only exited before main on error because that's how assert() failures are handled, and the program continued to run if there were no errors. This perfectly fits the use case of "I want a build of my program with a bunch of extra testing, ala a debug or a non-release build" but required some workarounds to fit the use case of "I want to run all of my unittests, only"

Much of this thread can be listed under complaints about a third use case, "I want to run a single module's tests, only"

September 06, 2021

On Monday, 6 September 2021 at 16:52:38 UTC, jfondren wrote:

>

It came in with https://github.com/dlang/druntime/pull/1685 , which also added a lot more control over how the tests could be run.

https://github.com/dlang/druntime/pull/1685#issuecomment-256795118

Damn, I don't know who that guy is, but it seems like he foresaw the current mess that we are in.

September 06, 2021

On Monday, 6 September 2021 at 16:55:30 UTC, deadalnix wrote:

>

On Monday, 6 September 2021 at 16:52:38 UTC, jfondren wrote:

>

It came in with https://github.com/dlang/druntime/pull/1685 , which also added a lot more control over how the tests could be run.

https://github.com/dlang/druntime/pull/1685#issuecomment-256795118

Damn, I don't know who that guy is, but it seems like he foresaw the current mess that we are in.

-main wasn't and still isn't a problem for the use case the PR was authored for, of "I want to run all my unit tests, only", and the approach of the PR approach was completely successful at making druntime much more friendly to that use case. It had zero impact on your use case, but you didn't sell it very well by only mentioning what for other uses was a very trivial inconvenience.