Skip to content

build.d: Add auto-tester-build#10612

Merged
dlang-bot merged 2 commits intodlang:masterfrom
MoonlightSentinel:move-atb
Nov 30, 2019
Merged

build.d: Add auto-tester-build#10612
dlang-bot merged 2 commits intodlang:masterfrom
MoonlightSentinel:move-atb

Conversation

@MoonlightSentinel
Copy link
Contributor

@MoonlightSentinel MoonlightSentinel commented Nov 23, 2019

Draft PR because this should not be merged before #10611 (or another implementation of parallel building) is merged.
Multiple invocations of build.d are mutually exclusive anyway (using a lockfile)

@MoonlightSentinel
Copy link
Contributor Author

This failure seems to be caused by small configuration change when creating all targets from build.d. The unittest failure shows sporadically in master when building using a VS Command Prompt.

../dmd/generated/windows/release/32/dmd.exe -conf= -c -o- -Isrc -Iimport -Hfimport\core\sync\barrier.di src\core\sync\barrier.d 

core.exception.AssertError@dmd\root\bitarray.d(170): unittest failure
----------------
0x00742E89 in _d_unittestp
0x006548CC in void dmd.root.bitarray.__modtest()
0x0074AF3A in int core.runtime.runModuleUnitTests().__foreachbody1(object.ModuleInfo*)
1/21 unittests FAILED

@rainers
Copy link
Member

rainers commented Nov 24, 2019

core.exception.AssertError@dmd\root\bitarray.d(170): unittest failure

I guess this happens because Bitarray is broken: with size_t = uint, (300+31)/32 = 10*4 bytes are allocated for a length of 300 bits, but (300+31)/8 = 41 bytes are compared.

@MoonlightSentinel
Copy link
Contributor Author

MoonlightSentinel commented Nov 24, 2019

I guess this happens because Bitarray is broken

Unittests are not run for Win32, temporary fixup before we move this to build.d: #10614

Could not reliably reprodure the unittest failure using the Makefiles so i will fix it in this PR.

@MoonlightSentinel MoonlightSentinel force-pushed the move-atb branch 3 times, most recently from 691a674 to d8172de Compare November 25, 2019 12:38
@MoonlightSentinel
Copy link
Contributor Author

MoonlightSentinel commented Nov 25, 2019

core.exception.AssertError@dmd\root\bitarray.d(170): unittest failure

I guess this happens because Bitarray is broken: with size_t = uint, (300+31)/32 = 10*4 bytes are allocated for a length of 300 bits, but (300+31)/8 = 41 bytes are compared.

Thanks. I changed (len + BitsPerChunk - 1) / 8 to ((len + BitsPerChunk - 1) / BitsPerChunk) * ChunkSize) because it yields different results for integers contrary to regular math:

Old:
32-Bit: (300 + 32 - 1) / 8 = 331 / 8 => 41
64-Bit: (300 + 64 - 1) / 8 = 363 / 8 => 45

New;
32-Bit: ((300 + 32 - 1) / 32) * 4 = (331 / 32) * 4 => 10 * 4 = 40
64-Bit: ((300 + 64 - 1) / 64) * 8 = (363 / 64) * 8 => 5 * 8 = 40

@WalterBright Fixed that error in the third commit using dedicated functions to calculate the amount of bytes (and chunks). Would you approve using them throughout bitarray.d to avoid such errors in the future (and make the code more readable)?

@MoonlightSentinel MoonlightSentinel force-pushed the move-atb branch 2 times, most recently from e0a1a9c to c6783c6 Compare November 25, 2019 14:50
@rainers
Copy link
Member

rainers commented Nov 26, 2019

I can't say much about build.d, but the changes to bitarray.d are good (you could use chunks() in some places, too). Maybe move these changes to a separate PR?

@MoonlightSentinel
Copy link
Contributor Author

I can't say much about build.d, but the changes to bitarray.d are good (you could use chunks() in some places, too). Maybe move these changes to a separate PR?

Can do, I wanted to keep them in this PR until they are approved because they wont be tested on windows otherwise.

@MoonlightSentinel
Copy link
Contributor Author

@rainers See #10620

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @MoonlightSentinel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + dmd#10612"

@MoonlightSentinel
Copy link
Contributor Author

auto-tester-build should be good to go (I can split off enabling unittests for windows in another PR if preferred)

auto-tester-build: $G dmd checkwhitespace
auto-tester-build: $(GEN)\build.exe
$(RUN_BUILD) "DDEBUG=" "ENABLE_RELEASE=1" $@
copy $(TARGETEXE) .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is copying the final exe necessary? And also why is it necessary to explicitly pass those flags in the previous step?

Copy link
Contributor Author

@MoonlightSentinel MoonlightSentinel Nov 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is copying the final exe necessary?

I don't like this either but the test suite uses dmd/src/dmd.exe

And also why is it necessary to explicitly pass those flags in the previous step?

The executable was previously built by reldmd which invokes make recursively and overrides these flags. Otherwise dmd.exe would be built with -unittest -cov enabled.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanations!

I don't like this either but the test suite uses dmd/src/dmd.exe

Just like the posix.mak files don't expect dmd to be available at this path for the test suite, we should fix the Win32.mak files as well. This obviously outside of the scope of this PR, so I suggest leaving a FIXME comment explaining the situation.

The executable was previously built by reldmd which invokes make recursively and overrides these flags. Otherwise dmd.exe would be built with -unittest -cov enabled.

I think this should be fixed as well (perhaps in a future PR).
Like other targets that build dmd, whether it's build in release mode or debug + unittest, should be configurable based to env variables like ENABLE_RELEASE. We should run the test suite with both asserts enabled and disabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're welcome. I've added FIXMEs for both issues and removed the ENABLE_RELEASE override (DDEBUG is depreacted anyway).

This implies a slight change as the test suite is now run with bound-checks and asserts instead of optimizations but we can add it as an additional run 'from the outside' .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, what I meant that whether optimizations are enabled or disabled should be disabled from outside.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, then I'll would suggest keeping the current behaviour and changing it in another PR

@MoonlightSentinel MoonlightSentinel force-pushed the move-atb branch 4 times, most recently from d62ff77 to 659ce73 Compare November 30, 2019 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants