Re-apply reverted commit Iabda95073faa2191fd117e9637e0858c589e9d9e
("Drop python2 support"), but with additional changes to make the
scripts actually work with python3 and to make it build without python2.
I have verified, that the contrib/jenkins.sh scripts of all Osmocom
repositories (with their python3 patches on top) are working with this
patch and that all Osmocom repositories with the python3 patches build
in OBS (tested in own namespace).
New fixes:
* osmopy/obscvty.py: verify: fix compare
Comparing maps in python3 does not work the same as in python2. Convert
them to lists first, so the compare works as intended again.
Fix error:
File "/home/user/code/osmo-dev/src/osmo-python-tests/scripts/osmotestvty.py", line 57, in test_history
assert(self.vty.w_verify(test_str, [t1]))
AssertionError
* osmopy/obscvty.py: use enc/dec with send/recv
Fix error:
self.socket.send("%s\r" % request)
TypeError: a bytes-like object is required, not 'str'
* scripts/osmotestconfig.py: use encode() before writing to file
Fix error:
File "/home/user/code/osmo-dev/src/osmo-python-tests/scripts/osmotestconfig.py", line 91, in copy_config
tmpfile.write(open(config).read())
File "/usr/lib/python3.5/tempfile.py", line 622, in func_wrapper
return func(*args, **kwargs)
TypeError: a bytes-like object is required, not 'str'
* debian/control: add --buildsystem=pybuild. Otherwise "--with python3"
is ignored and the build fails if python2 is not installed, with:
Can't exec "pyversions": No such file or directory at /usr/[...]/python_distutils.pm line 120.
Related: OS#2819
Change-Id: I3ffc3519bf6c22536a49dad7a966188ddad351a7
This reverts commit fb1dc7c405.
I was under the impression, that all previous scripts were already
working with python 3. But as it turns out, this isn't true. Reverting,
so I can properly post follow-up patches, that fix the issues before we
apply this "drop python2" patch again.
Related: OS#2819
Change-Id: Ic1559d1a9f7839fa86a841d62a04b22e1caed466
Remove all compatibility code for python2.
All scripts are already python 3 compatible since
I80e5850a8978d78cda793e2192ef4bd3fd54a121 and
I1b4a629f12863c498a8681b555f57b4e255cebfb.
dpkg-buildpackage shows that it is still invoking setup.py with python
in addition to python3, on debian stretch. But after spending quite some
time on trying to convince it to not care about python2 without success
(trying different variables, overrides, --without python2 flags etc.),
I'm leaving it as is. The resulting package is the python3 package, which
is what we want.
Related: OS#2819
Change-Id: Iabda95073faa2191fd117e9637e0858c589e9d9e
/proc/self/fd refers to the process opening the file. In this case
self will be "ls". Maybe it is better to look at the FDs open in
the test runner itself.
Change-Id: I638e94f16f4019a7b6026d1fae69e677870fb253
The VTYInteract tests gave a constant sleep(1) grace period for the process to
startup. This caused the test to take minutes for no reason at all.
Add code to VTYInteract._connect_socket() to try and connect right away,
retrying up to three seconds in .1 second intervals. This flies through most
tests without any sleep() at all.
When TCP socket debugging is switched on, also print how many connection tries
it took to connect the VTY socket.
Note that the openbsc python tests also add some sleep()s that also need to be
removed to benefit from this.
Change-Id: Icc337f52a93d5fe31fc4ff235ccaf4e0fe75fa39
It appears that during some error conditions, the socket will not be in the tcp
socket debug tracking list, and on top of an exception this barfs as well.
Let's not care about the tcp debug list and avoid confusing error messages.
Change-Id: I8daa317fed8fc7e720dccb70fd5f7fc74fde423f
It appears that during some error conditions, the socket will not be in the tcp
socket debug tracking list, and on top of an exception this barfs as well.
Let's not care about the tcp debug list and avoid confusing error messages.
Change-Id: Ib7b0e45fa1f5551da2fc81b71dcc227eee533f44
Print monitoring info about TCP sockets when the env var
OSMOPY_DEBUG_TCP_SOCKETS is present and not "0".
Makes it easy to enable it on jenkins without blowing up output of normal runs
"at home".
Change-Id: I46212d07a2c1be05672a37766457e6c98b68f90d
Add global flag debug_tcp_sockets; if true, monitors all open TCP sockets of
the system and running processes by regular 'ss' and 'ps' output, and logs
which VTY sockets are opened and closed.
Change-Id: I0cc7dc049c66f29fe58fee204e74aa9e82c21989
In the OpenBSC VTY tests it seems no one is calling
the command with close=True. So make sure the socket
is released. Modify _close_socket to be idempotent.
Change-Id: I717537772e89113ef352d32ffba1b7a840f2c6e6
Make the code work for entering the configuration step. The name
of the configured node will show up. Change the semantic of the
_is_end method to return how many chars make up the end.
Currently, it's tested on openbsc and osmo-pcu.
Scripts: osmotestvty.py osmodumpdoc.py osmotestconfig.py
The scripts are designed to be run from make check,
but can be run independently as well.
As a general rule, run them in the top dir of a project.