Since I'm building cross-compiling versions of gcc3, I need to be able to do remote testing (where you build on one machine, and run on another). The gcc3 testcases allow this, thanks to dejagnu, a powerful but intricate, confusing, poorly documented, and fragile test framework written in Tcl and Expect.
Since dejagnu's learning curve is steep, I picked the easiest possible remote testing situation: building a non-cross-compiling gcc3 on one x86 redhat box, and running the testcases remotely on another. Once that's working, it ought to be fairly easy to switch to building a cross-compiler and testing on the embedded system of interest.
Dejagnu often misbehaves mysteriously; its error handling is slim. Here are some techniques I had to use to get unstuck:
I hope the following recipe helps those who just want to test gcc without having to learn the internals of dejagnu.
In this example, the build machine is called 'krunch'; the machine that will run the binaries is called 'dual'. Warning: this is just a recipe I cooked up from a position of abject ignorance, so it might not be the right way to do things.
rpm -i /mnt/cdrom/RedHat/RPMS/{expect,dejagnu}*
rpm -i /mnt/cdrom/RedHat/SRPMS/gcc3-3.0.1-3.src.rpm cd /usr/src/redhat/SPECS rpm -bp gcc3.spec cd /usr/src/redhat/BUILD/gcc-3.0.1-20010905/obj-i386-redhat-linux make
cd /usr/src/redhat/BUILD/gcc-3.0.1-20010905/obj-i386-redhat-linux/gcc/testsuite runtest --tool=g++
rpm -i /mnt/cdrom/RedHat/RPMS/wu-ftpd-2.6.2-5.i386.rpm vi /etc/xinetd.d/wu-ftpd (and change 'disable=yes' to 'disable=no') rpm -i /mnt/cdrom/RedHat/RPMS/telnet-server-0.17-20.i386.rpm vi /etc/xinetd.d/telnet (and change 'disable=yes' to 'disable=no') rpm -i /mnt/cdrom/RedHat/RPMS/rsh-server-0.17-5.i386.rpm vi /etc/xinetd.d/rsh (and change 'disable=yes' to 'disable=no') /etc/init.d/xinetd restartThen turn off your firewall, or punch holes through it for telnet and ftp. On RedHat, the basic interactive tool for configuring the firewall is
/usr/sbin/lokkit
telnet: krunchto /etc/hosts.allow.
mkdir ~/tmp
echo 'puts "this is ~/site.exp"' > ~/site.exp echo 'set target dual' > ~/.dejagnurc
load_generic_config "unix"; process_multilib_options ""; set_board_info compiler "[find_gcc]"; set_board_info bmk,use_alarm 1; set_board_info hostname "dual" set_board_info telnet_username "dank" set_board_info telnet_password "xxMyPasswordxx" set_board_info shell_prompt "dank@dual" set_board_info file_transfer "ftp" set_board_info ftp_username "dank" set_board_info ftp_password "spam,bot"
# Tell dejagnu about ~/site.exp and ~/boards export DEJAGNU=/home/dank/site.exp # cd to wherever your gcc setup puts its obj files cd /usr/src/redhat/BUILD/gcc-3.0.1-20010905/obj-i386-redhat-linux/gcc/testsuite # And finally, run the tests of interest. runtest --tool g++ --target_board dual