[PATCH] D22827: [test/gold] Add gold test subdirectory tests needing v1.12 (or higher)

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 13:27:41 PDT 2016


That works, however AFAIK you better use this:

    ld_cmd = subprocess.Popen([config.gold_executable, '-v'], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
    ld_out, _ = ld_cmd.communicate()
    ld_out = ld_out.decode()

or you have a chance that the process deadlocks when the stderr buffer runs full while you wait for stdout output. (I've only seen this happening with kilobytes of output so it probably won't be an issue here, but I couldn't stop noticing...)

- Matthias

> On Jul 28, 2016, at 12:02 PM, Teresa Johnson <tejohnson at google.com> wrote:
> 
> 
> 
> On Thu, Jul 28, 2016 at 11:51 AM, Matthias Braun <matze at braunis.de <mailto:matze at braunis.de>> wrote:
> MatzeB added a subscriber: MatzeB.
> MatzeB added a comment.
> 
> This leads to the output of "ld -v" getting shown on my terminal every time I run "ninja check-llvm" on my macOS system.
> (For some reason lit.site.cfg also has config.gold_executable pointing to /usr/bin/ld even though I am pretty sure that is not a gold linker on my machine).
> 
> Sorry about that! I just checked on my Mac, and it looks like the output of ld -v goes to stderr not stdout. I think this will fix it, can you give it a try? I don't have an LLVM checkout/build on my Mac, it would take me some time to figure out how to get that set up.
> 
>  diff --git a/test/tools/gold/X86/v1.12/lit.local.cfg b/test/tools/gold/X86/v1.12/lit.local.cfg
> index 3ac6f01..2b0f58c 100644
> --- a/test/tools/gold/X86/v1.12/lit.local.cfg
> +++ b/test/tools/gold/X86/v1.12/lit.local.cfg
> @@ -6,7 +6,7 @@ def is_gold_v1_12_linker_available():
>    if not config.gold_executable:
>      return False
>    try:
> -    ld_cmd = subprocess.Popen([config.gold_executable, '-v'], stdout = subprocess.PIPE)
> +    ld_cmd = subprocess.Popen([config.gold_executable, '-v'], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
>      ld_out = ld_cmd.stdout.read().decode()
>      ld_cmd.wait()
>    except:
> 
> 
> 
> Repository:
>   rL LLVM
> 
> https://reviews.llvm.org/D22827 <https://reviews.llvm.org/D22827>
> 
> 
> 
> 
> 
> 
> -- 
> Teresa Johnson |	 Software Engineer |	 tejohnson at google.com <mailto:tejohnson at google.com> |	 408-460-2413

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160728/bbe8ebde/attachment.html>


More information about the llvm-commits mailing list