dejagnu help: spawning with arguments, running ar

Benjamin Kosnik bkoz@redhat.com
Fri Jun 9 16:18:00 GMT 2006


Dejagnu hackers, please help!

I'm currently stymied on two fronts.

The first: right now, a bunch of testsuite utilities are constructed as
part of "make check." There once was a time when these object files
were collected into a simple static library, but this convenience went
the way of the dodo bird..... 

Is there a way to collect object files into a single .a, and run ranlib
on the file?

My first naive attempt fails, utterly (testsuite/lib/libstdc++.exp)

    # Build the support objects.
    set source_files \
	[list testsuite_abi.cc testsuite_allocator.cc testsuite_character.cc testsuite_hooks.cc ]
    foreach f $source_files {
	set object_file [file rootname $f].o
	# Compile with "-w" so that warnings issued by the compiler
	# do not prevent compilation.
	if { [v3_target_compile $srcdir/$f $object_file "object" \
		  [list "incdir=$srcdir" "additional_flags=-w"]]
	     != "" } {
	    error "could not compile $f"
	}
	append v3-test_objs "$object_file "
    }
    ar rc ./libtestc++.a ${object_file}
    ranlib ./libtestc++.a

I don't see any examples of how to run ar (as opposed to
compile/link/assemble) tests in the current gcc testsuite. Am I missing
something? Oddly, running ranlib looks do-able, but trying to use ar
is..... um..... ??

The second: is there an existing, best-practice way to pass arguments
to test executables when they are run?

ie, currently:

spawning command ./pair.exe

want:

spawning command ./pair.exe 1 1000 2

etc, ie, usual argc/argv stuff. 

Of course, only some tests will need this, not all of them. 

-benjamin



More information about the Libstdc++ mailing list