[cfe-dev] [Unit Tests] BasicTests filesystem test failures

David Greene via cfe-dev cfe-dev at lists.llvm.org
Mon Oct 1 19:32:30 PDT 2018


These tests are broken on X86-64 and AArch64 SLES 12:

[  FAILED  ] 2 tests, listed below:
[  FAILED  ] VirtualFileSystemTest.BrokenSymlinkRealFSIteration
[  FAILED  ] VirtualFileSystemTest.BrokenSymlinkRealFSRecursiveIteration

/clang/unittests/Basic/VirtualFileSystemTest.cpp:443: Failure
Value of: I->path() == _b
  Actual: false
Expected: true
/clang/unittests/Basic/VirtualFileSystemTest.cpp:443: Failure
Value of: I->path() == _b
  Actual: false
Expected: true
[  FAILED  ] VirtualFileSystemTest.BrokenSymlinkRealFSIteration (1 ms)
[ RUN      ] VirtualFileSystemTest.BasicRealFSRecursiveIteration
[       OK ] VirtualFileSystemTest.BasicRealFSRecursiveIteration (0 ms)
[ RUN      ] VirtualFileSystemTest.BrokenSymlinkRealFSRecursiveIteration
/clang/unittests/Basic/VirtualFileSystemTest.cpp:534: Failure
      Expected: ExpectedBrokenSymlinks.size()
      Which is: 5
To be equal to: VisitedBrokenSymlinks.size()
      Which is: 0
/clang/unittests/Basic/VirtualFileSystemTest.cpp:538: Failure
      Expected: ExpectedNonBrokenSymlinks.size()
      Which is: 5
To be equal to: VisitedNonBrokenSymlinks.size()
      Which is: 10
/clang/unittests/Basic/VirtualFileSystemTest.cpp:541: Failure
Value of: std::equal(VisitedNonBrokenSymlinks.begin(), VisitedNonBrokenSymlinks.end(), ExpectedNonBrokenSymlinks.begin())                                                              
  Actual: false
Expected: true
[  FAILED  ] VirtualFileSystemTest.BrokenSymlinkRealFSRecursiveIteration (1 ms)

The first failures (path inequality) are caused by the directory iterators not
skipping broken symlinks.  I did not dive deeply into the other failures as I
assume they show the same issue.

This commit appears to have caused the regression:

commit 446fa15e649709fc8bde40ed422d1e4794ac9559
Author: Sam McCall <sam.mccall at gmail.com>
Date:   Fri Sep 14 12:47:38 2018 +0000

    [VFS] vfs::directory_iterator yields path and file type instead of full Status
    
    Summary:
    Most callers I can find are using only `getName()`. Type is used by the
    recursive iterator.
    
    Now we don't have to call stat() on every listed file (on most platforms).
    Exceptions are e.g. Solaris where readdir() doesn't include type information.
    On those platforms we'll still stat() - see D51918.
    
    The result is significantly faster (stat() can be slow).
    My motivation: this may allow us to improve clang IO on large TUs with long
    include search paths. Caching readdir() results may allow us to skip many stat()
    and open() operations on nonexistent files.
    
    Reviewers: bkramer
    
    Subscribers: fedor.sergeev, cfe-commits
    
    Differential Revision: https://reviews.llvm.org/D51921
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342232 91177308-0d34-0410-b5e6-96231b3b80d8                                                                                

I am not well versed enough in the VFS layer to propose a fix, but I am
happy to help test patches.

                                    -David



More information about the cfe-dev mailing list