weixin_39822993 2020-11-30 11:25
浏览 1

Summary diffs always fail when running the tests on Windows

Originally reported on Google Code with ID 53


When running the tests on Windows, _CompareExpectedAndActualSummaries always generates
failures as it detects differences in the paths embedded in the summary:

Unexpected summary diffs for tests\system_namespaces.cc:
+++
@@ -1,10 +1,10 @@
-tests/system_namespaces.cc should add these lines:
+tests\system_namespaces.cc should add these lines:
 namespace notsys_ns { template <typename t> class TplClass; }

-tests/system_namespaces.cc should remove these lines:
+tests\system_namespaces.cc should remove these lines:
 - #include "tests/system_namespaces-d3.h"  // lines XX-XX

-The full include-list for tests/system_namespaces.cc:
+The full include-list for tests\system_namespaces.cc:
 #include "tests/system_namespaces-d1.h"  // for StdClass
 #include "tests/system_namespaces-d2.h"  // for SystemClass
 namespace notsys_ns { template <typename t> class TplClass; }

---

I had thought to make PrintableDiffs canonicalise 'filename' on entry, but as the path
is preserved as specified on the command line, it's possible to fix this entirely within
iwyu_test_util.py.

A simpler fix is to do the following fixup on entry to TestIwyuOnRelativeFile:

cc_file = cc_file.replace("\\","/")
cpp_files_to_check = [file.replace("\\","/") for file in cpp_files_to_check]

I'm assuming that these calls to replace() will no-op on Linux, but I could guard that
code with 'if sys.platform == 'win32':' if that would be preferable.

</typename></typename>

Reported by paul.holden on 2011-07-16 17:50:21

该提问来源于开源项目:include-what-you-use/include-what-you-use

  • 写回答

7条回答 默认 最新

  • weixin_39822993 2020-11-30 11:25
    关注
    
    Looks good to me.  Feel free to commit.
    
    One style nit: should be space after the comma in "\\","/" (two places).
    

    Reported by csilvers on 2011-07-18 23:55:39 - Status changed: Started

    评论

报告相同问题?