[test][lldb-vscode] Relax assertion to allow multiple compile units returned.
authorJordan Rupprecht <rupprecht@google.com>
Thu, 22 Dec 2022 13:19:29 +0000 (05:19 -0800)
committerJordan Rupprecht <rupprecht@google.com>
Thu, 22 Dec 2022 13:19:29 +0000 (05:19 -0800)
I don't think the intent of this test is to make sure we only have one compile unit; it's to make sure request_compileUnits returns something sensible. Relax the test case to just make sure that the main source file is one of the compile units returned, even if there are others.

Fixes llvm.org/pr49418.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D138344

lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py

index b56bf98..fe168ad 100644 (file)
@@ -73,7 +73,6 @@ class TestVSCode_module(lldbvscode_testcase.VSCodeTestCaseBase):
 
     @skipIfWindows
     @skipIfRemote
-    @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr49418")
     def test_compile_units(self):
         program = self.getBuildArtifact("a.out")
         self.build_and_launch(program)
@@ -86,7 +85,5 @@ class TestVSCode_module(lldbvscode_testcase.VSCodeTestCaseBase):
         moduleId = self.vscode.get_modules()['a.out']['id']
         response = self.vscode.request_compileUnits(moduleId)
         self.assertTrue(response['body'])
-        self.assertEqual(len(response['body']['compileUnits']), 1,
-                        'Only one source file should exist')
-        self.assertEqual(response['body']['compileUnits'][0]['compileUnitPath'], main_source_path,
-                        'Real path to main.cpp matches')
+        cu_paths = [cu['compileUnitPath'] for cu in response['body']['compileUnits']]
+        self.assertIn(main_source_path, cu_paths, 'Real path to main.cpp matches')