-
-
Notifications
You must be signed in to change notification settings - Fork 741
Each unittest in Windows #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Oddly enough, these changes make the unit tests run slower on my machine. That doesn't mean that we shouldn't make the changes, but it's odd, since the changes should have done the opposite. It be nice if the unit tests actually ran in order though. The current order seems quite random. |
Slower testing is the same with my machine (64-bit Windows 7, Core i7 2GHz, 4GB memory), it is about +1 minute.
Fixing it is easy, arrange files of |
old: Elapsed Time: 0:03:48.390 They're faster on my machine. It's just a regular 7200RPM HDD with a quad-core AMD @2.6ghz. |
This runs in 1 minute 58 seconds for me:
Can't tell if that's a good way to unittest though. (it should of course skip osx/linux files). |
Added parallel testing by using std.parallelism. I think it is better that use the parallel version for default testing, and use the sequential version when |
I'm not sure that Phobos can actually be safely tested in parallel. I know that it was brought up not to long ago, and several things were pointed out which would need to be changed. For instance, std.file creates several files in the process of its tests, and if any other tests created any of those files, then you have race conditions which will affect the tests. It's definitely true that the unit tests within a module cannot be run in parallel, but that's a separate issue entirely, and the unit test framework isn't setup to do that at the moment even if we wanted it to (which is questionable). Regardless, I'm not sure that it's safe to run the unit tests in parallel, and we need to verify that it's safe before we do it. |
Researched roughly with temporary file name used in each unit testing.
Fortunately, there is no conflict between modules, but the result is much dangerous. |
I'd prefer to leave it as-is because it's also a great test for dmd to compile a large app all at once. |
Building the large unittest.exe at once is good test for dmd, but it is harmful for Phobos. Then, making unittest.exe is harmful for Pohbos. I think it is useless to leave it as-is. |
Actually, I'd argue that we set it up so that the unit tests can be compiled both as one single executable and as separate executables on both Windows and Posix. Being able to catch circular dependencies and test dmd's efficiency with a single executable is very valuable, but we also want the unit tests to run quickly. So, having both is valuable. And honestly, if compiling the Windows unit tests takes longer when compiling separately (as currently appears to be the case), I'd argue that we should favor having the single executable on Windows rather than splitting them up. The primary gain from splitting them that I see is to cut down on the time it takes to compile and run them. And losing the ability to have Phobos find its own circular dependencies is definitely a problem, so having no unit test builds that build everything as one is defnitely a problem. And as for circular dependencies, if those are a problem, then I think that the language should be improved to provide a way to resolve them. They're frequently a pain to find and problematic to fix. We've found workarounds thus far, but it's definitely one of the language's rough edges. So, if they're causing us more problems, we should find a way to fix the problem in general, not just work around it in Phobos' unit tests. |
I think the dependencies for module features and for unit tests is definitely different. It is real problem. In pull #276, I've add a dependent from Speed up testing is not main purpose. I've added parallel testing for it, but I don't argue to change it default. |
I don't see any reason to leave this open, given that Walter's against it, and it's obviously not being merged in at this point. I think that if we want to make changes like this moving forward, we should make it possible to build both all of the unit tests at once and all separately on both Posix and Windows so that we can get the benefit of both tests. But I think that the default of having Posix build separately and Windows build together is good, given that it gets us the chance to test Phobos being both built separately and together. As for the circular dependency between std.datetime and std.windows.registry, it's no longer an issue, since std.datetime no longer has any static constructors, and in general, it seems the consensus that we need to avoid static constructors in Phobos if we can, since they not only can cause circular dependencies, but they end up increasing the size of executables. |
Merge remote-tracking branch 'upstream/stable' into merge_stable
Change the way to run unit testings in Windows like in Posix.
In Posix, unit testing is done for each module, but in Windows,
unittest.exe
that contains all the unit testings is generated and runs.But the way for Windows is bad, because it introduce unnecessary dependencies for unit testings.
Example:
std.conv
is imported instd.algorithm
for usingto
template function, butto
is only used in unittest blocks, not in algorithm functions. The dependency is only necessary for unit testing, not need for main features ofstd.algorithm
.We should run unit testing like Posix, but in Windows DigitalMars make is less usable than GNU make in Posix. Then I wrote simple utility for the purpose (I don't like request cygwin-make for Phobos unit testing).
eachtest.d
is only dependent to druntime, not to Phobos`, and doesn't need strange cycle dependencies.I think this isn't the best, but is the better way.