[Lldb-commits] [lldb] r341425 - Change TestCompletion to only ever look inside of BaseDir

Frederic Riss via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 4 16:09:49 PDT 2018


Author: friss
Date: Tue Sep  4 16:09:49 2018
New Revision: 341425

URL: http://llvm.org/viewvc/llvm-project?rev=341425&view=rev
Log:
Change TestCompletion to only ever look inside of BaseDir

TestCompletion was failing quite frequently on our Linux bots. Some tracing
revealed that when we are iterating BaseDir we are not getting all the entries.
More specifically, we are sometimes missing the entry corresponding to the
TestCompletion directory that the first test in DirCompletionAbsolute is
looking for. BaseDir is the directory where lit is creating all the temporary
files. The semantics of opendir/readdir are unclear when it comes to iterating
over a directory that changes contents, but it seems like on Linux you might
fail to list an entry even if it was there before opendir and is still present
throughout the iteration. Changing the test to only look inside of the test-
specific directory seems to fix the instability.

This commit also removes some assertions that were added to try to track down
this issue.

Modified:
    lldb/trunk/unittests/Interpreter/TestCompletion.cpp

Modified: lldb/trunk/unittests/Interpreter/TestCompletion.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Interpreter/TestCompletion.cpp?rev=341425&r1=341424&r2=341425&view=diff
==============================================================================
--- lldb/trunk/unittests/Interpreter/TestCompletion.cpp (original)
+++ lldb/trunk/unittests/Interpreter/TestCompletion.cpp Tue Sep  4 16:09:49 2018
@@ -164,15 +164,11 @@ TEST_F(CompletionTest, DirCompletionAbso
   // When a directory is specified that doesn't end in a slash, it searches
   // for that directory, not items under it.
   // Sanity check that the path we complete on exists and isn't too long.
-  ASSERT_TRUE(llvm::sys::fs::exists(BaseDir));
-#ifdef PATH_MAX
-  ASSERT_LE(BaseDir.size(), static_cast<size_t>(PATH_MAX));
-#endif
-  size_t Count =
-      CommandCompletions::DiskDirectories(BaseDir, Results, Resolver);
+  size_t Count = CommandCompletions::DiskDirectories(Twine(BaseDir) + "/fooa",
+                                                     Results, Resolver);
   ASSERT_EQ(1u, Count);
   ASSERT_EQ(Count, Results.GetSize());
-  EXPECT_TRUE(HasEquivalentFile(BaseDir, Results));
+  EXPECT_TRUE(HasEquivalentFile(DirFooA, Results));
 
   Count =
     CommandCompletions::DiskDirectories(Twine(BaseDir) + "/.", Results, Resolver);




More information about the lldb-commits mailing list