Commit Graph

140 Commits

Author SHA1 Message Date
Neels Hofmeyr d2e793a58a osmodumpdoc: print generated path
Change-Id: Ie39316f0b51ee518b9dce8d5f98b53f748db573b
2017-09-18 16:30:33 +02:00
Neels Hofmeyr a784f2407b osmodumpdoc: print called commands and OSError messages
Change-Id: Ib044cbb8a1b8e02cbe6852f785c75b5c7aae6174
2017-09-18 16:30:33 +02:00
Neels Hofmeyr 8e4806c5f2 osmodumpdoc: fix finding cfg when not calling from source tree
When the binary has not been built in the source tree, it was impossible to
call osmodumpdoc.py despite the -p <config-path> option. Look for config files
in that config-path.

Make sure a relative config-path is adjusted when changing to the workdir.

Change-Id: I5427d354c289ec4602411c7059c8d80e2b451f7c
2017-09-18 16:30:31 +02: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 baa6f12260 test_all_apps: actually count nr of errors
Each test run returns 1 on error, so instead of |=, why not count the number of
errors with +=. Also print the final error count.

Change-Id: I690dde3711555a3447e5ad4cc0a04a7a869a8296
2017-03-06 15:31:08 +01:00
Neels Hofmeyr cebe8f5b00 on Exception during test, also print the actual config
When a test run encounters an Exception, the test config file name is printed,
but that may already be gone when done, so also print the complete actual test
config file contents, making it easy to reproduce the failure manually.

Change-Id: I9b00f170fb0cdceb35b9231eb1f2c545ba079d1d
2017-03-06 15:31:08 +01:00
Neels Hofmeyr 9b0a51fb87 osmoutil: end_proc: wait for term in a loop
Recent commit b59b677c9b called proc.terminate()
instead of killing right away, with a .1 second sleep. Reduce this sleep to
a minuscule first wait_time, remaining tolerant for processes that take longer.

Actually all of our current processes are very fast to terminate. This patch
was created while looking for a different problem, now that it's there we might
as well keep it.

Change-Id: I98849e4550116c5666fdf6f5d4cbb576ffa3e14a
2017-03-06 15:31:08 +01:00
Neels Hofmeyr 119bed52fa osmoutil: add pick_test() to pick unittest tests by name
Change-Id: I92f90c334169f31920c63dd5c5ac8dac215065e6
2017-03-06 15:31:08 +01: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 f6ab3d8e9c osmoutil: open /dev/null only once
Change-Id: Ic6da34f6c4c5cd3b0786788f4e38c9c6248fca1b
2017-02-24 20:49:51 +01:00
Neels Hofmeyr b59b677c9b osmoutil: try to terminate process instead of killing
Change-Id: Iaa978467b140e3d6dc5a2a6d8966282e64630ce7
2017-02-24 20:49:39 +01:00
Neels Hofmeyr 8972d06754 osmotestconfig: fix socket leak
Each running test would open up another socket without ever closing unused
ones. Close the sockets after each test is done.

Change-Id: If97944a079e901439139161eae39181f5c800200
2017-02-24 20:49:34 +01:00
Neels Hofmeyr 3ef39e9b9e osmoutil: centrally log process launches
Log Popen in osmoutil.py instead of in each python test. Launch message is
being removed in openbsc's python tests and added here. (change-id
Id8eb70ddfdc1d0d9f90aa5343a4ea522042c34ee)

Change-Id: I7e539abc3aeee91ae3e7635f9e28b9e557eaf969
2017-02-24 20:49:27 +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
Holger Hans Peter Freyther 0edf0c9995 vty: Check the result of the write command
When running on top of vboxsf the write option doesn't work and we
have a success that should be a failure. Check the success string
we want to see on write.

Change-Id: I460e2da10f049807e4729f53fc69448c9c30f5f9
2016-08-15 12:37:39 +02:00
Max 6c33a15e41 Fix build failure
After copytree the destination directory might end up not being writable
- this causes failure for subsequent writeconfig tests. Force rwx
permissions to fix it.
2016-04-14 08:32:06 -04:00
Max 334d680d28 Recursively copy files before config test
Copy all potentially necessary files (like includable configs) before
running config test.
2016-04-12 10:15:41 -04:00
Max 5f4567b2a2 Extend apps attribute
In addition to binary name it's now possible to provide extra
command-line arguments in osmoappdesc.py for application under
test. This change is fully optional and backward compatible.
2016-03-31 11:59:56 +02:00
Max d401cc13ae Add optional ignore_configs attribute
This attribute in osmoappdesc.py allows to ignore certain configs while
running vty tests. It's handy for hardware-specific or otherwise special
configuration examples.
2016-03-31 11:59:35 +02:00
Max 32d0fd8872 Expand installation instructions 2016-03-31 11:59:10 +02:00
Max 44f5163c50 Add .gitignore
Ignore install leftovers.
2016-03-31 11:59:09 +02:00
Alexander Chemeris 2f48313ed6 obscvty: Implement readlines() generator function. 2015-05-30 17:45:49 +02:00
Holger Hans Peter Freyther b819b57a98 testconfig: Do not fail due wrong numbers
Fix the script and don't fail
2015-01-31 21:15:06 +01:00
Holger Hans Peter Freyther 4e98c266b7 testconfig: Check the result of running the individual tests
Currently the tests might find issues with the documentation but
the exit code is still 0. This attemps to make the test_config
check the result of each test and then return if an error has
occurred. This should propagate all the way into a sys.exit()
call.
2014-07-04 20:43:38 +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 cd564fcebc Fixed osmodumpdoc to work with the refactored importing 2013-04-06 11:11:49 +02:00
Kat 0270be43b9 Minor refactoring of importing osmoappdesc 2013-04-05 21:34:52 +02:00
Kat 0248d3b668 Made the scripts work from make distcheck 2013-04-05 20:20:50 +02:00
Kat 0d114c854b Added a verbosity option and banner to osmotestvty 2013-04-05 18:21:39 +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