Commit Graph

17 Commits

Author SHA1 Message Date
Max 6ccd0785d8 Fix python3 compatibility
Use print() function with proper import.

Change-Id: Ib10dfbec18202245031a634fc3f19677fc952e60
2017-12-18 13:12:48 +01:00
Holger Hans Peter Freyther f41db1e337 vty: Follow links to see what is a file and what is a socket
Change-Id: I3d94cde8523a2ed26a66b8b8b3f651606aa17a9d
2017-09-13 15:42:15 +08:00
Holger Hans Peter Freyther 562bfea593 vty: Print open file descriptors of the VTY test runner
/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
2017-09-13 15:38:48 +08:00
Neels Hofmeyr abd4b7d705 speed up python tests more than 10 fold by sleeping less
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
2017-03-06 15:31:08 +01:00
Neels Hofmeyr 4e64b8821d cosmetic: put socket connection code in separate function
Prepare for upcoming patch that adds connection retries to speed up tests.

Change-Id: I2dddf8794b4241898373178c8a1aa2e98b01095c
2017-03-06 15:31:08 +01:00
Neels Hofmeyr 8e9f30f3e1 tcp_debug: don't abort when socket can't be removed
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
2017-03-06 15:31:08 +01:00
Neels Hofmeyr e349320992 cosmetic: early exit instead of if-cascade
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
2017-03-06 15:31:08 +01:00
Neels Hofmeyr cb320b8ddf debug_tcp_sockets: clearly mark as global var
Change-Id: I56e26590ea380c7deab7ce132d688b37eb2d11a3
2017-03-06 15:31:08 +01:00
Neels Hofmeyr ac0b59d93a debug: also output nr of open file descriptors for 'tcp debug'
Change-Id: I8a583df549f3e2b79068fd8cd32b75473539410d
2017-03-06 15:31:08 +01:00
Neels Hofmeyr 2bdab3d291 tcp debugging: allow switching on TCP debug by env var
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
2017-03-06 15:31:03 +01:00
Neels Hofmeyr 93a808eaba debug: monitor used TCP sockets and running osmo processes
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
2017-02-24 20:49:21 +01:00
Holger Hans Peter Freyther 99b5c56c04 vty: Close the vty sockets at the end of each test
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
2017-02-13 20:09:01 +07:00
Alexander Chemeris 2f48313ed6 obscvty: Implement readlines() generator function. 2015-05-30 17:45:49 +02:00
Jacob Erlbeck 41b0d30459 obscvty: Added node() method to get the last node string
Extract the node name from the VTY prompt after executing a
command and return it via the new VTYInteract.node() method.
2013-08-30 18:28:05 +02:00
Holger Hans Peter Freyther 99bbea7f19 obscvty: Make the _is_end detection work for entering the config
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.
2013-06-25 08:20:41 +02:00
Kat a8ee6bb97b Documentation: added a README, more docstrings; +x'd setup.py 2013-04-05 17:08:28 +02:00
Kat a7185c6c72 This is a set of test scripts for osmocom projects.
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.
2013-04-04 17:31:17 +02:00