Problems with gcc test

Jeffrey A Law law@hurl.cygnus.com
Thu Sep 4 21:55:00 GMT 1997


  In message <m0x3Qbi-0004ecC@ocean.lucon.org>you write:
  > > 
  > >   In message <m0x3PV6-0004ecC@ocean.lucon.org>you write:
  > >   > Hi,
  > >   > 
  > >   > I have several problems with make check in gcc.
  > >   > 
  > >   > 1. LD_LIBRARY_PATH is not set for g++ test.
  > > Why is this important for libg++ testing?
  > 
  > I am using
  > 
  > # configure --enable-shared
  > 
  > I have a patch for gcc/Makefile.in.
Shouldn't this already be handled correctly?

When you link via "-L../blah" -lfoo and libfoo is found in ../blah
doesn't the executable know how to find libfoo at runtime assuming
you don't move the executable?  Or are additional options necessary
on your target?
(if so, the place to fix this is in the testsuite, not in gcc itself)

  > I have 2 patches. One for gcc, the other for dejagnu. I am
  > enclosing dejagnu's one here. In fact, it applies to all
  > config.guess. The problem with old one is you cannot run
  > 2 config.guess in one directory. Both check-g++ and check-gcc
  > run them.
I'm not particularly comfortable approving a patch to config.guess, so
someone else will have to do that.


  [ -fpic stuff ]
  > Can you send me a patch? I will test it out for you.
I don't have the time.  I think you've got 99.9% of what you need to make
this work.

  > > I even think it went further.  The main c-torture test was compiled
  > > with something like -Dmain=torture_main -fPIC.  The resulting .o
  > > would then be turned into a shared library via gcc -shared.  We'd
  > > then link a .o which just called torture_main against the shared
  > > library and run the resulting executable.
  > > 
  > 
  > It will work for me.
It's somewhat outdated (lots has changed in the testing framework since
1995), but I think you'll find much of what you would need to set up a
real shared library test with c-torture in the appended code.

If I remember right the things that need to be done:

  * Generalize the creation/name of the shared library -- they're different
  for many systems.

  * Add code to execute.exp and ieee.exp to run this test automatically
  if the target supported shared libraries.

  * As part of an initialization routine or something build the real
  main .o file once.  I built it by hand if I remember right when I last
  this test stuff a few years ago.

  * Update to work with changes in framework.


#
# c-torture-pic-execute -- utility to compile and execute a PIC testcase
#
# SRC is the full pathname of the testcase.
#

proc c-torture-pic-execute { src } {
    global CFLAGS tmpdir tool srcdir
    set orig_flags $CFLAGS

    # Look for a loop within the source code - if we don't find one,
    # don't pass -funroll[-all]-loops.
    global torture_with_loops torture_without_loops
    if [expr [search_for $src "for*("]+[search_for $src "while*("]] then {
	set option_list $torture_with_loops
    } else {
	set option_list $torture_without_loops
    }

    set executable $tmpdir/[file tail [file rootname $src].x]
    set doto $tmpdir/[file tail [file rootname $src].o]
    set lib [file tail [file rootname $src]]
    set shlib $tmpdir/lib[file tail [file rootname $src].sl]

    regsub "^$srcdir/?" $src "" name
    # If we couldn't rip $srcdir out of `src' then just do the best we can.
    # The point is to reduce the unnecessary noise in the logs.  Don't strip
    # out too much because different testcases with the same name can confuse
    # `test-tool'.
    if [string match "/*" $name] {
	set name "[file tail [file dirname $src]]/[file tail $src]"
    }

    foreach option $option_list {
	append CFLAGS " $option -Dmain=picmain -fPIC -c -o $doto"
	catch "exec rm -f $doto"
	verbose "Testing $name, $option" 1
	gcc_start $src
	set CFLAGS $orig_flags
	append CFLAGS " -shared -o $shlib"
	catch "exec rm -f $shlib"
	gcc_start $doto
	set CFLAGS $orig_flags
	append CFLAGS "-L$tmpdir/ -l$lib -o $executable"
	catch "exec rm -f $executable"
	gcc_start /tmp/main.o
	if ![file exists $executable] then {
	    fail "$name failed to compile, $option"
	} else {
	    pass "$name compiled, $option"

	    set status [gcc_load "$executable"]
	    switch -- $status {
		0 { 
		    pass "$name executed, $option"
		    catch "exec rm -f $executable"
		}
		1 { 
		    fail "$name aborted, $option" 
		}
		-1 {
		    # Nothing to do, unresolved/untested already called.
		}
		default {
		    perror "Unknown return code from ${tool}_load: $status"
		    # ??? The call to unresolved here is necessary to clear
		    # `errcnt'.  What we really need is a proc like perror
		    # that doesn't set errcnt.  It should also set exit_status
		    # to 1.
		    unresolved "$name: error executing ${tool}_load"
		}
	    }
	}
	set CFLAGS $orig_flags
    }
}




More information about the Gcc mailing list