lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

  • 1 participants
  • 97203 discussions
[M] Change in osmo-ttcn3-hacks[master]: testenv: show unexpected respawns at the end
by osmith 26 Nov '26

26 Nov '26
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44175?usp=email ) Change subject: testenv: show unexpected respawns at the end ...................................................................... testenv: show unexpected respawns at the end Split respawn.sh in respawn-expected.sh and respawn-unexpected.sh and adjust its users. Let the respawn-unexpected.sh script write each respawn to a new end.log file, which gets displayed at the end of testenv runs, if it exists. Example: [testenv] 1 warning found in end.log: [testenv] > Unexpected respawn of "osmo-bts-trx" during test "BTS_Tests_VAMOS.TC_vamos_chan_act_vhh" This allows us to quickly see if a program was respawned unexpectedly, while still respawning it in order to not abort the testsuite or have all following tests fail. Change-Id: Ia0650344b6df428e27de9e011676e884d27bfde0 --- M _testenv/README.md R _testenv/data/scripts/respawn-expected.sh A _testenv/data/scripts/respawn-unexpected.sh M _testenv/testenv.py M _testenv/testenv/daemons.py M _testenv/testenv/testdir.py M bsc/osmo_bts_omldummy.sh M bts/testenv_generic.cfg M bts/testenv_hopping.cfg M pcu/testenv_generic.cfg M pcu/testenv_sns.cfg 11 files changed, 99 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/75/44175/1 diff --git a/_testenv/README.md b/_testenv/README.md index 4f53724..42dfce2 100644 --- a/_testenv/README.md +++ b/_testenv/README.md @@ -241,7 +241,7 @@ The user's `PATH` environment variable is prefixed with the following paths: * The directory of the testsuite. * The directory for binaries built from source. - * The directory `_testenv/data/scripts` (which has e.g. `respawn.sh`). + * The directory `_testenv/data/scripts` (which has e.g. `respawn-expected.sh`). * The directory `_testenv/data/scripts/qemu`. * `PWD`: @@ -249,15 +249,30 @@ log dir. For example: ``` -/tmp/logs +/tmp/logs # TESTENV_TESTDIR +├── end.log # TESTENV_END_LOG ├── ggsn # Executables from [ggsn] section run in this dir │   ├── ggsn.log │   └── osmo-ggsn.cfg └── testsuite # Executables from [testsuite] run in this dir + ├── .current_test # The current test name is in this file ├── Common.cfg ├── GGSN_Tests.cfg └── GGSN_Tests.default ``` + If a testsuite has multiple configurations (`./testenv.py run -c`), then + `TESTENV_TESTDIR` ends in the name of the current configuration and is next + to `end.log`. For example: +``` +/tmp/logs +├── end.log # TESTENV_END_LOG is here for all configurations +├── generic # TESTENV_TESTDIR while running the generic config +│ ├── bsc +│ ├── bts +│ └── testsuite +├── hopping # TESTENV_TESTDIR while running the hopping config +└── oml # TESTENV_TESTDIR while running the oml config +``` * `TESTENV_INSTALL_DIR`: The directory into which the SUT binaries and other files are installed. It @@ -306,6 +321,16 @@ running podman. This is used in `_testenv/data/scripts/require_ulimit_r.sh` to display a hint for setting the rtprio limit for this user. +* `TESTENV_TESTDIR`: + (Set for `program=` of test components only.) This directory contains logs + and configurations for the current configuration. See `PWD` above for + examples. + +* `TESTENV_END_LOG`: + (Set for `program=` of test components only.) Path to an `end.log` file, to + which warnings can be written that will be displayed at the end of the + testenv run. This is used by `respawn-unexpected.sh`. + ## Eclipse-titan versions It is possible to change the eclipse-titan version that is used to build and diff --git a/_testenv/data/scripts/respawn.sh b/_testenv/data/scripts/respawn-expected.sh similarity index 100% rename from _testenv/data/scripts/respawn.sh rename to _testenv/data/scripts/respawn-expected.sh diff --git a/_testenv/data/scripts/respawn-unexpected.sh b/_testenv/data/scripts/respawn-unexpected.sh new file mode 100755 index 0000000..27949db --- /dev/null +++ b/_testenv/data/scripts/respawn-unexpected.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# Restart a given test component while the testsuite is running. Unlike +# respawn-expected.sh we don't expect this to happen but need to keep going +# anyway. We log that this happens to $TESTENV_END_LOG, which then gets +# displayed at the end of the testenv run. + +trap "kill 0" EXIT + +SLEEP_BEFORE_RESPAWN=${SLEEP_BEFORE_RESPAWN:-0} + +i=0 +max_i=500 +while [ $i -lt $max_i ]; do + echo "respawn: $i: starting: $*" + $* & + LAST_PID=$! + wait $LAST_PID + LAST_STATUS=$? + echo "respawn: $i: stopped pid $LAST_PID with status $LAST_STATUS" + + CURRENT_TEST="$(cat "$TESTENV_TESTDIR"/testsuite/.current_test)" + if [ -n "$CURRENT_TEST" ]; then + echo "Unexpected respawn of \"$*\" during test \"$CURRENT_TEST\"" >>"$TESTENV_END_LOG" + else + echo "Unexpected respawn of \"$*\"" >>"$TESTENV_END_LOG" + fi + + if [ $LAST_STATUS -ge 128 ]; then + echo "respawn: process was terminated abnormally, not respawning" + exit $LAST_STATUS + fi + if [ $SLEEP_BEFORE_RESPAWN -gt 0 ]; then + echo "respawn: sleeping $SLEEP_BEFORE_RESPAWN seconds..." + sleep $SLEEP_BEFORE_RESPAWN + fi + i=$(expr $i + 1) +done +echo "respawn: exiting after $max_i runs" diff --git a/_testenv/testenv.py b/_testenv/testenv.py index 695a857..ec64a73 100755 --- a/_testenv/testenv.py +++ b/_testenv/testenv.py @@ -135,11 +135,30 @@ clean() +def show_end_log(): + if getattr(testenv.args, "action", None) != "run": + return + + end_log = testenv.testdir.testdir_topdir_end_log + if not end_log or not os.path.exists(end_log): + return + + with open(end_log) as e: + lines = e.readlines() + + warnings = "warning" if len(lines) == 1 else "warnings" + logging.warning(f"{len(lines)} {warnings} found in end.log:") + for line in lines: + logging.warning(f"> {line.rstrip()}") + + try: main() + show_end_log() except testenv.NoTraceException as e: logging.error(e) testenv.podman.stop() + show_end_log() sys.exit(2) except KeyboardInterrupt: print() # new line @@ -147,7 +166,9 @@ if test: logging.critical(f"^C during {test}") testenv.podman.stop() + show_end_log() sys.exit(3) except: testenv.podman.stop() + show_end_log() raise diff --git a/_testenv/testenv/daemons.py b/_testenv/testenv/daemons.py index 3ee1e6d..aa8d4c0 100644 --- a/_testenv/testenv/daemons.py +++ b/_testenv/testenv/daemons.py @@ -55,7 +55,10 @@ pipe = f">{shlex.quote(log)} 2>&1" cmd = ["sh", "-c", f"ulimit -c unlimited; {program} {pipe}"] - env = {} + env = { + "TESTENV_END_LOG": testenv.testdir.testdir_topdir_end_log, + "TESTENV_TESTDIR": testenv.testdir.testdir, + } if testenv.args.io_uring: env["LIBOSMO_IO_BACKEND"] = "IO_URING" diff --git a/_testenv/testenv/testdir.py b/_testenv/testenv/testdir.py index 927ce69..a980f09 100644 --- a/_testenv/testenv/testdir.py +++ b/_testenv/testenv/testdir.py @@ -18,12 +18,14 @@ # current configuration. testdir = None testdir_topdir = None +testdir_topdir_end_log = None prefix = None clean_scripts = {} def init(): global testdir_topdir + global testdir_topdir_end_log global prefix prefix = f"testenv-{testenv.args.testsuite}-" @@ -50,6 +52,8 @@ testenv.cmd.run(["rm", "/tmp/logs"], no_podman=True) testenv.cmd.run(["ln", "-sf", testdir_topdir, "/tmp/logs"], no_podman=True) + testdir_topdir_end_log = os.path.join(testdir_topdir, "end.log") + def prepare(cfg_name, cfg, loop_count): global testdir diff --git a/bsc/osmo_bts_omldummy.sh b/bsc/osmo_bts_omldummy.sh index 611f750..8c707af 100755 --- a/bsc/osmo_bts_omldummy.sh +++ b/bsc/osmo_bts_omldummy.sh @@ -17,7 +17,7 @@ ;; esac -respawn.sh \ +respawn-expected.sh \ osmo-bts-omldummy \ "$BTS_FEATURES" \ "127.0.0.1" \ diff --git a/bts/testenv_generic.cfg b/bts/testenv_generic.cfg index 4807d7f..a8c4bef 100644 --- a/bts/testenv_generic.cfg +++ b/bts/testenv_generic.cfg @@ -22,7 +22,7 @@ [bts] prepare=require_ulimit_r.sh 30 -program=respawn.sh osmo-bts-trx +program=respawn-unexpected.sh osmo-bts-trx make=osmo-bts package=osmo-bts copy=osmo-bts.cfg diff --git a/bts/testenv_hopping.cfg b/bts/testenv_hopping.cfg index a7fba70..5c2d4dd 100644 --- a/bts/testenv_hopping.cfg +++ b/bts/testenv_hopping.cfg @@ -25,7 +25,7 @@ [bts] prepare=require_ulimit_r.sh 30 -program=respawn.sh osmo-bts-trx +program=respawn-unexpected.sh osmo-bts-trx make=osmo-bts package=osmo-bts copy=osmo-bts.cfg diff --git a/pcu/testenv_generic.cfg b/pcu/testenv_generic.cfg index 7d506cf..32f56d8 100644 --- a/pcu/testenv_generic.cfg +++ b/pcu/testenv_generic.cfg @@ -3,7 +3,7 @@ config=PCU_Tests.cfg [pcu] -program=respawn.sh osmo-pcu +program=respawn-expected.sh osmo-pcu make=osmo-pcu package=osmo-pcu copy=osmo-pcu.cfg diff --git a/pcu/testenv_sns.cfg b/pcu/testenv_sns.cfg index 0bf4e13..54c377f 100644 --- a/pcu/testenv_sns.cfg +++ b/pcu/testenv_sns.cfg @@ -3,7 +3,7 @@ config=PCU_Tests_SNS.cfg [pcu] -program=respawn.sh osmo-pcu -c osmo-pcu-sns.cfg +program=respawn-expected.sh osmo-pcu -c osmo-pcu-sns.cfg make=osmo-pcu package=osmo-pcu copy=osmo-pcu-sns.cfg -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44175?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Ia0650344b6df428e27de9e011676e884d27bfde0 Gerrit-Change-Number: 44175 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de>
1 0
0 0
[XS] Change in osmo-ttcn3-hacks[refs/meta/config]: Don't do JS syntax highlighting for TTCN-3
by osmith 26 Nov '26

26 Nov '26
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44174?usp=email ) Change subject: Don't do JS syntax highlighting for TTCN-3 ...................................................................... Don't do JS syntax highlighting for TTCN-3 Now that we have patched the docker container to include proper TTCN-3 syntax highlighting, we can remove the old hack. Related: OS#5514 Change-Id: Id02f98e8e6e14d0e143ed2134b94fd3fc71fefdb --- M project.config 1 file changed, 1 insertion(+), 8 deletions(-) Approvals: osmith: Looks good to me, approved; Verified diff --git a/project.config b/project.config index 441e5b7..c70a7e3 100644 --- a/project.config +++ b/project.config @@ -1,11 +1,4 @@ [access] inheritFrom = Cellular Infratructure [submit] - action = rebase if necessary - -# OS#5514: use JS syntax highlighting for TTCN-3, better than none -# https://gerrit-documentation.storage.googleapis.com/Documentation/3.4.3/con… -[mimetype "text/javascript"] - path = *.ttcn -[mimetype "text/javascript"] - path = *.ttcnpp + action = rebase if necessary \ No newline at end of file -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44174?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: refs/meta/config Gerrit-Change-Id: Id02f98e8e6e14d0e143ed2134b94fd3fc71fefdb Gerrit-Change-Number: 44174 Gerrit-PatchSet: 2 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
1 0
0 0
[XS] Change in osmo-ttcn3-hacks[refs/meta/config]: Don't do JS syntax highlighting for TTCN-3
by osmith 26 Nov '26

26 Nov '26
osmith has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44174?usp=email ) Change subject: Don't do JS syntax highlighting for TTCN-3 ...................................................................... Patch Set 2: Verified+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44174?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: refs/meta/config Gerrit-Change-Id: Id02f98e8e6e14d0e143ed2134b94fd3fc71fefdb Gerrit-Change-Number: 44174 Gerrit-PatchSet: 2 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Thu, 26 Nov 2026 08:56:45 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in osmo-ttcn3-hacks[refs/meta/config]: Don't do JS syntax highlighting for TTCN-3
by osmith 26 Nov '26

26 Nov '26
osmith has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44174?usp=email ) Change subject: Don't do JS syntax highlighting for TTCN-3 ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44174?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: refs/meta/config Gerrit-Change-Id: Id02f98e8e6e14d0e143ed2134b94fd3fc71fefdb Gerrit-Change-Number: 44174 Gerrit-PatchSet: 2 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Thu, 26 Nov 2026 08:56:44 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in osmo-ttcn3-hacks[refs/meta/config]: Don't do JS syntax highlighting for TTCN-3
by osmith 26 Nov '26

26 Nov '26
osmith has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44174?usp=email ) Change subject: Don't do JS syntax highlighting for TTCN-3 ...................................................................... Set Ready For Review -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44174?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: refs/meta/config Gerrit-Change-Id: Id02f98e8e6e14d0e143ed2134b94fd3fc71fefdb Gerrit-Change-Number: 44174 Gerrit-PatchSet: 2 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Thu, 26 Nov 2026 08:56:34 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: No
1 0
0 0
[M] Change in ...pyosmocom[master]: Add GSM 7-bit packing and Network Name IE support
by laforge 26 Nov '26

26 Nov '26
laforge has submitted this change. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/43371?usp=email ) Change subject: Add GSM 7-bit packing and Network Name IE support ...................................................................... Add GSM 7-bit packing and Network Name IE support Add gsm7_pack()/gsm7_unpack() (TS 23.038 Section 6.1.2.1) and a NetworkNameAdapter for the Network Name IE (TS 24.008 Section 10.5.3.5a), as used by EF.PNN and MM INFORMATION. This is a separate adapter rather than a parameterization of GsmOrUcs2Adapter: the Network Name header octet clashes with the TS 102 221 Annex A magic bytes, e.g. a 10-septet GSM 7-bit name starts with 0x82, which Annex A reads as UCS-2 variant 3. Change-Id: I4661352e39031dc0041fc7851f675d6083a1035f --- M src/osmocom/construct.py M src/osmocom/utils.py M tests/test_construct.py M tests/test_utils.py 4 files changed, 117 insertions(+), 3 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/osmocom/construct.py b/src/osmocom/construct.py index 548f22d..ef97943 100644 --- a/src/osmocom/construct.py +++ b/src/osmocom/construct.py @@ -18,7 +18,7 @@ from construct.core import evaluate from construct.lib import integertypes -from osmocom.utils import b2h, h2b, swap_nibbles, int_bytes_required +from osmocom.utils import b2h, h2b, swap_nibbles, int_bytes_required, gsm7_pack, gsm7_unpack # (C) 2021-2022 by Harald Welte <laforge(a)osmocom.org> # @@ -252,6 +252,39 @@ else: return _encode_variant1(obj) +class NetworkNameAdapter(Adapter): + """convert the value part of a Network Name IE (TS 24.008 Section 10.5.3.5a) + to a string (and back). + + Wire format: + octet 1: header + bits 7-5: coding scheme + bit 4: add country initials + bits 3-1: spare bits in last octet + octet 2+: GSM 7-bit packed (TS 23.038) or UCS-2 encoded text + + The encoder prefers GSM 7-bit packed and falls back to UCS-2. + It sets the add country initials bit to 0.""" + def _decode(self, obj, context, path): + if len(obj) < 1: + return '' + coding_scheme = (obj[0] >> 4) & 0x07 + num_spare_bits = obj[0] & 0x07 + if coding_scheme == 0: + # GSM 7 bit default alphabet, packed + return codecs.decode(gsm7_unpack(obj[1:], num_spare_bits), 'gsm03.38') + if coding_scheme == 1: + # UCS-2 (16 bit) + return codecs.decode(obj[1:], 'utf_16_be') + raise ValueError('reserved Network Name coding scheme %u' % coding_scheme) + + def _encode(self, obj, context, path): + try: + packed, num_spare_bits = gsm7_pack(codecs.encode(obj, 'gsm03.38')) + return bytes([0x80 | num_spare_bits]) + packed + except ValueError: + return b'\x90' + codecs.encode(obj, 'utf_16_be') + class BcdAdapter(Adapter): """convert a bytes() type to a string of BCD nibbles.""" diff --git a/src/osmocom/utils.py b/src/osmocom/utils.py index 7963c05..c7125c8 100644 --- a/src/osmocom/utils.py +++ b/src/osmocom/utils.py @@ -8,7 +8,7 @@ import datetime import argparse from io import BytesIO -from typing import Optional, List, NewType +from typing import Optional, List, NewType, Tuple # Copyright (C) 2009-2010 Sylvain Munaut <tnt(a)246tNt.com> # Copyright (C) 2021 Harald Welte <laforge(a)osmocom.org> @@ -109,6 +109,38 @@ return hexstr(''.join([x+y for x, y in zip(s[1::2], s[0::2])])) +def gsm7_unpack(packed: bytes, num_spare_bits: int = 0) -> bytes: + """Unpack GSM 7-bit packed septets (3GPP TS 23.038 Section 6.1.2.1). + + Args: + packed : packed 7-bit data + num_spare_bits : number of spare bits in the last octet (0..7) + Returns: + unpacked bytes, one septet per byte + """ + packed_int = int.from_bytes(packed + b'\x01', byteorder='little') + num_septets = (len(packed) * 8 - num_spare_bits) // 7 + return bytes((packed_int >> (i * 7)) & 0x7f for i in range(num_septets)) + + +def gsm7_pack(septets: bytes) -> Tuple[bytes, int]: + """Pack septets into GSM 7-bit packed format (3GPP TS 23.038 Section 6.1.2.1). + + Args: + septets : one septet per byte; each byte must be within 0..127 + Returns: + tuple of (packed bytes, number of spare bits in the last octet) + """ + packed_int = 0 + for i, septet in enumerate(septets): + if septet > 0x7f: + raise ValueError('septet value 0x%02x exceeds 7 bits' % septet) + packed_int |= septet << (i * 7) + num_bits = len(septets) * 7 + num_bytes = (num_bits + 7) // 8 + return packed_int.to_bytes(num_bytes, byteorder='little'), num_bytes * 8 - num_bits + + def rpad(s: str, l: int, c='f') -> str: """pad string on the right side. Args: diff --git a/tests/test_construct.py b/tests/test_construct.py index 195732d..3ccd169 100755 --- a/tests/test_construct.py +++ b/tests/test_construct.py @@ -4,6 +4,7 @@ from osmocom.utils import b2h, h2b from osmocom.construct import Asn1DerInteger, Bytes, DnsAdapter, GreedyInteger, GreedyBytes, PlmnAdapter from osmocom.construct import StripHeaderAdapter, StripTrailerAdapter, Ucs2Adapter, filter_dict +from osmocom.construct import NetworkNameAdapter # pylint: disable=no-name-in-module from construct import FlagsEnum @@ -79,6 +80,32 @@ re_enc = self.ad._encode(string, None, None) self.assertEqual(encoded, re_enc) +class TestNetworkNameAdapter(unittest.TestCase): + ad = NetworkNameAdapter(GreedyBytes) + + testdata = [ + # GSM 7-bit packed, 2 spare bits + ( "Telekom.de", '82d432bbbc7eb75de432' ), + # GSM 7-bit packed, 4 spare bits + ( "Cape", '84c330bc0c' ), + # UCS-2, as the string is not representable in the GSM default alphabet + ( "МТС", '90041c04220421' ), + ] + + def test_data_decode(self): + for string, encoded_hex in self.testdata: + dec = self.ad._decode(h2b(encoded_hex), None, None) + self.assertEqual(dec, string) + + def test_data_encode(self): + for string, encoded_hex in self.testdata: + re_enc = self.ad._encode(string, None, None) + self.assertEqual(h2b(encoded_hex), re_enc) + + def test_reserved_coding_scheme(self): + with self.assertRaises(ValueError): + self.ad._decode(h2b('a0c330bc0c'), None, None) + class TestTrailerAdapter(unittest.TestCase): Privileges = FlagsEnum(StripTrailerAdapter(GreedyBytes, 3), security_domain=0x800000, dap_verification=0x400000, diff --git a/tests/test_utils.py b/tests/test_utils.py index 1b80011..ca9a42b 100755 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -18,7 +18,7 @@ import unittest -from osmocom.utils import hexstr, int_bytes_required +from osmocom.utils import hexstr, int_bytes_required, gsm7_pack, gsm7_unpack class TestHexstr(unittest.TestCase): def test_cmp(self): @@ -54,6 +54,28 @@ self.assertEqual(str(hexstr('ABCD')), 'abcd') +class TestGsm7PackUnpack(unittest.TestCase): + # (packed, num_spare_bits, septets) + tests = [ + ( b'', 0, b'' ), + ( b'\x61', 1, b'a' ), + ( b'\xd4\x32\xbb\xbc\x7e\xb7\x5d\xe4\x32', 2, b'Telekom.de' ), + ( b'\xc8\x32\x9b\xfd\x06\x5d\xdf\x72\x36\x19', 3, b'Hello World' ), + ] + + def test_gsm7_unpack(self): + for packed, num_spare_bits, septets in self.tests: + self.assertEqual(gsm7_unpack(packed, num_spare_bits), septets) + + def test_gsm7_pack(self): + for packed, num_spare_bits, septets in self.tests: + self.assertEqual(gsm7_pack(septets), (packed, num_spare_bits)) + + def test_gsm7_pack_septet_out_of_range(self): + with self.assertRaises(ValueError): + gsm7_pack(b'\x80') + + class Test_int_bytes_required(unittest.TestCase): def test_int_bytes_required(self): -- To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/43371?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: python/pyosmocom Gerrit-Branch: master Gerrit-Change-Id: I4661352e39031dc0041fc7851f675d6083a1035f Gerrit-Change-Number: 43371 Gerrit-PatchSet: 5 Gerrit-Owner: biocape <biofel(a)cape.co> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
1 0
0 0
[M] Change in ...pyosmocom[master]: Add GSM 7-bit packing and Network Name IE support
by laforge 26 Nov '26

26 Nov '26
Attention is currently required from: biocape, dexter, fixeria. laforge has posted comments on this change by biocape. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/43371?usp=email ) Change subject: Add GSM 7-bit packing and Network Name IE support ...................................................................... Patch Set 5: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/43371?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: python/pyosmocom Gerrit-Branch: master Gerrit-Change-Id: I4661352e39031dc0041fc7851f675d6083a1035f Gerrit-Change-Number: 43371 Gerrit-PatchSet: 5 Gerrit-Owner: biocape <biofel(a)cape.co> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Attention: biocape <biofel(a)cape.co> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Thu, 26 Nov 2026 01:55:55 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in pysim[master]: Decode GSM 7-bit packed EF.PNN data
by laforge 26 Nov '26

26 Nov '26
Attention is currently required from: biocape, fixeria, laforge. laforge has uploaded a new patch set (#4) to the change originally created by biocape. ( https://gerrit.osmocom.org/c/pysim/+/41913?usp=email ) The following approvals got outdated and were removed: Code-Review+1 by laforge, Code-Review+2 by fixeria Change subject: Decode GSM 7-bit packed EF.PNN data ...................................................................... Decode GSM 7-bit packed EF.PNN data Use the NetworkNameAdapter from pyosmocom to decode the Network Name IEs (TS 24.008 Section 10.5.3.5a) in EF.PNN records, instead of exposing the raw bytes. Depends: pyosmocom.git Change-Id I4661352e39031dc0041fc7851f675d6083a1035f Change-Id: I4558fd011592aeeae2389fe8a1f62f3d7e21d219 Closes: OS#6930 --- M pySim/ts_51_011.py M requirements.txt M setup.py 3 files changed, 13 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/13/41913/4 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/41913?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I4558fd011592aeeae2389fe8a1f62f3d7e21d219 Gerrit-Change-Number: 41913 Gerrit-PatchSet: 4 Gerrit-Owner: biocape <biofel(a)cape.co> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: biocape <biofel(a)cape.co> Gerrit-Attention: laforge <laforge(a)osmocom.org>
1 0
0 0
[M] Change in ...pyosmocom[master]: Add GSM 7-bit packing and Network Name IE support
by laforge 26 Nov '26

26 Nov '26
Attention is currently required from: biocape, dexter, fixeria, laforge. laforge has uploaded a new patch set (#5) to the change originally created by biocape. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/43371?usp=email ) Change subject: Add GSM 7-bit packing and Network Name IE support ...................................................................... Add GSM 7-bit packing and Network Name IE support Add gsm7_pack()/gsm7_unpack() (TS 23.038 Section 6.1.2.1) and a NetworkNameAdapter for the Network Name IE (TS 24.008 Section 10.5.3.5a), as used by EF.PNN and MM INFORMATION. This is a separate adapter rather than a parameterization of GsmOrUcs2Adapter: the Network Name header octet clashes with the TS 102 221 Annex A magic bytes, e.g. a 10-septet GSM 7-bit name starts with 0x82, which Annex A reads as UCS-2 variant 3. Change-Id: I4661352e39031dc0041fc7851f675d6083a1035f --- M src/osmocom/construct.py M src/osmocom/utils.py M tests/test_construct.py M tests/test_utils.py 4 files changed, 117 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/python/pyosmocom refs/changes/71/43371/5 -- To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/43371?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: python/pyosmocom Gerrit-Branch: master Gerrit-Change-Id: I4661352e39031dc0041fc7851f675d6083a1035f Gerrit-Change-Number: 43371 Gerrit-PatchSet: 5 Gerrit-Owner: biocape <biofel(a)cape.co> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: biocape <biofel(a)cape.co> Gerrit-Attention: laforge <laforge(a)osmocom.org>
1 0
0 0
[M] Change in ...pyosmocom[master]: Add GSM 7-bit packing and Network Name IE support
by laforge 26 Nov '26

26 Nov '26
Attention is currently required from: biocape, dexter, fixeria, laforge. laforge has uploaded a new patch set (#3) to the change originally created by biocape. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/43371?usp=email ) The following approvals got outdated and were removed: Code-Review+2 by laforge Change subject: Add GSM 7-bit packing and Network Name IE support ...................................................................... Add GSM 7-bit packing and Network Name IE support Add gsm7_pack()/gsm7_unpack() (TS 23.038 Section 6.1.2.1) and a NetworkNameAdapter for the Network Name IE (TS 24.008 Section 10.5.3.5a), as used by EF.PNN and MM INFORMATION. This is a separate adapter rather than a parameterization of GsmOrUcs2Adapter: the Network Name header octet clashes with the TS 102 221 Annex A magic bytes, e.g. a 10-septet GSM 7-bit name starts with 0x82, which Annex A reads as UCS-2 variant 3. Change-Id: I4661352e39031dc0041fc7851f675d6083a1035f Closes: OS#6930 --- M src/osmocom/construct.py M src/osmocom/utils.py M tests/test_construct.py M tests/test_utils.py 4 files changed, 117 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/python/pyosmocom refs/changes/71/43371/3 -- To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/43371?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: python/pyosmocom Gerrit-Branch: master Gerrit-Change-Id: I4661352e39031dc0041fc7851f675d6083a1035f Gerrit-Change-Number: 43371 Gerrit-PatchSet: 3 Gerrit-Owner: biocape <biofel(a)cape.co> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: biocape <biofel(a)cape.co> Gerrit-Attention: laforge <laforge(a)osmocom.org>
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • ...
  • 9721
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.