Re: [RFA-v2] testsuite: Add a test for passing of environment variables to inferior

Tom Tromey
2011-10-04T17:27:28Z

>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:

Pierre> 2011-10-04 Pierre Muller <muller@ics.u-strasbg.fr>

Pierre> Add tests for passing of environment variables to inferior.
Pierre> * gdb.base/testenv.c: New test source.
Pierre> * gdb.base/testenv.exp: New expect test.

Thanks for doing this.

Pierre> +#ifdef PROTOTYPES
Pierre> +int main (int argc, char **argv, char **envp)

You don't need to handle the no PROTOTYPES case any more.

Pierre> +if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable {debug}] != "" } {
Pierre> + untested testenv.exp
Pierre> + return -1
Pierre> +}
Pierre> +
Pierre> +# Start with a fresh gdb
Pierre> +
Pierre> +gdb_exit
Pierre> +gdb_start
Pierre> +gdb_reinitialize_dir $srcdir/$subdir
Pierre> +gdb_load ${binfile}

You can use prepare_for_testing instead.

Pierre> +runto main

There's a special runto_main proc for this.

Pierre> +gdb_exit
Pierre> +
Pierre> +set env(TEST_GDB_GLOBAL) "Global environment value"
Pierre> +
Pierre> +gdb_start
Pierre> +gdb_reinitialize_dir $srcdir/$subdir
Pierre> +gdb_load ${binfile}

You can use clean_restart here.

Tom