Difference between revisions of "GDC/Test Suite"

From D Wiki
Jump to: navigation, search
(Passing options to gdc)
(Add information about unit tests)
Line 43: Line 43:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
where 1200 is the new timeout in seconds.
 
where 1200 is the new timeout in seconds.
 +
 +
== Running unit tests ==
 +
You first have to change the directory to the libdruntime build directory:
 +
<syntaxhighlight lang="bash">
 +
cd objdir/${target_triplet}/libphobos/libdruntime/
 +
</syntaxhighlight>
 +
where ''${target_triplet}'' is something like ''armv6l-unknown-linux-gnueabihf'' or  ''x86_64-unknown-linux''.
 +
 +
Then build the unittests:
 +
<syntaxhighlight lang="bash">
 +
make unittest
 +
</syntaxhighlight>
 +
 +
and run them:
 +
<syntaxhighlight lang="bash">
 +
./unittest | tee unittest.log
 +
</syntaxhighlight>
 +
 +
Now the phobos tests:
 +
<syntaxhighlight lang="bash">
 +
cd ../src
 +
make unittest
 +
./unittest | tee unittest.log
 +
</syntaxhighlight>
  
 
== More information ==
 
== More information ==
 
[http://gcc.gnu.org/install/test.html GCC test suite documentation]
 
[http://gcc.gnu.org/install/test.html GCC test suite documentation]

Revision as of 13:33, 1 December 2013


Running the testsuite

Execute this command in the directory where you've run configure (see GDC/Installation) to run the D test suite:

make check-d

Note: You must have built the gdc compiler using make before running the tests.

The summary and log will be saved in gcc/testsuite/gdc/ as gdc.sum and gdc.log.

XML output

To obtain xml output for the summary, use this command:

make check-d RUNTESTFLAGS="--xml"

Passing options to gdc

To pass an option to gdc which is used in every test run, use this:

make check-d RUNTESTFLAGS="--target_board=unix/-fno-section-anchors"


The unix part must always be included. Flags are then separated by /. For example, to pass -O3 and -fno-section-anchors, use this:

make check-d RUNTESTFLAGS="--target_board=unix/-fno-section-anchors/O3"


To run the testsuite against multiple targets, if testing multilib builds, you'd specify each target as in the following test flags:

make check-d RUNTESTFLAGS="--target_board=unix\{,-m32,-mx32\}"

In this example, the testsuite is ran three times. First using the default target (in this case, -m64), then it runs testsuite generating code for the targets specified (-m32 and -mx32).

Adjusting the timeouts

The test suite always enforces a certain timeout when compiling a testcase with gdc. If you see UNRESOLVED: lines in your build log with a program timed out warning your machine is too slow and you have to increase the default timeouts.

To change the timeout, edit /usr/share/dejagnu/config/unix.exp and add this line at the end:

set_board_info gcc,timeout 1200

where 1200 is the new timeout in seconds.

Running unit tests

You first have to change the directory to the libdruntime build directory:

cd objdir/${target_triplet}/libphobos/libdruntime/

where ${target_triplet} is something like armv6l-unknown-linux-gnueabihf or x86_64-unknown-linux.

Then build the unittests:

make unittest

and run them:

./unittest | tee unittest.log

Now the phobos tests:

cd ../src
make unittest
./unittest | tee unittest.log

More information

GCC test suite documentation