Skip to content

Commit 3ca3ff4

Browse files
committed
Avoid calling os.chdir() in test.
1 parent ef3cb66 commit 3ca3ff4

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
SWIFT_SOURCES := main.swift
2-
3-
include Makefile.rules
1+
all:
2+
$(MAKE) -C "pro:ject"

lldb/test/API/lang/swift/path_with_colons/TestSwiftPathWithColons.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def do_test(self):
4545
copied_src = os.path.join(colon_dir, 'main.swift')
4646
dst = os.path.join(colon_dir, 'a.out')
4747
dst_makefile = os.path.join(colon_dir, 'Makefile')
48+
exe = os.path.join(colon_dir, 'a.out')
4849

4950
if not os.path.exists(colon_dir):
5051
os.makedirs(colon_dir)
@@ -53,26 +54,23 @@ def do_test(self):
5354
# clean slate for the next test case.
5455
def cleanup():
5556
shutil.rmtree(colon_dir)
56-
os.chdir(self.getSourceDir())
5757

5858
# Execute the cleanup function during test case tear down.
5959
self.addTearDownHook(cleanup)
6060

6161
f = open(dst_makefile, 'w')
6262
f.write('''
63-
LEVEL = ../../../../make
6463
SWIFT_SOURCES := main.swift
65-
include $(LEVEL)/Makefile.rules
64+
include Makefile.rules
6665
''')
6766
f.close()
6867

6968
shutil.copy(src, copied_src)
7069

71-
os.chdir(colon_dir)
7270
self.build()
7371

7472
# Create the target
75-
target = self.dbg.CreateTarget(self.getBuildArtifact())
73+
target = self.dbg.CreateTarget(exe)
7674
self.assertTrue(target, VALID_TARGET)
7775

7876
# Don't allow ansi highlighting to interfere with the output.

0 commit comments

Comments
 (0)