Difference between revisions of "DMD development"

From D Wiki
Jump to: navigation, search
m (fix formatting)
Line 16: Line 16:
 
=== Running the testsuite on Windows ===
 
=== Running the testsuite on Windows ===
  
If you run the testsuite on Windows, make sure to use GNU make (and not DigitalMars make). You can grab GNU make [https://ftp.gnu.org/gnu/make/ here].
+
If you run the testsuite on Windows, make sure you install
It's often easier to use the [https://docs.microsoft.com/en-us/windows/wsl/about Linux Subsystem], a Posix machine or the CIs at dlang/dmd which will automatically test your pull request on all supported platforms.
+
 
 +
- Bash environment (e.g. [https://git-scm.com/download/win Git for Windows] or [https://github.com/golang/go/wiki/WindowsBuild#install-mingwmsys MYS])
 +
- GNUMake (a bit harder to find, see the built binaries of [https://github.com/dlang/installer/pull/311 this PR] or use <pre>mingw32-make.exe</pre> from a MinGW binary)
 +
 
 +
[https://github.com/CyberShadow/Digger Digger] can install this automatically for you.
 +
If you are looking for an automated way to turn a VirtualBox in a Development Machine, follow [https://gist.github.com/MartinNowak/8270666 these instructions] to create a ssh-accessible Windows box.
  
 
=== Run all tests which haven't been run before ===
 
=== Run all tests which haven't been run before ===

Revision as of 13:59, 7 April 2018

Welcome to the D community and thanks for your interest in contributing! If you need help you can ask questions on #d IRC channel on freenode.org (web interface) or on our forum.

This section explains commonly commands which are commonly used to test the dmd D Programming Language compiler.

Tests

The testsuite is in `~/dlang/dmd/test`. Please go to this directory.

cd ~/dlang/dmd/test

The testsuite will always print the exact command used to run a test, s.t. it's easy to single out and reproduce a failure.

Running the testsuite on Windows

If you run the testsuite on Windows, make sure you install

- Bash environment (e.g. Git for Windows or MYS)

- GNUMake (a bit harder to find, see the built binaries of this PR or use

mingw32-make.exe

from a MinGW binary)

Digger can install this automatically for you. If you are looking for an automated way to turn a VirtualBox in a Development Machine, follow these instructions to create a ssh-accessible Windows box.

Run all tests which haven't been run before

make all -j8

If you you now rerun this command, the testsuite won't execute anything:

make all -j8

However, if you modified the compiler, it will only rerun the failing tests as these don't have an output stored.

Remove test states

The test suite stores the results of run tests to allow re-running only the failed tests. This state is stored in `~/dlang/dmd/test/test_results` and can be removed with:

make clean

Always run all tests

make run_tests -j8

Run an individual test

Sometimes it can be helpful to rerun only a single test which tests the fix or feature one is working on:

make test_results/compilable/test10066.d.out

If you want to force re-evaluation of a single test, simply remove the respective file:

rm test_results/compilable/test10066.d.out
make test_results/compilable/test10066.d.out

Run quick test

Often one makes a small change and wants to quickly know whether this change completely broke the compiler. For this, the target make quick exists:

make quick

Run group of tests

Sometimes it can be useful to run only a subset of tests. The testsuite groups the test in three groups: runnable, compilable and failed_compilation. They can be run individually:

make run_runnable_tests:         # run just the runnable tests
make run_compilable_tests:       # run just the compilable tests
make run_fail_compilation_tests  # run just the fail compilation tests

Run unittests within the compiler

There are a few unittest blocks within the compiler and there usage is increasing. They can be tested with:

cd ~/dlang/dmd/src
make -f posix.mak unittest