[cfe-commits] [PATCH] clang/test/Tooling: Tweaks for Win32 hosts
Manuel Klimek
klimek at google.com
Wed May 23 08:27:33 PDT 2012
On Wed, May 23, 2012 at 1:58 PM, NAKAMURA Takumi <geek4civic at gmail.com>wrote:
> 2012/5/23 Michael Spencer <bigcheesegs at gmail.com>:
> > On Tue, May 22, 2012 at 5:50 PM, NAKAMURA Takumi <geek4civic at gmail.com>
> wrote:
> >> They could pass also on msvc if they were -fms-compatibility tolerant.
> >>
> >> Manuel, I would be happier if you could tweak tests with -target
> i686-win32.
> >>
> >> ---
> >> clang/lib/Tooling/CompilationDatabase.cpp | 8 ++++++--
> >> clang/lib/Tooling/Tooling.cpp | 8 ++++++--
> >> clang/test/Tooling/clang-check-builtin-headers.cpp | 2 +-
> >> clang/test/Tooling/clang-check-chdir.cpp | 2 +-
> >> clang/test/Tooling/clang-check-pwd.cpp | 2 +-
> >> clang/test/Tooling/clang-check.cpp | 2 +-
> >> llvm/lib/Support/PathV2.cpp | 3 +++
> >> 7 files changed, 19 insertions(+), 8 deletions(-)
> >
> > + // FIXME: Does Win32 accept '.\\'?
> >
> > Yes it does. Well, cmd.exe does.
>
> I would like to say here, "Could Win32's '.\\' be accepted here?"
> I have to add later. I think it would be critical issue.
>
> > diff --git a/clang/test/Tooling/clang-check-builtin-headers.cpp
> > b/clang/test/Tooling/clang-check-builtin-headers.cpp
> > index 4324dec..b640d05 100644
> > --- a/clang/test/Tooling/clang-check-builtin-headers.cpp
> > +++ b/clang/test/Tooling/clang-check-builtin-headers.cpp
> > @@ -1,7 +1,7 @@
> > // RUN: rm -rf %t
> > // RUN: mkdir %t
> > // Add a path that doesn't exist as argv[0] for the compile command
> line:
> > -// RUN: echo '[{"directory":".","command":"/random/tool -c
> > %t/test.cpp","file":"%t/test.cpp"}]' > %t/compile_commands.json
> > +// RUN: echo '[{"directory":".","command":"/random/tool -c
> > %t/test.cpp","file":"%t/test.cpp"}]' | sed -e 's/\\/\//g' >
> > %t/compile_commands.json
> > // RUN: cp "%s" "%t/test.cpp"
> > // RUN: clang-check "%t" "%t/test.cpp" 2>&1|FileCheck %s
> > // FIXME: Make the above easier.
> > diff --git a/clang/test/Tooling/clang-check-chdir.cpp
> > b/clang/test/Tooling/clang-check-chdir.cpp
> > index 5d02c95..7c465f3 100644
> > --- a/clang/test/Tooling/clang-check-chdir.cpp
> > +++ b/clang/test/Tooling/clang-check-chdir.cpp
> > @@ -2,7 +2,7 @@
> > // compilation database.
> > // RUN: rm -rf %t
> > // RUN: mkdir %t
> > -// RUN: echo "[{\"directory\":\"%t\",\"command\":\"clang -c test.cpp
> > -I.\",\"file\":\"%t/test.cpp\"}]" > %t/compile_commands.json
> > +// RUN: echo "[{\"directory\":\"%t\",\"command\":\"clang -c test.cpp
> > -I.\",\"file\":\"%t/test.cpp\"}]" | sed -e 's/\\/\//g' >
> > %t/compile_commands.json
> > // RUN: cp "%s" "%t/test.cpp"
> > // RUN: touch "%t/clang-check-test.h"
> > // RUN: clang-check "%t" "%t/test.cpp" 2>&1|FileCheck %s
> > diff --git a/clang/test/Tooling/clang-check-pwd.cpp
> > b/clang/test/Tooling/clang-check-pwd.cpp
> > index 96417df..40336cb 100644
> > --- a/clang/test/Tooling/clang-check-pwd.cpp
> > +++ b/clang/test/Tooling/clang-check-pwd.cpp
> > @@ -1,6 +1,6 @@
> > // RUN: rm -rf %t
> > // RUN: mkdir %t
> > -// RUN: echo "[{\"directory\":\".\",\"command\":\"clang++ -c
> > %t/test.cpp\",\"file\":\"%t/test.cpp\"}]" > %t/compile_commands.json
> > +// RUN: echo "[{\"directory\":\".\",\"command\":\"clang++ -c
> > %t/test.cpp\",\"file\":\"%t/test.cpp\"}]" | sed -e 's/\\/\\\\/g' >
> > %t/compile_commands.json
> > // RUN: cp "%s" "%t/test.cpp"
> > // RUN: PWD="%t" clang-check "%t" "test.cpp" 2>&1|FileCheck %s
> > // FIXME: Make the above easier.
> > diff --git a/clang/test/Tooling/clang-check.cpp
> > b/clang/test/Tooling/clang-check.cpp
> > index d197078..d37d14d 100644
> > --- a/clang/test/Tooling/clang-check.cpp
> > +++ b/clang/test/Tooling/clang-check.cpp
> > @@ -1,6 +1,6 @@
> > // RUN: rm -rf %t
> > // RUN: mkdir %t
> > -// RUN: echo '[{"directory":".","command":"clang++ -c
> > %t/test.cpp","file":"%t/test.cpp"}]' > %t/compile_commands.json
> > +// RUN: echo '[{"directory":".","command":"clang++ -c
> > %t/test.cpp","file":"%t/test.cpp"}]' | sed -e 's/\\/\//g' >
> > %t/compile_commands.json
> > // RUN: cp "%s" "%t/test.cpp"
> > // RUN: clang-check "%t" "%t/test.cpp" 2>&1|FileCheck %s
> > // FIXME: Make the above easier.
> >
> > For all these tests can we please not use sed? I'd like to get rid of
> > all dependencies on these tools so Windows can test without GNUWin32.
>
> It would be happier if we would get rid of external tools.
> Then, shall we enhance Lit to expand %X with modifier to be escaped for
> JSON?
>
> Not only sed(1), I can see but also echo(1), cat(1) and cp(1) :p
> Would you like to prune them anyways?
I'm still not sure what our strategy for path handling on windows is...
There are multiple strategies I've seen work. Simple strategies are:
1. accept any path format, convert all paths to an internal representation
when they enter the application, output according to platform; this might
be combined with having a real Path abstraction that programmers can use
instead of having strings for paths
2. accept only platform specific path format and use paths verbatim;
double-special case path handling everywhere
Can somebody enlighten me what clang's strategy is?
Cheers,
/Manuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120523/7693ec85/attachment.html>
More information about the cfe-commits
mailing list