da-viper wrote:
> we need to make sure this behaves correctly with all our supported Python
> versions.
I currently run test on the minimum version (3.8) and 3.14.
>The new PExpect test covers the case of using a TTY, but do we have existing
>tests that do the same when we're redirecting input and setting the input
>programmatically through the SB API?
We already have tests in python for the one line command (`(lldb) script
print(hello)`) but not for entering the python interpreter.
i.e
```sh
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
>>> print(hello)
```
I have added two new basic test for both sending the input through the `SBAPI`
and through `stdio`.
This does not cover testing the below scenarios because, it did not work prior
to this commit on any python version. It greatly increases the scope of the PR
and should be in a different commit:
- ### Test echoing python commands sent from a file or stdin.
this is not supported by `ScriptInterpreterPython`
https://github.com/llvm/llvm-project/blob/67404745171125f1d68c629973b0e978986869f6/lldb/source/Interpreter/CommandInterpreter.cpp#L3374-L3382
- ### Test rentering the python console.
test with `lldb < input` or `cat | input lldb` or `(lldb) command source
./input`
```sh
version
script --language python --
print("first time")
exit
script --language python --
print("in here a second time")
exit
version
```
wrong output
```sh
$ lldb < input
(lldb) version
lldb version 22.0.0git ([email protected]:da-viper/llvm-project.git revision
f8bb85a52efef0b75503e7e3404476dcf5e97e25)
clang revision f8bb85a52efef0b75503e7e3404476dcf5e97e25
llvm revision f8bb85a52efef0b75503e7e3404476dcf5e97e25
(lldb) script --language python --
Python Interactive Interpreter. To exit, type 'quit()', 'exit()'.
>>> first time
>>> now exiting InteractiveConsole...
```
https://github.com/llvm/llvm-project/pull/174216
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits