Skip to content
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

Run built-in unit tests in Windows builds (dmd-only) #315

Merged
merged 33 commits into from
Oct 3, 2020

Conversation

jondegenhardt
Copy link
Contributor

@jondegenhardt jondegenhardt commented Oct 2, 2020

This PR adds built-in unit tests to the Window CI test suite. It follows-on PR #313, which successfully got a dub compile and build to run. At present the built-in unit tests are run on DMD only. LDC produces a small number of deltas due to differences in format output (more detail below).

Using make unittest has the effect of running all the built-in unit tests (in the source code files). However, it does not run the command line test suite (make test). The built-in unit tests are a substantial indication of progress though.

This PR makes a number of small code changes to accommodate Windows. The main changes where:

  • Disallowed implicit conversions from long to uint. These cases do not surface on MacOS or Linux builds. May be related to 32-bit Windows builds (the default).
  • Explicitly closing files opened as part of unit tests. This showed up in the unit tests of many tools. The most clearest cause is when rmdirRecurse is used to delete all the temporary files created during the unit test. On Windows, out-of-scope references are apparently not getting cleaned up quick enough, generating a failure. There may be other cases as well.
  • All cases of I/O were changed to use binary mode rather than text mode. This puts the tools in the position of using Unix newlines on all platforms, including Windows. This may or may not be the ultimate policy, but it is by far the fastest way to get started. See issue Inconsistent newline handling on Windows #310 for further discussion of newline handling on Windows.
  • The std.format.format function produces result that are inconsistence the Linux/MacOS builds. In particular, the f format with a precision value is truncating rather than rounding on Windows platforms. This is a bug. To make the unittest suite pass a set of unit tests for formatNumber in numerics.d were disabled on Windows builds. The DMD and LDC compilers produce different deltas, but both produce incorrect values. This is causing some unittest failures in tsv-sample unittests under LDC that don't occur with DMD.

An attempt was to run command line tests with make test. This will take more work, because the error tests produce Windows newline results on Windows, but the gold set was generated On Unix. It will take more time to identify a reasonable way to rectify these cases without also compromising the non-error tests. (Error messages, help messages, etc., should generate Windows newlines, on Windows, even if regular TSV results output generates Unix newlines.

Overall these changes go a long way towards having a solid Windows test platform.

@jondegenhardt jondegenhardt changed the title Try 'make test' in Windows builds Run built-in unit tests in Windows builds (dmd-only) Oct 3, 2020
@jondegenhardt jondegenhardt merged commit 959eb33 into eBay:master Oct 3, 2020
@jondegenhardt jondegenhardt deleted the windows-test-build-oct2020 branch October 3, 2020 18:46
@jondegenhardt jondegenhardt mentioned this pull request Oct 4, 2020
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant