Neels Hofmeyr | 3531a19 | 2017-03-28 14:30:28 +0200 | [diff] [blame] | 1 | # osmo_gsm_tester: context for individual test runs |
Neels Hofmeyr | dae3d3c | 2017-03-28 12:16:58 +0200 | [diff] [blame] | 2 | # |
| 3 | # Copyright (C) 2016-2017 by sysmocom - s.f.m.c. GmbH |
| 4 | # |
| 5 | # Author: Neels Hofmeyr <neels@hofmeyr.de> |
| 6 | # |
| 7 | # This program is free software: you can redistribute it and/or modify |
Harald Welte | 2720534 | 2017-06-03 09:51:45 +0200 | [diff] [blame] | 8 | # it under the terms of the GNU General Public License as |
Neels Hofmeyr | dae3d3c | 2017-03-28 12:16:58 +0200 | [diff] [blame] | 9 | # published by the Free Software Foundation, either version 3 of the |
| 10 | # License, or (at your option) any later version. |
| 11 | # |
| 12 | # This program is distributed in the hope that it will be useful, |
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Harald Welte | 2720534 | 2017-06-03 09:51:45 +0200 | [diff] [blame] | 15 | # GNU General Public License for more details. |
Neels Hofmeyr | dae3d3c | 2017-03-28 12:16:58 +0200 | [diff] [blame] | 16 | # |
Harald Welte | 2720534 | 2017-06-03 09:51:45 +0200 | [diff] [blame] | 17 | # You should have received a copy of the GNU General Public License |
Neels Hofmeyr | dae3d3c | 2017-03-28 12:16:58 +0200 | [diff] [blame] | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | |
Neels Hofmeyr | 3531a19 | 2017-03-28 14:30:28 +0200 | [diff] [blame] | 20 | # These will be initialized before each test run. |
| 21 | # A test script can thus establish its context by doing: |
Pau Espin Pedrol | dfe38ad | 2017-11-09 13:57:39 +0100 | [diff] [blame] | 22 | # from osmo_gsm_tester.testenv import * |
Neels Hofmeyr | 3531a19 | 2017-03-28 14:30:28 +0200 | [diff] [blame] | 23 | trial = None |
| 24 | suite = None |
| 25 | test = None |
| 26 | resources = None |
| 27 | log = None |
| 28 | dbg = None |
| 29 | err = None |
| 30 | wait = None |
Pau Espin Pedrol | 927344b | 2017-05-22 16:38:49 +0200 | [diff] [blame] | 31 | wait_no_raise = None |
Neels Hofmeyr | 3531a19 | 2017-03-28 14:30:28 +0200 | [diff] [blame] | 32 | sleep = None |
| 33 | poll = None |
| 34 | prompt = None |
Neels Hofmeyr | a88b0c7 | 2017-05-07 02:15:48 +0200 | [diff] [blame] | 35 | Timeout = None |
Pau Espin Pedrol | 2d16f6f | 2017-05-30 15:33:57 +0200 | [diff] [blame] | 36 | Sms = None |
Pau Espin Pedrol | 878b2c6 | 2018-05-18 15:57:06 +0200 | [diff] [blame] | 37 | process = None |
Neels Hofmeyr | dae3d3c | 2017-03-28 12:16:58 +0200 | [diff] [blame] | 38 | |
Pau Espin Pedrol | 878b2c6 | 2018-05-18 15:57:06 +0200 | [diff] [blame] | 39 | def setup(suite_run, _test, suite_module, event_module, sms_module, process_module): |
| 40 | global trial, suite, test, resources, log, dbg, err, wait, wait_no_raise, sleep, poll, prompt, Timeout, Sms, process |
Neels Hofmeyr | 3531a19 | 2017-03-28 14:30:28 +0200 | [diff] [blame] | 41 | trial = suite_run.trial |
| 42 | suite = suite_run |
| 43 | test = _test |
| 44 | resources = suite_run.reserved_resources |
| 45 | log = test.log |
| 46 | dbg = test.dbg |
| 47 | err = test.err |
Pau Espin Pedrol | 927344b | 2017-05-22 16:38:49 +0200 | [diff] [blame] | 48 | wait = lambda *args, **kwargs: event_module.wait(suite_run, *args, **kwargs) |
| 49 | wait_no_raise = lambda *args, **kwargs: event_module.wait_no_raise(suite_run, *args, **kwargs) |
| 50 | sleep = lambda *args, **kwargs: event_module.sleep(suite_run, *args, **kwargs) |
| 51 | poll = event_module.poll |
Neels Hofmeyr | 3531a19 | 2017-03-28 14:30:28 +0200 | [diff] [blame] | 52 | prompt = suite_run.prompt |
Neels Hofmeyr | a88b0c7 | 2017-05-07 02:15:48 +0200 | [diff] [blame] | 53 | Timeout = suite_module.Timeout |
Pau Espin Pedrol | 2d16f6f | 2017-05-30 15:33:57 +0200 | [diff] [blame] | 54 | Sms = sms_module.Sms |
Pau Espin Pedrol | 878b2c6 | 2018-05-18 15:57:06 +0200 | [diff] [blame] | 55 | process = process_module |
Neels Hofmeyr | dae3d3c | 2017-03-28 12:16:58 +0200 | [diff] [blame] | 56 | |
Neels Hofmeyr | dae3d3c | 2017-03-28 12:16:58 +0200 | [diff] [blame] | 57 | # vim: expandtab tabstop=4 shiftwidth=4 |