Remote testing of gcc3

This document is out of date. See kegel.com/crosstool for my latest attempt.

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 hear there's a Tcl debugger, too, but I haven't tried it yet.

I hope the following recipe helps those who just want to test gcc without having to learn the internals of dejagnu.

Resources

Simple steps to test gcc on a remote system

This assumes both the build machine and the test machine are running Red Hat Linux 7.3. The procedure will be similar for many flavors of Unix.

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.

  1. Reformat the hard drive and install a fresh copy of Linux. (Well, you don't have to, but these instructions should work even if you do.)
  2. Install gcc if it isn't already. (It's usually installed by default with Linux.)
  3. Install expect and dejagnu, e.g.
    rpm -i /mnt/cdrom/RedHat/RPMS/{expect,dejagnu}*
    
  4. Unpack gcc3.0.x source tarball and build gcc, e.g.
    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
    
  5. Verify that you can run the gcc tests locally, e.g.
    cd /usr/src/redhat/BUILD/gcc-3.0.1-20010905/obj-i386-redhat-linux/gcc/testsuite
    runtest --tool=g++
    
  6. Configure remote testing machine as follows:
  7. Configure dejagnu for remote testing as follows:
  8. Run test cases:
    # 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
    
Unfortunately, this recipe isn't quite right yet; I see some spurious errors on the remote test. Also, my instructions for setting up .dejagnurc etc. are clearly silly.