Re: Setting environment variables when doing remove execution

Tobias Burnus <[email protected]>
Newsgroups gmane.comp.sysutils.dejagnu.general
Message-ID <[email protected]>
Hi Jacob,

On 11/26/19 12:53 AM, Jacob Bachmeyer wrote:
> As an interim measure, could you simply prepend the needed environment 
> variables to the remote command and/or use env(1)?

I thought of doing this – but while for compiling it is simple, doing so 
for run time is more difficult.

In GCC, one just sets the output_file to the executable (proc 
gcc-dg-test-1 in gcc/testsuite/lib/gcc-dg.exp, which is a call back for 
dg.exp). And the actual handling is in DejaGNU itself:

proc dg-test of lib/dg.exp has:
…
     if { [lindex ${dg-do-what} 0] eq "run" } {
         if {![file exists $output_file]} {
             unresolved "$name compilation failed to produce executable"
         } else {
             set status -1
             set result [${tool}_load $output_file]

which first checks whether "output_file" exists before it runs it (${tool}_load).

If I look at 'proc remote_load' of lib/remote.exp this also does quite some file handling
(copying them, running objcopy etc.) before it finally calls:
        set sumout [remote_exec build $sum_program $prog]

This does not make injecting "env a=val b=val $prog" that simple.

Cheers,

Tobias
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.