dejagnu help: spawning with arguments, running ar
Dave Korn
dave.korn@artimi.com
Fri Jun 9 16:42:00 GMT 2006
On 09 June 2006 17:18, Benjamin Kosnik wrote:
> 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?
Yeh. Sure. Gotta be!
> 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
Ok, how's that meant to work?!? I don't see anything that suggests you can
just invoke arbitrary executables from an expect script; it's not a shell
script. Take a look at local_exec and remote_exec in
/usr/share/dejagnu/remote.exp; you'd generally want to defer to one of those.
This is how the compiler is invoked, for example; if you follow through
v3_target_compile to gcc/testsuite/lib/gcc.exp:gcc_target_compile to
/usr/share/dejagnu/target.exp:target_compile to default_target_compile to
/usr/share/dejagnu/remote.exp:remote_exec to local_exec you'll eventually see
that you need to build up your command line and wrap it in a construct like
set result [catch "eval spawn \{${commandline}\}" pid];
> 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.
Isn't "Just append them to the commandline that gets spawned" the answer
you're looking for?
cheers,
DaveK
--
Can't think of a witty .sigline today....
More information about the Libstdc++
mailing list