path: root/src/osmo_gsm_tester/
AgeCommit message (Collapse)AuthorFilesLines
2018-08-13Cleanup of class scoped variablesPau Espin Pedrol1-8/+7
After bug described in OS#3456 and fixed in last commit, let's categorize and place variables in its correct plac to avoid similar issus. We leave under the class keyword (class scoped variables) the attributes which are to be used as static class attributes. All other ones are initialized during __init__(). This way w avoid scenarios in which while using an object from an instance attribute we end up reading a class scoped variable which is shared among all instances. Change-Id: I5ad4cac34a9f49eaf42966c01c9c5a4d3f3e9dc8
2018-05-28event_loop: Log parameters during wait timeout exceptionPau Espin Pedrol1-1/+1
Change-Id: I1cf104392bfd11ad263264738eb4d8fa60550a5d
2018-04-07event_loop: Avoid leaking active timeouts on poll exceptionPau Espin Pedrol1-1/+5
It was spotted that when an error ocurred during poll generating an exception to finish the test (osmo-msc ended prematurely), then the active wait() condition was kept being checked for later tests, making all followup tests fail. That's because in case of exception we were not making sure the timeout is removed and it kept firing forever. Change-Id: I5c93cd67b2b83c0ecee96fbc6c4200b419bdf73f
2018-04-04Drop event_loop global functions and import MainLoopPau Espin Pedrol1-29/+1
Take the chance to identify and drop modules importing event_loop but not using it. Change-Id: Ifa1940cd00138ebc72fbcfd45a0e28246f7a5ed9
2018-04-04event_loop: Use glib as mainloop impl and move modem to use event_loopPau Espin Pedrol1-28/+109
Several benefits: - We can add APIs to poll on fds in the future (for smpp socket for instance) instead of using busy polling. - During wait(), we now block in the glib mainloop instead of sleeping 0.1 secs and not handling events during that time. - We remove glib mainloop specific bits from Change-Id: I8c3bc44bbe443703077110cdc67207e9cbb43767
2017-11-12event_loop: Remove unneeded commented import line and explanationPau Espin Pedrol1-3/+0
Those lines come most probably from copy+paste using header when creating the file. Change-Id: I7854d96de00124324bfbac8960e18ec30aa21296
2017-06-13fix and refactor logging: drop 'with', simplifyNeels Hofmeyr1-2/+6
With the recent fix of the junit report related issues, another issue arose: the 'with log.Origin' was changed to disallow __enter__ing an object twice to fix problems, now still code would fail because it tries to do 'with' on the same object twice. The only reason is to ensure that logging is associated with a given object. Instead of complicating even more, implement differently. Refactor logging to simplify use: drop the 'with Origin' style completely, and instead use the python stack to determine which objects are created by which, and which object to associate a log statement with. The new way: we rely on the convention that each class instance has a local 'self' referencing the object instance. If we need to find an origin as a new object's parent, or to associate a log message with, we traverse each stack frame, fetching the first local 'self' object that is a log.Origin class instance. How to use: Simply call log.log() anywhere, and it finds an Origin object to log for, from the stack. Alternatively call self.log() for any Origin() object to skip the lookup. Create classes as child class of log.Origin and make sure to call super().__init__(category, name). This constructor will magically find a parent Origin on the stack. When an exception happens, we first escalate the exception up through call scopes to where ever it is handled by log.log_exn(). This then finds an Origin object in the traceback's stack frames, no need to nest in 'with' scopes. Hence the 'with log.Origin' now "happens implicitly", we can write pure natural python code, no more hassles with scope ordering. Furthermore, any frame can place additional logging information in a frame by calling log.ctx(). This is automatically inserted in the ancestry associated with a log statement / exception. Change-Id: I5f9b53150f2bb6fa9d63ce27f0806f0ca6a45e90
2017-06-03Re-License under GPLv3-or-later instead of AGPLv3-or-laterHarald Welte1-3/+3
The "Affero" nature makes sense for the Osmocom network components like BSC, SGSN, etc. as they are typically operated to provide a network service. For testing, this doesn't make so much sense as it is difficult to imagine people creating a business out of offering to run test cases on an end-to-end Osmocom GSM network. So let's drop the 'Affero' here. All code is so far developed by sysmocom staff, so as Managing Director of sysmocom I can effect such a license change unilaterally. Change-Id: I8959c2d605854ffdc21cb29c0fe0e715685c4c05
2017-05-25event_loop: Create a global event loop to poll and wait for eventsPau Espin Pedrol1-0/+64
Tweaked-by: nhofmeyr Change-Id: Iaa78bae0f053496377609b24a11ebaef3fd77598