summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/macosx
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-11-03 02:06:18 +0000
committerZachary Turner <zturner@google.com>2015-11-03 02:06:18 +0000
commit95c453a221d5e757830145c2d5198c3a9da3f4b2 (patch)
treeaa824a74049518ed35ff67e2182f2dfcceac0658 /lldb/packages/Python/lldbsuite/test/macosx
parent6f4ed269b9f4d8296f2002f5d96fcc5d8a9ef7b1 (diff)
downloadbcm5719-llvm-95c453a221d5e757830145c2d5198c3a9da3f4b2.tar.gz
bcm5719-llvm-95c453a221d5e757830145c2d5198c3a9da3f4b2.zip
Tighten up sys.path, and use absolute imports everywhere.
For convenience, we had added the folder that dotest.py was in to sys.path, so that we could easily write things like `import lldbutil` from anywhere and any test. This introduces a subtle problem when using Python's package system, because when unittest2 imports a particular test suite, the test suite is detached from the package. Thus, writing "import lldbutil" from dotest imports it as part of the package, and writing the same line from a test does a fresh import since the importing module was not part of the same package. The real way to fix this is to use absolute imports everywhere. Instead of writing "import lldbutil", we need to write "import lldbsuite.test.util". This patch fixes up that and all other similar cases, and additionally removes the script directory from sys.path to ensure that this can't happen again. llvm-svn: 251886
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/macosx')
-rw-r--r--lldb/packages/Python/lldbsuite/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py2
-rw-r--r--lldb/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py4
-rw-r--r--lldb/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py4
-rw-r--r--lldb/packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py2
-rw-r--r--lldb/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py4
-rw-r--r--lldb/packages/Python/lldbsuite/test/macosx/safe-to-func-call/TestSafeFuncCalls.py4
-rw-r--r--lldb/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py6
7 files changed, 13 insertions, 13 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py b/lldb/packages/Python/lldbsuite/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py
index 4324f0b560a..dc15d054306 100644
--- a/lldb/packages/Python/lldbsuite/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py
+++ b/lldb/packages/Python/lldbsuite/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py
@@ -7,7 +7,7 @@ import use_lldb_suite
import os, time
import lldb
import sys
-from lldbtest import *
+from lldbsuite.test.lldbtest import *
@skipUnlessDarwin
class AddDsymMidExecutionCommandCase(TestBase):
diff --git a/lldb/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py b/lldb/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py
index 50f18b4bbbe..89de99f009d 100644
--- a/lldb/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py
+++ b/lldb/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py
@@ -8,8 +8,8 @@ import use_lldb_suite
import os, time
import lldb
-from lldbtest import *
-from lldbutil import symbol_type_to_str
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbutil import symbol_type_to_str
class AppleTypesTestCase(TestBase):
diff --git a/lldb/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py b/lldb/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py
index 4ec5147e54e..0ebf66b0d8b 100644
--- a/lldb/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py
+++ b/lldb/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py
@@ -6,8 +6,8 @@ import use_lldb_suite
import os, time
import lldb
-import lldbutil
-from lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
class TestIndirectFunctions(TestBase):
diff --git a/lldb/packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py b/lldb/packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py
index b768c3a7afc..dea52ca8789 100644
--- a/lldb/packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py
+++ b/lldb/packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py
@@ -9,7 +9,7 @@ import use_lldb_suite
import os, time
import re
import lldb
-from lldbtest import *
+from lldbsuite.test.lldbtest import *
class OrderFileTestCase(TestBase):
diff --git a/lldb/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py b/lldb/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py
index 879f6c36a03..e7d4045ce2a 100644
--- a/lldb/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py
+++ b/lldb/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py
@@ -7,8 +7,8 @@ import use_lldb_suite
import unittest2
import os, time
import lldb
-import lldbutil
-from lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
class TestQueues(TestBase):
diff --git a/lldb/packages/Python/lldbsuite/test/macosx/safe-to-func-call/TestSafeFuncCalls.py b/lldb/packages/Python/lldbsuite/test/macosx/safe-to-func-call/TestSafeFuncCalls.py
index cb9d7fb53b6..1b66eea4fd4 100644
--- a/lldb/packages/Python/lldbsuite/test/macosx/safe-to-func-call/TestSafeFuncCalls.py
+++ b/lldb/packages/Python/lldbsuite/test/macosx/safe-to-func-call/TestSafeFuncCalls.py
@@ -6,8 +6,8 @@ import use_lldb_suite
import os, time
import lldb
-import lldbutil
-from lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
class TestSafeFuncCalls(TestBase):
diff --git a/lldb/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py b/lldb/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py
index 12e0939224d..b2822a360af 100644
--- a/lldb/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py
+++ b/lldb/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py
@@ -7,8 +7,8 @@ import use_lldb_suite
import unittest2
import os, time
import lldb
-from lldbtest import *
-import lldbutil
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
class UniversalTestCase(TestBase):
@@ -45,7 +45,7 @@ class UniversalTestCase(TestBase):
"requires i386 or x86_64")
def test_process_launch_for_universal(self):
"""Test process launch of a universal binary."""
- from lldbutil import print_registers
+ from lldbsuite.test.lldbutil import print_registers
# Invoke the default build rule.
self.build()
OpenPOWER on IntegriCloud