• Mario Bianucci's avatar
    Allow autotest to collect tests that don't include gtest files · 6b545007
    Mario Bianucci authored
    Autotest checks for gtest files to better determine if a give file is
    actually a test file or not. However, because many files don't actually
    include what they use, many test files don't directly include gtest.h,
    gmock.h, or a test_utils.h file. Instead, they may include those via
    something like sim_test.h, resulting in the script ignoring those files
    right now.
    
    This change improves that by still looking for files that include a
    gtest file, but until it has found at least one file that does, it
    will also collect files that match the test file name regex and do not
    match the gtest include regex. Then, if no files are found with the
    gtest includes, it will move forward under the assumption that the
    file it found without the gtest include was the correct test file.
    
    It will still prefer files with gtest includes, but has a fallback in
    case none exist, providing a best effort chance at building and
    running the tests.
    
    Also includes a small improvement to outputting the file names that
    it finds after a recursive file search.
    
    Change-Id: Ia56792426b55cb17a43ffe2545b4deefb5dba0dd
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2568710
    Commit-Queue: Mario Bianucci <mabian@microsoft.com>
    Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#832607}
    6b545007
autotest.py 15.4 KB