Compare commits
4 Commits
bd1cd03334
...
6e31ae971a
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e31ae971a | |||
| e989d131ad | |||
| cc561e961a | |||
| 87066fabd6 |
11
README.md
11
README.md
@@ -62,17 +62,6 @@ Pre-built artifacts are published at
|
|||||||
`testium` command is available in the terminal (requires `~/.local/bin` in
|
`testium` command is available in the terminal (requires `~/.local/bin` in
|
||||||
`PATH`, which most modern distributions provide by default).
|
`PATH`, which most modern distributions provide by default).
|
||||||
|
|
||||||
* **AppImage** (`Testium-<version>-x86_64.AppImage`) — a single self-contained
|
|
||||||
executable bundling its own Python. Make it executable and run it:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
chmod +x Testium-*-x86_64.AppImage
|
|
||||||
./Testium-*-x86_64.AppImage -b mytest.tum
|
|
||||||
```
|
|
||||||
|
|
||||||
As with the binary and Flatpak, `py_func` / `lua_func` items run under the
|
|
||||||
*host* Python / Lua so your own modules stay visible.
|
|
||||||
|
|
||||||
Every channel ships the language server, so `testium lsp` (see
|
Every channel ships the language server, so `testium lsp` (see
|
||||||
[Editor support](#editor-support)) works out of the box from any of them.
|
[Editor support](#editor-support)) works out of the box from any of them.
|
||||||
|
|
||||||
|
|||||||
@@ -23,3 +23,47 @@ graphical interface.
|
|||||||
:caption: call a test in batch mode
|
:caption: call a test in batch mode
|
||||||
|
|
||||||
testium -b test/my_test/main.tum
|
testium -b test/my_test/main.tum
|
||||||
|
|
||||||
|
.. _sec_language_server:
|
||||||
|
|
||||||
|
Language server (editor support)
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
*testium* ships a `Language Server Protocol
|
||||||
|
<https://microsoft.github.io/language-server-protocol/>`_ server so that
|
||||||
|
``.tum`` files get editor assistance — completion of test item types, hover
|
||||||
|
documentation of their parameters, and an outline view — in any LSP-capable
|
||||||
|
editor.
|
||||||
|
|
||||||
|
The server speaks LSP over standard input/output and is started with:
|
||||||
|
|
||||||
|
.. code-block:: text
|
||||||
|
:caption: start the language server
|
||||||
|
|
||||||
|
testium lsp
|
||||||
|
|
||||||
|
It is not meant to be launched directly by the user: an editor's LSP client
|
||||||
|
spawns it and drives the exchange. A VSCode / VSCodium client extension,
|
||||||
|
*testium_assist*, is provided for that purpose; any other LSP client (Neovim,
|
||||||
|
Emacs ``lsp-mode``, …) can be pointed at ``testium lsp`` as well.
|
||||||
|
|
||||||
|
The information the server exposes is the test item schema, which can also be
|
||||||
|
dumped as JSON for inspection or tooling:
|
||||||
|
|
||||||
|
.. code-block:: text
|
||||||
|
:caption: dump the item / parameter schema
|
||||||
|
|
||||||
|
testium schema
|
||||||
|
|
||||||
|
Because the schema is built from *testium* itself, every new item type or
|
||||||
|
parameter becomes available in the editor on the next *testium* upgrade, with
|
||||||
|
no change to the client.
|
||||||
|
|
||||||
|
The language server is included in the pre-built binary, Flatpak and AppImage
|
||||||
|
releases. For a source or wheel installation, pull the optional ``lsp``
|
||||||
|
dependencies:
|
||||||
|
|
||||||
|
.. code-block:: text
|
||||||
|
:caption: enable the language server for a wheel / source install
|
||||||
|
|
||||||
|
pip install 'testium[lsp]'
|
||||||
|
|||||||
@@ -232,6 +232,15 @@ list of the main test item (and eventually of the loop test item).
|
|||||||
TUM file ``main`` item is itself a variant of test items with a name and an
|
TUM file ``main`` item is itself a variant of test items with a name and an
|
||||||
step list attributes.
|
step list attributes.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Each test item declares the parameters it accepts. When a ``.tum`` file
|
||||||
|
uses a key the item does not know, *testium* emits a warning listing the
|
||||||
|
accepted parameter names (catching typos such as ``param_filee`` for
|
||||||
|
``param_file``); a missing **required** parameter aborts loading with an
|
||||||
|
error pointing at the source ``.tum`` file. Valid existing tests are
|
||||||
|
unaffected.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
# Main
|
|
||||||
################################################################################
|
|
||||||
main:
|
|
||||||
name: Serial Terminal bug reproducer
|
|
||||||
version: 0.1
|
|
||||||
steps:
|
|
||||||
- group:
|
|
||||||
name: Test preparation
|
|
||||||
steps:
|
|
||||||
- console:
|
|
||||||
name: Open RSL Simulator Terminal
|
|
||||||
console_name: RSL_simulator
|
|
||||||
steps:
|
|
||||||
- open:
|
|
||||||
protocol: terminal
|
|
||||||
terminal_path: $(rslsimulatorpath)
|
|
||||||
- writeln: "pwd"
|
|
||||||
- read_until: {expected: "$", timeout: 5}
|
|
||||||
- writeln: "./RSverify $(rsTx)" # /dev/ttyMUE1
|
|
||||||
- read_until: {expected: "RSL controller>", timeout: 5}
|
|
||||||
- writeln: "setportconf 0 115200 none 8 1 1 255"
|
|
||||||
- read_until: {expected: "RSL controller>", timeout: 5}
|
|
||||||
- writeln: "send4ever 0 0"
|
|
||||||
- read_until: {expected: "RSL controller>", timeout: 5}
|
|
||||||
|
|
||||||
- console:
|
|
||||||
name: Open the EUT console
|
|
||||||
console_name: cons_target
|
|
||||||
doc: Initiates the console of the target in order
|
|
||||||
to be ready to capture its traces.
|
|
||||||
stop_on_failure: True
|
|
||||||
steps:
|
|
||||||
- open:
|
|
||||||
protocol: serial
|
|
||||||
serial_port: $(rsRx) # /dev/ttyMUE2
|
|
||||||
serial_baudrate: 115200
|
|
||||||
|
|
||||||
- loop:
|
|
||||||
name: Qualification loop
|
|
||||||
stop_on_failure: False
|
|
||||||
steps:
|
|
||||||
- py_func:
|
|
||||||
name: Capture the RS serial output
|
|
||||||
file: $(test_directory)/terminal_bug_reproducer.py
|
|
||||||
func_name: RetreiveData
|
|
||||||
param:
|
|
||||||
- cons_target
|
|
||||||
|
|
||||||
- sleep: {timeout: 1}
|
|
||||||
|
|
||||||
# Cleanup sequence
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
- group:
|
|
||||||
name: Cleanup
|
|
||||||
execute_on_stop: True
|
|
||||||
steps:
|
|
||||||
- console:
|
|
||||||
name: Close the target console
|
|
||||||
console_name: cons_target
|
|
||||||
execute_on_stop: True
|
|
||||||
steps:
|
|
||||||
- close:
|
|
||||||
|
|
||||||
- console:
|
|
||||||
name: Close the RSL_simulator
|
|
||||||
console_name: RSL_simulator
|
|
||||||
execute_on_stop: True
|
|
||||||
steps:
|
|
||||||
- close:
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import api.testium as tm
|
|
||||||
|
|
||||||
def RetreiveData(console_name):
|
|
||||||
print("--------------- retrieving data ---------------")
|
|
||||||
result = 0
|
|
||||||
cons = tm.console(console_name)
|
|
||||||
|
|
||||||
if cons is None:
|
|
||||||
print("--------------- The console does not exist ---------------")
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
is_finished = False
|
|
||||||
while not is_finished:
|
|
||||||
status, d = cons.read_until('\n', timeout=0, return_data=True, mute=True)
|
|
||||||
if 0 == status:
|
|
||||||
print("--------------- Data ---------------")
|
|
||||||
print(d)
|
|
||||||
else:
|
|
||||||
print("--------------- No data ---------------")
|
|
||||||
print("Status: ", status)
|
|
||||||
is_finished = True
|
|
||||||
except:
|
|
||||||
print("--------------- Error retrieving data ---------------")
|
|
||||||
result = -1
|
|
||||||
|
|
||||||
return result
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
chars='<=>| -,;:!/."()[]{}*\&#%+012345689abcdefghiklmnopqrstuvwxyzABCD'
|
|
||||||
for j in {1..256} ;
|
|
||||||
do
|
|
||||||
for i in {1..256} ; do
|
|
||||||
echo -n "${chars:RANDOM%${#chars}:1}"
|
|
||||||
done
|
|
||||||
echo
|
|
||||||
sleep 0.01
|
|
||||||
done
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import api.testium as tm
|
|
||||||
|
|
||||||
def RetreiveData(console_name):
|
|
||||||
print("--------------- retrieving data ---------------")
|
|
||||||
result = 0
|
|
||||||
cons = tm.console(console_name)
|
|
||||||
|
|
||||||
if cons is None:
|
|
||||||
print("--------------- The console does not exist ---------------")
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
is_finished = False
|
|
||||||
while not is_finished:
|
|
||||||
status, d = cons.read_until('\n', timeout=0, return_data=True, mute=True)
|
|
||||||
if 0 == status:
|
|
||||||
print("--------------- Data ---------------")
|
|
||||||
print(d)
|
|
||||||
else:
|
|
||||||
print("--------------- No data ---------------")
|
|
||||||
print("Status: ", status)
|
|
||||||
is_finished = True
|
|
||||||
except:
|
|
||||||
print("--------------- Error retrieving data ---------------")
|
|
||||||
result = -1
|
|
||||||
|
|
||||||
return result
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
# Main
|
|
||||||
################################################################################
|
|
||||||
main:
|
|
||||||
name: Terminal bug reproducer
|
|
||||||
version: 0.1
|
|
||||||
steps:
|
|
||||||
- group:
|
|
||||||
name: Test preparation
|
|
||||||
steps:
|
|
||||||
- console:
|
|
||||||
name: Open the EUT console
|
|
||||||
console_name: cons_target
|
|
||||||
doc: Initiates the console of the target in order
|
|
||||||
to be ready to capture its traces.
|
|
||||||
stop_on_failure: True
|
|
||||||
steps:
|
|
||||||
- open:
|
|
||||||
protocol: terminal
|
|
||||||
|
|
||||||
- loop:
|
|
||||||
name: Qualification loop
|
|
||||||
stop_on_failure: False
|
|
||||||
steps:
|
|
||||||
- console:
|
|
||||||
name: write random data
|
|
||||||
console_name: cons_target
|
|
||||||
steps:
|
|
||||||
- writeln: bash $(test_directory)/generate_char.sh
|
|
||||||
|
|
||||||
- py_func:
|
|
||||||
name: Capture the terminal output
|
|
||||||
file: $(test_directory)/terminal_bug_reproducer.py
|
|
||||||
func_name: RetreiveData
|
|
||||||
param:
|
|
||||||
- cons_target
|
|
||||||
|
|
||||||
- sleep: {timeout: 1}
|
|
||||||
|
|
||||||
# Cleanup sequence
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
- group:
|
|
||||||
name: Cleanup
|
|
||||||
execute_on_stop: True
|
|
||||||
steps:
|
|
||||||
- console:
|
|
||||||
name: Close the target console
|
|
||||||
console_name: cons_target
|
|
||||||
execute_on_stop: True
|
|
||||||
steps:
|
|
||||||
- close:
|
|
||||||
@@ -97,7 +97,10 @@ case "$MODE" in
|
|||||||
echo "Creating wheel venv at $WHEEL_VENV"
|
echo "Creating wheel venv at $WHEEL_VENV"
|
||||||
python3 -m venv --system-site-packages "$WHEEL_VENV"
|
python3 -m venv --system-site-packages "$WHEEL_VENV"
|
||||||
"$WHEEL_VENV/bin/pip" install --quiet --upgrade pip
|
"$WHEEL_VENV/bin/pip" install --quiet --upgrade pip
|
||||||
"$WHEEL_VENV/bin/pip" install --quiet "$WHEEL"
|
# Install with the [lsp] extra so the wheel channel is validated in
|
||||||
|
# its language-server-capable form (pulls pygls), matching how a
|
||||||
|
# user enables `testium lsp` from a wheel: pip install testium[lsp].
|
||||||
|
"$WHEEL_VENV/bin/pip" install --quiet "${WHEEL}[lsp]"
|
||||||
fi
|
fi
|
||||||
CMD=("$WHEEL_VENV/bin/python" -m testium)
|
CMD=("$WHEEL_VENV/bin/python" -m testium)
|
||||||
;;
|
;;
|
||||||
|
|||||||
Reference in New Issue
Block a user