[PATCH] osmo-gsm-tester[master]: fix 'make check'

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Apr 27 18:25:03 UTC 2017


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/2444

to look at the new patch set (#2).

fix 'make check'

Apply various fixes that arose from test case code rot. These tests will now be
used to verify patches submitted to gerrit, so they need to be up to par.

Change-Id: I5277be0c434226d9d02e038f0bc72fd2557350c1
Related: OS#2215
---
M selftest/conf/resources.conf
M selftest/config_test.py
M selftest/resource_test.ok
M selftest/suite_test.ok
M selftest/suite_test.py
M selftest/suite_test/resources.conf
M selftest/template_test.py
M src/osmo_gsm_tester/log.py
8 files changed, 26 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/44/2444/2

diff --git a/selftest/conf/resources.conf b/selftest/conf/resources.conf
index c17acf5..178e13c 100644
--- a/selftest/conf/resources.conf
+++ b/selftest/conf/resources.conf
@@ -17,7 +17,7 @@
   ipa_unit_id: 5
   addr: 10.42.42.115
   band: GSM-1800
-  trx:
+  trx_list:
   - hw_addr: 00:0c:90:32:b5:8a
 
 - label: nanoBTS 1900
@@ -25,7 +25,7 @@
   ipa_unit_id: 1902
   addr: 10.42.42.190
   band: GSM-1900
-  trx:
+  trx_list:
   - hw_addr: 00:02:95:00:41:b3
 
 arfcn:
diff --git a/selftest/config_test.py b/selftest/config_test.py
index ce4d939..61ec73a 100755
--- a/selftest/config_test.py
+++ b/selftest/config_test.py
@@ -14,7 +14,7 @@
 example_config = os.path.join(_prep.script_dir, 'config_test', example_config_file)
 cfg = config.read(example_config)
 
-pprint.pprint(cfg)
+pprint.pprint(cfg, width=81)
 
 test_schema = {
     'modems[].dbus_path': schema.STR,
diff --git a/selftest/resource_test.ok b/selftest/resource_test.ok
index ae31d3b..413e5d0 100644
--- a/selftest/resource_test.ok
+++ b/selftest/resource_test.ok
@@ -51,14 +51,14 @@
           'band': 'GSM-1800',
           'ipa_unit_id': '5',
           'label': 'octBTS 3000',
-          'trx': [{'hw_addr': '00:0c:90:32:b5:8a'}],
+          'trx_list': [{'hw_addr': '00:0c:90:32:b5:8a'}],
           'type': 'oct'},
          {'_hash': '0b7fabd512b36aec43d7d496abd00af4e193b0f8',
           'addr': '10.42.42.190',
           'band': 'GSM-1900',
           'ipa_unit_id': '1902',
           'label': 'nanoBTS 1900',
-          'trx': [{'hw_addr': '00:02:95:00:41:b3'}],
+          'trx_list': [{'hw_addr': '00:02:95:00:41:b3'}],
           'type': 'nanobts'}],
  'modem': [{'_hash': '19c69e45aa090fb511446bd00797690aa82ff52f',
             'imsi': '901700000007801',
@@ -168,7 +168,7 @@
   band: GSM-1800
   ipa_unit_id: '5'
   label: octBTS 3000
-  trx:
+  trx_list:
   - hw_addr: 00:0c:90:32:b5:8a
   type: oct
 --- (want='modem'): DBG: Looking for 2 x modem , candidates: 16
@@ -209,7 +209,7 @@
   band: GSM-1800
   ipa_unit_id: '5'
   label: octBTS 3000
-  trx:
+  trx_list:
   - hw_addr: 00:0c:90:32:b5:8a
   type: oct
 modem:
diff --git a/selftest/suite_test.ok b/selftest/suite_test.ok
index fe7fbcb..2fad8b3 100644
--- a/selftest/suite_test.ok
+++ b/selftest/suite_test.ok
@@ -16,7 +16,10 @@
   - times: '1'
 
 - run hello world test
+tst test_suite: Suite run start
 tst test_suite: reserving resources...
+tst test_suite: DBG: {combining='resources'}  [test_suite↪test_suite]
+tst test_suite: DBG: {definition_conf={bts=[{'times': '1'}], modem=[{'times': '2'}], nitb_iface=[{'times': '1'}]}}  [test_suite↪(combining_scenarios='resources')↪test_suite]
 --- (want='bts'): DBG: Looking for 1 x bts , candidates: 3
 --- (want='bts'): DBG: Picked - _hash: 07d9c8aaa940b674efcbbabdd69f58a6ce4e94f9
   addr: 10.42.42.114
@@ -48,6 +51,7 @@
 pass: all 1 tests passed.
 
 - a test with an error
+tst test_suite: Suite run start  [suite.py:191]
 tst test_error.py: START  [test_suite↪test_error.py]  [suite.py:96]
 tst test_error.py:3: I am 'test_suite' / 'test_error.py:3'  [test_suite↪test_error.py:3]  [test_error.py:3]
 tst test_error.py:5: FAIL  [test_suite↪test_error.py:5]  [suite.py:108]
diff --git a/selftest/suite_test.py b/selftest/suite_test.py
index cbbd6be..315c683 100755
--- a/selftest/suite_test.py
+++ b/selftest/suite_test.py
@@ -20,7 +20,7 @@
 print(config.tostr(s_def.conf))
 
 print('- run hello world test')
-s = suite.SuiteRun(None, s_def)
+s = suite.SuiteRun(None, 'test_suite', s_def)
 results = s.run_tests('hello_world.py')
 print(str(results))
 
diff --git a/selftest/suite_test/resources.conf b/selftest/suite_test/resources.conf
index c17acf5..178e13c 100644
--- a/selftest/suite_test/resources.conf
+++ b/selftest/suite_test/resources.conf
@@ -17,7 +17,7 @@
   ipa_unit_id: 5
   addr: 10.42.42.115
   band: GSM-1800
-  trx:
+  trx_list:
   - hw_addr: 00:0c:90:32:b5:8a
 
 - label: nanoBTS 1900
@@ -25,7 +25,7 @@
   ipa_unit_id: 1902
   addr: 10.42.42.190
   band: GSM-1900
-  trx:
+  trx_list:
   - hw_addr: 00:02:95:00:41:b3
 
 arfcn:
diff --git a/selftest/template_test.py b/selftest/template_test.py
index 2b44ae5..31d9e80 100755
--- a/selftest/template_test.py
+++ b/selftest/template_test.py
@@ -19,7 +19,7 @@
         )
 
 mock_bts = {
-    'type': 'val_type',
+    'osmobsc_bts_type': 'val_type',
     'band': 'val_band',
     'location_area_code': 'val_bts.location_area_code',
     'base_station_id_code': 'val_bts.base_station_id_code',
diff --git a/src/osmo_gsm_tester/log.py b/src/osmo_gsm_tester/log.py
index 3e96999..b581e2c 100644
--- a/src/osmo_gsm_tester/log.py
+++ b/src/osmo_gsm_tester/log.py
@@ -24,6 +24,8 @@
 import contextlib
 from inspect import getframeinfo, stack
 
+from .util import is_dict
+
 L_ERR = 30
 L_LOG = 20
 L_DBG = 10
@@ -512,14 +514,20 @@
         log_exn()
         return return_on_failure
 
+def _compose_named_items(item):
+    'make sure dicts are output sorted, for test expectations'
+    if is_dict(item):
+        return '{%s}' % (', '.join(
+               ['%s=%s' % (k, _compose_named_items(v))
+                for k,v in sorted(item.items())]))
+    return repr(item)
+
 def compose_message(messages, named_items):
     msgs = [str(m) for m in messages]
 
     if named_items:
         # unfortunately needs to be sorted to get deterministic results
-        msgs.append('{%s}' %
-                    (', '.join(['%s=%r' % (k,v)
-                     for k,v in sorted(named_items.items())])))
+        msgs.append(_compose_named_items(named_items))
 
     return ' '.join(msgs)
 

-- 
To view, visit https://gerrit.osmocom.org/2444
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I5277be0c434226d9d02e038f0bc72fd2557350c1
Gerrit-PatchSet: 2
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list