Difference between revisions of "GDC/Test Suite"
(Add information about unit tests) |
(Add information on how to run the test suite with cross-compilers) |
||
Line 2: | Line 2: | ||
== Running the testsuite == | == Running the testsuite == | ||
+ | |||
Execute this command in the directory where you've run '''configure''' (see [[GDC/Installation]]) to run the D test suite: | Execute this command in the directory where you've run '''configure''' (see [[GDC/Installation]]) to run the D test suite: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 67: | Line 68: | ||
./unittest | tee unittest.log | ./unittest | tee unittest.log | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | == Testing Cross-compilers == | ||
+ | |||
+ | === Initial setup === | ||
+ | |||
+ | In order to test a cross compiler we'll need a remote system which can run the binaries generated by the cross compiler. The remote system needs to have working | ||
+ | ssh and scp access. Also make sure that the user that'll execute the tests on the remote system can log in via ssh without entering a password (https://wiki.archlinux.org/index.php/SSH_Keys). | ||
+ | |||
+ | Edit or create ''~/.dejagnurc'' and add this line: | ||
+ | <syntaxhighlight lang="tcl"> | ||
+ | lappend boards_dir "~/.dejagnu.d" | ||
+ | #This line is a bug-workaround | ||
+ | #See http://osdir.com/ml/sysutils.dejagnu.general/2003-06/msg00078.html | ||
+ | lappend boards_dir /usr/share/dejagnu | ||
+ | </syntaxhighlight> | ||
+ | This makes sure that dejagnu will find our new board file. | ||
+ | |||
+ | Then create the board file with this content at: ''~/.dejagnu.d/raspberryhf.exp'' | ||
+ | <syntaxhighlight lang="tcl"> | ||
+ | # Board definition file for board "raspberryhf" | ||
+ | |||
+ | # Network address of board | ||
+ | set_board_info hostname 127.0.0.1 | ||
+ | |||
+ | # How to log into this board via ssh and copy files via scp. | ||
+ | # Ideally, you'll set it up to not need a password to log in via ssh | ||
+ | # (see e.g. http://www-csli.stanford.edu/semlab/muri/system/howto/ssh.html). | ||
+ | set_board_info username gdc | ||
+ | |||
+ | set_board_info shell_prompt "$ " | ||
+ | # For DejaGnu 1.4.3 and above; DejaGnu 1.4.2.x (Debian 3.0) ignores these settings! | ||
+ | set_board_info rsh_prog /usr/bin/ssh | ||
+ | set_board_info rcp_prog /usr/bin/scp | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | Replace 127.0.0.1 with the remote hostname and gdc with the username of the remote user used to execute the tests. The shell_prompt should be set to the shell prompt your remote user sees when logging in. Note: The shell promp should be a constant value, so if your shell prompt shows the current directory, hostname or something similar it should be reconfigured. | ||
+ | |||
+ | |||
+ | Note: dejagnu expects the ssh server to run on port 22. If your ssh server is on a different port you could for example add a local port redirect: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | # Redirect local port 22 to remote-host.org:22 (if your ssh server is reachable on port 22 on the local interface). | ||
+ | # 42640 is the port used to connect to the ssh server. | ||
+ | sudo ssh -fNg -L 22:127.0.0.1:22 jpf@remote-host.org -p 42640 | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | === Running the tests === | ||
+ | |||
+ | We can now run the tests: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | make check-d RUNTESTFLAGS="--target_board=raspberryhf" | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | You should see this output: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | Test Run By jpf on Wed Dec 11 18:01:48 2013 | ||
+ | Target is arm-unknown-linux-gnueabihf | ||
+ | Host is x86_64-build_unknown-linux-gnu | ||
+ | |||
+ | === gdc tests === | ||
+ | |||
+ | Schedule of variations: | ||
+ | raspberryhf | ||
+ | |||
+ | Running target raspberryhf | ||
+ | Using ~/.dejagnu.d/raspberryhf.exp as board description file for target. | ||
+ | Running /home/jpf/Dokumente/d/cttest/.build/src/gcc-custom/gcc/testsuite/gdc.test/d_do_test.exp ... | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | Note: The test files are not being stripped before they're transported using ssh, so the files are actually quite big (~11MB) and cause a lots of traffic. Only use this test method over internet if you have fast internet access.... | ||
+ | |||
+ | See also: http://kegel.com/crosstool/current/doc/dejagnu-remote-howto.html | ||
+ | |||
== 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 17:38, 11 December 2013
Contents
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
Testing Cross-compilers
Initial setup
In order to test a cross compiler we'll need a remote system which can run the binaries generated by the cross compiler. The remote system needs to have working ssh and scp access. Also make sure that the user that'll execute the tests on the remote system can log in via ssh without entering a password (https://wiki.archlinux.org/index.php/SSH_Keys).
Edit or create ~/.dejagnurc and add this line:
lappend boards_dir "~/.dejagnu.d"
#This line is a bug-workaround
#See http://osdir.com/ml/sysutils.dejagnu.general/2003-06/msg00078.html
lappend boards_dir /usr/share/dejagnu
This makes sure that dejagnu will find our new board file.
Then create the board file with this content at: ~/.dejagnu.d/raspberryhf.exp
# Board definition file for board "raspberryhf"
# Network address of board
set_board_info hostname 127.0.0.1
# How to log into this board via ssh and copy files via scp.
# Ideally, you'll set it up to not need a password to log in via ssh
# (see e.g. http://www-csli.stanford.edu/semlab/muri/system/howto/ssh.html).
set_board_info username gdc
set_board_info shell_prompt "$ "
# For DejaGnu 1.4.3 and above; DejaGnu 1.4.2.x (Debian 3.0) ignores these settings!
set_board_info rsh_prog /usr/bin/ssh
set_board_info rcp_prog /usr/bin/scp
Replace 127.0.0.1 with the remote hostname and gdc with the username of the remote user used to execute the tests. The shell_prompt should be set to the shell prompt your remote user sees when logging in. Note: The shell promp should be a constant value, so if your shell prompt shows the current directory, hostname or something similar it should be reconfigured.
Note: dejagnu expects the ssh server to run on port 22. If your ssh server is on a different port you could for example add a local port redirect:
# Redirect local port 22 to remote-host.org:22 (if your ssh server is reachable on port 22 on the local interface).
# 42640 is the port used to connect to the ssh server.
sudo ssh -fNg -L 22:127.0.0.1:22 jpf@remote-host.org -p 42640
Running the tests
We can now run the tests:
make check-d RUNTESTFLAGS="--target_board=raspberryhf"
You should see this output:
Test Run By jpf on Wed Dec 11 18:01:48 2013
Target is arm-unknown-linux-gnueabihf
Host is x86_64-build_unknown-linux-gnu
=== gdc tests ===
Schedule of variations:
raspberryhf
Running target raspberryhf
Using ~/.dejagnu.d/raspberryhf.exp as board description file for target.
Running /home/jpf/Dokumente/d/cttest/.build/src/gcc-custom/gcc/testsuite/gdc.test/d_do_test.exp ...
Note: The test files are not being stripped before they're transported using ssh, so the files are actually quite big (~11MB) and cause a lots of traffic. Only use this test method over internet if you have fast internet access....
See also: http://kegel.com/crosstool/current/doc/dejagnu-remote-howto.html