The currently used bash uploader is deprecated and will be removed in
the future[1]. This commit replaces the existing setup with the new
uploader for all currently supported platforms as proposed in [2].
Additional notes:
- FreeBSD support isn't supported yet and keeps using the old uploader
- Moved the new implementation into a dedicated file `source`d by
all coverage CI's (instead of changing each individual configuration)
[1] https://about.codecov.io/blog/codecov-uploader-deprecation-plan
[2] https://about.codecov.io/blog/introducing-codecovs-new-uploader
Enabling CTFE coverage for CircleCI requires a more recent host compiler
(>= 2.094.0). Adapted `build.d` and `posix.mak` as well because they
should always use the same bootstrap version.
PIC=1 was added during the NO_PIC/PIC transition before DMD defaulted to
PIC code on Linux. PIC=1 is has been the default for many years now and
on modern Linux distributions it's even the only way to execute
binaries.
.. instead of `src`. This ensures that error messages, coverage data, ...
will be reported relative to the root directory as expected by many IDE's.
Also adjusted the CodeCov script to deal with the new paths.
The d_do_test and sanitize_json rules can be processed in parallel.
Additionally, the d_do_test executable can be built while its unittests
are built & run in the background (both take around 8 seconds on my box
with LDC).
These tools are prerequisites for the runnable/compilable/fail tests and
are thus built before running the actual tests.
These changes save a total of about 10 seconds on my box with LDC.
The best parallelization for a full test run is achieved via
`DMD_TESTSUITE_MAKE_ARGS="-j<N>" make start_all_tests`; the CI scripts
have been adapted accordingly.
Circle wasn't parallelized at all, and AppVeyor/Semaphore only ran the
blocks (runnable/compilable/fail_compilation) in parallel, which scales
very badly (as runnable is by far the longest one, and there's just 3
blocks) and yields a mixed output.
This will allow to use the compiler as a library to implement more
unit test like tests. These tests will be able to inspect the
internals of the compiler to perform new kinds of tests that are not
possible today.
Unit tests live in the `test/unit` directory. They are written using
the built-in `unittest` blocks. The unit test framework supports
callbacks executed before and after each test. The unit test runner
allows to limit the tests executed either by file(s) and/or by UDAs.
Example:
```d
module self_test;
import support : afterEach, beforeEach;
@beforeEach initializeFrontend()
{
import dmd.frontend : initDMD;
initDMD();
}
@afterEach deinitializeFrontend()
{
import dmd.frontend : deinitializeDMD;
deinitializeDMD();
}
@("self test")
unittest
{
import std.algorithm : each;
import dmd.frontend;
findImportPaths.each!addImport;
auto t = parseModule("test.d", q{
int a = 3;
});
assert(!t.diagnostics.hasErrors);
assert(!t.diagnostics.hasWarnings);
}
```
* To run all unit tests, run: `./run.d -u`
* To run only the unit tests in a single file, run: `./run.d -u unit/self_test.d`
* To run only the unit tests matching a UDA, run: `./run.d -u --filter "self test"`
On auto-tester the version string is:
HOST_CXX(c++): c++ (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CircleCi offers:
c++ (Debian 4.9.2-10) 4.9.2 Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE