On Sep 23, 2013, at 11:37 , Ariel J. Bernal <[email protected]> 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_compilation.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/compilation_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?)
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to