20 Commits

Author SHA1 Message Date
Chris Johns
eda9325e58 rtemstoolkit: Provide a shlex.join for python 3.8 and earlier 2023-08-30 09:51:47 +10:00
Chris Johns
3ea0c24934 rtemstoolkit: Fix shell execution
The fixes to parse the command along with the pipe options broke
a simple shell command such as '/sbin/sysctl hw.ncpu' on FreeBSD.
This patch fixes the shell command by passing a string for the
various options.

The unit test has been updated to catch errors and report them.

Closes #4951
2023-08-28 16:48:13 +10:00
Muhammad Sulthan Mazaya
bd2d3d5523 rtemstoolkit: Fix shlex.split to use posix mode and add unit test for pipe operation
Turns out subprocess.Popen operates on posix mode. Also, there is an
issue with previous implementation of pipe command that is fixed by
Chris. Now, it can also accepts command in form of a string. The unit
test for that is added via this patch.
2023-06-21 14:30:48 +10:00
Chris Johns
493c8bff70 rtemstoolkil: Fix execute as strings after pipe addition 2023-06-21 10:33:46 +10:00
Muhammad Sulthan Mazaya
38162e17d9 rtemstoolkit: add support for executing pipe command
added unit tests and shorten long lines.
2023-06-21 08:59:41 +10:00
Chris Johns
ca7b290f94 rtemstoolkit/execute: Handle unicode input on python2
- Allow unicode as a type on python2. The unicode type is not
  present on python3 so make the support conditional.
- Add some more diag prints to aid debugging.

Closes #3964
2020-03-30 09:55:02 +11:00
Gedare Bloom
11a481fb94 execute.py: fix long line 2020-03-19 09:33:14 -06:00
Chris Johns
61741fe1b2 rtemstoolkit/execute: Print the trace exe command as a string and not list. 2019-02-08 05:41:03 +11:00
Chris Johns
af5cecfff0 rtemstoolkit: Fixes to the reader and writer threads for capturing
- Use the 'read1' file handle call to return if any data is queued
  for reading from stdout or stderr.
- Flush the stdin pipe in the writer thread.

These changes let the execute module work on Python2 and Python3.
2018-11-26 14:36:44 +11:00
Chris Johns
6fa09650b8 rtemstoolkit/execute: Use buffered output and improve performance
- Use buffered output on the stdout and stderr streams from
  child processors.
- Simplify the read thread line processing to improve performance.
- Disable 'close_fds' as it slows down python3's popen call.
- Update the importing of rtemstoolkit modules.
2018-11-23 14:59:18 +11:00
Chris Johns
9e7ed079b3 rtemstoolkit: Set proc buffering to 0 to not block on smaller reads. 2017-04-25 09:31:37 +10:00
Chris Johns
437092487f execute: Use the io python module for output capture.
This change drops the overhead of capturing the process output. The
io module in Python is similar to the POSIX API for a file read
where a read will return up to the buffer size rather than blocking
until the buffer is full.
2017-04-25 00:32:53 +10:00
Chris Johns
6f8b07c3b6 rtemstoolkit: Fix execute's writer thread to not eval() the input.
The conversion to Python3 added an eval() call which is wrong.

Fix the spelling in execute.

Fix labels in the tester gdb locking.

Check the debug-trace arguments.

Close #2642.
2016-03-14 14:59:11 +11:00
Chris Johns
2de37f3432 Python 2 and python 3 refactor fixes.
Updates #2619.
2016-03-09 14:27:42 +11:00
Chris Johns
b0fa2ae998 Update rtems-tool to support Python 2 and 3.
Add solaris and netbsd.

Close #2619.
2016-03-03 16:53:39 +11:00
Chris Johns
de1beea245 Disable installing PYO and PYC. Fix install paths.
Installing PYO and PYC does not work so disable this. Move the
Python check to the top level and have a single place.

Fix the install paths a revert the 'from . import' changes. This
is resolved by installing into the correct paths.
2016-02-19 11:26:51 +11:00
Sebastian Huber
606c08c8b5 rtemstoolkit: msys2 compatibility 2016-01-08 07:58:54 +01:00
Sebastian Huber
04a52040ae Python 3 compatibility 2015-11-12 11:15:23 +01:00
Chris Johns
c04a84917a tester: Correctly handle contro-c.
Add support to kill running tests if the user presses control-c.
2014-05-31 20:03:05 +10:00
Chris Johns
50fdf12244 rt: Add the rtems-tester. 2014-02-15 06:30:06 +11:00