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

Dan Gohman gohman at apple.com
Tue Jul 14 17:18:15 PDT 2009


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




More information about the llvm-commits mailing list