r363985 - [test][Driver] Fix Clang :: Driver/cl-response-file.c
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 21 11:14:35 PDT 2019
Hi Rainer,
I tried your patch and it still has problems. First, the "%s" was being replaced with the actual path by LIT, so I replaced that with "%%s" which then created the response file correctly, but now the response file contains this:
/IC:\src\git\dev\llvm\tools\clang\test\Driver\Inputs\\cl-response-file\ /DFOO=2
Which unfortunately gets interpreted by the compiler as:
"-I" "C:\\src\\git\\dev\\llvm\\tools\\clang\\test\\Driver\\Inputs\\\\cl-response-file\\" "-D" "FOO=2"
Which doesn't match the CHECK line. Note the 4 backslashes. I think this could probably be fixed by just using a regex to match 1 or more backslashes?
Douglas Yung
-----Original Message-----
From: Rainer Orth <ro at CeBiTec.Uni-Bielefeld.DE>
Sent: Friday, June 21, 2019 7:02
To: Yung, Douglas <douglas.yung at sony.com>
Cc: ro at gcc.gnu.org; cfe-commits at lists.llvm.org
Subject: Re: r363985 - [test][Driver] Fix Clang :: Driver/cl-response-file.c
Hi Douglas,
> Your change appears to have broken the one platform you didn't test,
> Windows. :)
sorry about that. Unfortunately, I know next to nothing about Windows and don't have access to any system to test.
That said...
> Script:
> --
> : 'RUN: at line 7'; printf
> '/IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast
> \llvm.src\tools\clang\test\Driver\Inputs\\cl-response-file\
> /DFOO=2' >
> C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\ll
> vm.obj\tools\clang\test\Driver\Output\cl-response-file.c.tmp.rsp
... I should have looked at the autoconf manual first which has a whole section on the can of worms that is echo and how to properly use printf instead.
> Looking into this locally, the path contains "\t", so the response file that is generated looks like this:
>
> C:\src\git\merge\llvm\tools\clang\test\Driver>type
> cl-response-file.c.tmp.rsp /IC:\src\git\merge\llvm ools
The path not only contains \t, but \c as well, so the path is truncated after " ools".
> Can you take a look to see if there is something that works for all platforms including Windows?
Judging from both the autoconf manual and my local testing, the following should work properly:
// RUN: printf '%s\n' '/I%S\Inputs\\cl-response-file\ /DFOO=2' > %t.rsp
i.e. use printf '%s\n' to do the printing. I should have done this in the first place since otherwise the response file wasn't newline-terminated. Obviously that didn't matter on Solaris and Linux.
Once you've confirmed this works on Windows, I'll submit a proper follow-up patch.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
More information about the cfe-commits
mailing list