[llvm-commits] [llvm] r75665 - /llvm/trunk/tools/bugpoint/Too lRunner.cpp

Viktor Kutuzov vkutuzov at accesssoftek.com
Tue Jul 14 19:13:59 PDT 2009


> utils/bugpoint/RemoteRunSafely.sh doesn't ever actually return a non- 
> zero exit value. 

It surely returns a non-zero exit code.
It does return a non-zero exit code in case of wrong arguments, missing or
non-executable program file, and in case of any ssh error. For example:

$ ./RemoteRunSafely.sh 192.168.235.175 '/home/vkutuzov/Development/test'
ssh: connect to host 192.168.235.175 port 22: No route to host
script exit 255

-Viktor.

-----Original Message-----
From: Dan Gohman
To: Commit Messages and Patches for LLVM
Sent: 7/14/2009 5:18 PM
Subject: Re: [llvm-commits] [llvm] r75665 -
/llvm/trunk/tools/bugpoint/ToolRunner.cpp


On Jul 14, 2009, at 12:11 PM, Viktor Kutuzov wrote:
>     return RunProgramWithTimeout(OutputBinary, &ProgramArgs[0],
>         sys::Path(InputFile), sys::Path(OutputFile), sys::Path 
> (OutputFile),
>         Timeout, MemoryLimit);
> -  else
> -    return RunProgramWithTimeout(sys::Path(RemoteClientPath),  
> &ProgramArgs[0],
> -        sys::Path(InputFile), sys::Path(OutputFile), sys::Path 
> (OutputFile),
> -        Timeout, MemoryLimit);
> +  } else {
> +    std::cout << "<run remotely>" << std::flush;
> +    int RemoteClientStatus = RunProgramWithTimeout(sys::Path 
> (RemoteClientPath),
> +        &ProgramArgs[0], sys::Path(InputFile), sys::Path(OutputFile),
> +        sys::Path(OutputFile), Timeout, MemoryLimit);
> +    if (RemoteClientStatus != 0) {
> +      std::cerr << "Remote Client failed with an error: " <<
> +        RemoteClientStatus << ".\n" << std::flush;
> +    }
> +  }

There's something very non-obvious happening here.

The code above ignores the ReturnClientStatus value, and there's
no return value. The immediate problem triggered a compiler warning,
which has subsequently been silenced on TOT by making the function
always return 0. That doesn't seem right, since ReturnClientStatus
is still being ignored.

Some things may happen to work, because
utils/bugpoint/RemoteRunSafely.sh doesn't ever actually return a non- 
zero
exit value. There are tests that rely on a non-zero exit value being
noticed, and utils/bugpoint/RemoteRunSafely.sh satisfies this  
requirement
by printing the exit value itself, which is something that bugpoint
normally does.

I don't know how bugpoint's --append-exit-code option is being used in
all of this, but with RemoteRunSafely.sh unconditionally printing the
exit code, it looks like something isn't right.

Is there a reason why RemoteRunSafely.sh doesn't return the program's
exit status, allowing bugpoint to handle it like a normal exit status?

Dan

_______________________________________________
llvm-commits mailing list
llvm-commits at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list