[clang-tools-extra] r188299 - Fixes test failure on darwin introduced by r188274

Tareq A. Siraj tareq.a.siraj at intel.com
Tue Aug 13 10:53:01 PDT 2013


Author: tasiraj
Date: Tue Aug 13 12:53:00 2013
New Revision: 188299

URL: http://llvm.org/viewvc/llvm-project?rev=188299&view=rev
Log:
Fixes test failure on darwin introduced by r188274

Reworked how the tests dealt with paths. Instead of removing the full path name,
put a marker in the expected file and replace the marker with the full path
before running diff.

Differential Revision: http://llvm-reviews.chandlerc.com/D1381

Modified:
    clang-tools-extra/trunk/test/cpp11-migrate/HeaderReplacements/common.h.yaml
    clang-tools-extra/trunk/test/cpp11-migrate/HeaderReplacements/main.cpp

Modified: clang-tools-extra/trunk/test/cpp11-migrate/HeaderReplacements/common.h.yaml
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/cpp11-migrate/HeaderReplacements/common.h.yaml?rev=188299&r1=188298&r2=188299&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/cpp11-migrate/HeaderReplacements/common.h.yaml (original)
+++ clang-tools-extra/trunk/test/cpp11-migrate/HeaderReplacements/common.h.yaml Tue Aug 13 12:53:00 2013
@@ -7,6 +7,6 @@ Replacements:
   - Offset:          506
     Length:          2
     ReplacementText: "elem"
-HeaderFileName: "common.h"
-SourceFileName: "main.cpp"
+HeaderFileName: "$(path)/common.h"
+SourceFileName: "$(path)/main.cpp"
 ...

Modified: clang-tools-extra/trunk/test/cpp11-migrate/HeaderReplacements/main.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/cpp11-migrate/HeaderReplacements/main.cpp?rev=188299&r1=188298&r2=188299&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/cpp11-migrate/HeaderReplacements/main.cpp (original)
+++ clang-tools-extra/trunk/test/cpp11-migrate/HeaderReplacements/main.cpp Tue Aug 13 12:53:00 2013
@@ -8,13 +8,13 @@
 // Check that only 1 file is generated per translation unit and header file.
 // RUN: ls -1 %t/Test | grep -c "main.cpp_common.h_.*.yaml" | grep "^1$"
 // RUN: ls -1 %t/Test | grep -c "common.cpp_common.h_.*.yaml" | grep "^1$"
-// We need to remove the path from FileNames in the generated YAML file because it will have a path in the temp directory
-// RUN: sed -i -e 's/^\(HeaderFileName:\|SourceFileName:\).*[\/\\]\(.*\)"$/\1 "\2"/g' %t/Test/main.cpp_common.h_*.yaml
 // RUN: cp %S/common.h.yaml %t/Test/main.cpp_common.h.yaml
+// We need to put the build path to the expected YAML file to diff against the generated one.
+// RUN: sed -e 's#$(path)#%t/Test#g' %S/common.h.yaml > %t/Test/main.cpp_common.h.yaml
+// RUN: sed -i -e 's#\\#/#g' %t/Test/main.cpp_common.h_*.yaml
 // RUN: diff -b %t/Test/main.cpp_common.h.yaml %t/Test/main.cpp_common.h_*.yaml
-// RUN: sed -i -e 's/^\(HeaderFileName:\|SourceFileName:\).*[\/\\]\(.*\)"$/\1 "\2"/g' %t/Test/common.cpp_common.h_*.yaml
-// RUN: cp %S/common.h.yaml %t/Test/common.cpp_common.h.yaml
-// RUN: sed -i -e 's/^SourceFileName: "main.cpp"$/SourceFileName: "common.cpp"/g' %t/Test/common.cpp_common.h.yaml
+// RUN: sed -e 's#$(path)#%t/Test#g' -e 's#main.cpp"#common.cpp"#g' %S/common.h.yaml > %t/Test/common.cpp_common.h.yaml
+// RUN: sed -i -e 's#\\#/#g' %t/Test/common.cpp_common.h_*.yaml
 // RUN: diff -b %t/Test/common.cpp_common.h.yaml %t/Test/common.cpp_common.h_*.yaml
 //
 // The following block tests the following:
@@ -27,9 +27,10 @@
 // Check that only one YAML file is generated from main.cpp and common.h and not from common.cpp and common.h since -header is not specified
 // RUN: ls -1 %t/Test | grep -c "main.cpp_common.h_.*.yaml" | grep "^1$"
 // RUN: ls -1 %t/Test | not grep "common.cpp_common.h_.*.yaml"
-// We need to remove the path from FileName in the generated YAML file because it will have a path in the temp directory
-// RUN: sed -i -e 's/^\(HeaderFileName:\|SourceFileName:\).*[\/\\]\(.*\)"$/\1 "\2"/g' %t/Test/main.cpp_common.h_*.yaml
-// RUN: diff -b %S/common.h.yaml %t/Test/main.cpp_common.h_*.yaml
+// We need to put the build path to the expected YAML file to diff against the generated one.
+// RUN: sed -e 's#$(path)#%t/Test#g' %S/common.h.yaml > %t/Test/main.cpp_common.h.yaml
+// RUN: sed -i -e 's#\\#/#g' %t/Test/main.cpp_common.h_*.yaml
+// RUN: diff -b %t/Test/main.cpp_common.h.yaml %t/Test/main.cpp_common.h_*.yaml
 
 #include "common.h"
 





More information about the cfe-commits mailing list