• Jesse McKenna's avatar
    Make autotest.py support forward slash on Windows · 83b6ac1b
    Jesse McKenna authored
    Currently, autotest.py doesn't support the forward slash '/' as a path
    separator on Windows. For example:
    
    Succeeds:
    python3 tools/autotest.py -C out/bug base\at_exit_unittest
    --gtest_filter=*Exit*
    
    Fails:
    python3 tools/autotest.py -C out/bug base/at_exit_unittest
    --gtest_filter=*Exit*
    
    This is because RecursiveMatchFilename() considers a file a match with
    the requested filename if the requested filename is a substring of the
    file's full path. On Windows, file paths as returned by os.scandir()
    use '\\' as a path separator, so a path using '/' will never match
    (e.g. 'base/at_exit_unittest' is not a substring of
    'C:\\src\\chromium\\src\\base\\at_exit_unittest.cc').
    
    With this change, either type of path separator works on Windows.
    
    Change-Id: Ic21eff291d86e7ca994faeda807f6aeaff737562
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2181744
    Commit-Queue: Jesse McKenna <jessemckenna@google.com>
    Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#766500}
    83b6ac1b
autotest.py 8.03 KB