[clang-tools-extra] r191213 - Added tests for testing migration of files in a compilation database.

Bernal, Ariel J ariel.j.bernal at intel.com
Tue Sep 24 07:40:19 PDT 2013


Actually, it was the wrong directory, I got it fixed in r191215.
I'm not sure about %T vs. %t, I was being consistent with the other tests, should we use %t instead?


-----Original Message-----
From: Jordan Rose [mailto:jordan_rose at apple.com] 
Sent: Monday, September 23, 2013 6:37 PM
To: Bernal, Ariel J
Cc: cfe-commits at cs.uiuc.edu Commits
Subject: Re: [clang-tools-extra] r191213 - Added tests for testing migration of files in a compilation database.


On Sep 23, 2013, at 11:37 , Ariel J. Bernal <ariel.j.bernal at intel.com> wrote:

> Author: ajbernal
> Date: Mon Sep 23 13:37:32 2013
> New Revision: 191213
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=191213&view=rev
> Log:
> Added tests for testing migration of files in a compilation database.
> 
> This patch also fixes the case where a compilation database is 
> autodetected from source but the file itself cannot be found in the 
> compilation database, it then ignores the compilation database and transforms the file with c++11 support.
> 
> Added:
>    clang-tools-extra/trunk/test/clang-modernize/Compilations/
>    clang-tools-extra/trunk/test/clang-modernize/Compilations/Inputs/
>    clang-tools-extra/trunk/test/clang-modernize/Compilations/Inputs/compilations.cpp
>    clang-tools-extra/trunk/test/clang-modernize/Compilations/Inputs/compilations_expected.cpp
>    clang-tools-extra/trunk/test/clang-modernize/Compilations/Inputs/compile_commands.json
>    clang-tools-extra/trunk/test/clang-modernize/Compilations/Inputs/cpp11.cpp
>    clang-tools-extra/trunk/test/clang-modernize/Compilations/Inputs/cpp11_expected.cpp
>    clang-tools-extra/trunk/test/clang-modernize/Compilations/compilation_inc.cpp
>    clang-tools-extra/trunk/test/clang-modernize/Compilations/compilation_inc_sources.cpp
>    clang-tools-extra/trunk/test/clang-modernize/Compilations/compilation_not_inc.cpp
>    clang-tools-extra/trunk/test/clang-modernize/Compilations/detect_from_path.cpp
>    clang-tools-extra/trunk/test/clang-modernize/Compilations/detect_from_source.cpp
>    clang-tools-extra/trunk/test/clang-modernize/Compilations/fixed_comp.cpp
>    clang-tools-extra/trunk/test/clang-modernize/Compilations/fixed_comp_inc.cpp
>    
> clang-tools-extra/trunk/test/clang-modernize/Compilations/no_compilati
> on.cpp
> Modified:
>    clang-tools-extra/trunk/clang-modernize/tool/ClangModernize.cpp
> 

> Added: 
> clang-tools-extra/trunk/test/clang-modernize/Compilations/compilation_
> not_inc.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang
> -modernize/Compilations/compilation_not_inc.cpp?rev=191213&view=auto
> ======================================================================
> ========
> --- 
> clang-tools-extra/trunk/test/clang-modernize/Compilations/compilation_
> not_inc.cpp (added)
> +++ clang-tools-extra/trunk/test/clang-modernize/Compilations/compilat
> +++ ion_not_inc.cpp Mon Sep 23 13:37:32 2013
> @@ -0,0 +1,24 @@
> +// The following block tests:
> +//   - A compilation database is detected from build path specified by -p but
> +//     neither sources nor -include was provided.
> +
> +// Create directory structure
> +// a1, a2  and a3 are specified paths for files in the compilation database.
> +// RUN: rm -rf %T/CompilationNotInc
> +// RUN: mkdir -p %T/CompilationNotInc // RUN: mkdir -p 
> +%T/CompilationNotInc/a1 // RUN: mkdir -p %T/CompilationNotInc/a2 // 
> +RUN: mkdir -p %T/CompilationNotInc/a3
> +
> +// This test uses a compilation database // RUN: sed -e 
> +'s#$(path)#%/T/CompilationNotInc#g' %S/Inputs/compile_commands.json > 
> +%T/CompilationNotInc/compile_commands.json
> +
> +// Check that no files are tranformed when -p is specified but not -include.
> +// RUN: cp %S/Inputs/compilations.cpp %T/DetectFromSource/a1 // RUN: 
> +cp %S/Inputs/compilations.cpp %T/DetectFromSource/a2 // RUN: cp 
> +%S/Inputs/compilations.cpp %T/DetectFromSource/a3
> +
> +// RUN: not clang-modernize -use-nullptr -p=%T/CompilationNotInc // 
> +RUN: not diff -b %T/compilations_expected.cpp 
> +%T/CompilationNotInc/a1/compilations.cpp
> +// RUN: not diff -b %T/compilations_expected.cpp 
> +%T/CompilationNotInc/a2/compilations.cpp
> +// RUN: not diff -b %T/compilations_expected.cpp 
> +%T/CompilationNotInc/a3/compilations.cpp

You forgot to mkdir -p %T/DetectFromSource. (Also, why use %T instead of %t?)




More information about the cfe-commits mailing list