1# REQUIRES: python
2
3# RUN: rm -rf %t && mkdir -p %t/foo/bar/baz
4# RUN: split-file %S/Inputs/relative.split %t/foo
5# RUN: split-file %S/Inputs/hello.split %t/foo/bar
6# RUN: mv %t/foo/bar/hello.py %t/foo/bar/baz
7# RUN: echo 'command source %t/foo/bar/hello.in' >> %t/foo/zip.in
8
9# RUN: %lldb --script-language python \
10# RUN:    -o 'command source %t/foo/magritte.in' \
11# RUN:    -o 'command source %t/foo/zip.in' \
12# RUN:    -o 'command source %t/foo/magritte.in' \
13# RUN;    -o 'zip' \
14# RUN:    -o 'hello'
15# RUN     -o 'magritte' 2>&1 | FileCheck %s
16
17# The first time importing 'magritte' fails because we didn't pass -c.
18# CHECK: ModuleNotFoundError: No module named 'magritte'
19# CHECK-NOT: Ceci n'est pas une pipe
20# CHECK: 95126
21# CHECK: Hello, World!
22# The second time importing 'magritte' works, even without passing -c because
23# we added '%t/foo' to the Python path when importing 'zip'.
24# CHECK: Ceci n'est pas une pipe
25
26# Cannot use `-o` here because the driver puts the commands in a file and
27# sources them.
28command script import -c %t/foo/magritte.py
29quit
30# RUN: cat %s | %lldb --script-language python 2>&1 | FileCheck %s --check-prefix ERROR
31# ERROR: error: command script import -c can only be specified from a command file
32