]> git.lttng.org Git - lttng-tools.git/commit
Tests: Check python version before using signal.strsignal
authorKienan Stewart <kstewart@efficios.com>
Thu, 7 Nov 2024 13:38:13 +0000 (08:38 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 18 Dec 2024 15:53:39 +0000 (15:53 +0000)
commit389a5e2edadf546c28472ac750085952f7eb0bd2
tree06d7a6a91dd59af5331f968d91356b329e59c060
parent2ae89306d8470298d56a5f51ee855bd3e1fad96c
Tests: Check python version before using signal.strsignal

Observed issue
==============

When running CI tests against sles12sp5 (with python 3.4) the clean-up
of a stalled test produced the following output:

```
Traceback (most recent call last):
  File "./tools/live/test_early_inactive_app.py", line 111, in <module>
    log=tap.diagnostic, with_relayd=True, with_sessiond=True
  File "/usr/lib64/python3.4/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/home/jenkins/workspace/dev_review_lttng-tools_master_slesbuild/babeltrace_version/stable-2.0/build/std/conf/agents/liburcu_version/master/platform/sles12sp5-amd64/src/lttng-tools/tests/utils/lttngtest/environment.py", line 1192, in test_environment
    with_sessiond, log, with_relayd, extra_env_vars, skip_temporary_lttng_home
  File "/home/jenkins/workspace/dev_review_lttng-tools_master_slesbuild/babeltrace_version/stable-2.0/build/std/conf/agents/liburcu_version/master/platform/sles12sp5-amd64/src/lttng-tools/tests/utils/lttngtest/environment.py", line 677, in __init__
    self._launch_lttng_relayd() if with_relayd else None
  File "/home/jenkins/workspace/dev_review_lttng-tools_master_slesbuild/babeltrace_version/stable-2.0/build/std/conf/agents/liburcu_version/master/platform/sles12sp5-amd64/src/lttng-tools/tests/utils/lttngtest/environment.py", line 933, in _launch_lttng_relayd
    time.sleep(0.1)
  File "/home/jenkins/workspace/dev_review_lttng-tools_master_slesbuild/babeltrace_version/stable-2.0/build/std/conf/agents/liburcu_version/master/platform/sles12sp5-amd64/src/lttng-tools/tests/utils/lttngtest/environment.py", line 1044, in _handle_termination_signal
    signal_name=signal.strsignal(signal_number)
AttributeError: 'module' object has no attribute 'strsignal'
```

Cause
=====

`signal.strsignal` is introduced in Python 3.8[1].

Solution
========

Check the system version and fall back to using `str(signal_number)`
which will give the numeric signal (e.g. signal.SIGKILL -> 9).

Known drawbacks
===============

None.

References
==========
[1]: https://docs.python.org/3/library/signal.html#signal.strsignal

Change-Id: I04d0560225f8332364d2da2ecd77be2802569cc9
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/utils/lttngtest/environment.py
This page took 0.028255 seconds and 4 git commands to generate.