osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38285?usp=email )
Change subject: testenv: improve --config argument parsing
......................................................................
testenv: improve --config argument parsing
* Support using wildcards for the config names via fnmatch as that makes
it much easier to run the ggsn tests against all osmo-ggsn config
variations, and update the examples in "testenv.py -h" to illustrate
this.
* Fix that it didn't complain about an invalid --config argument, as
long as there was a valid --config argument before it.
* Let raise_error_config_arg only output the invalid --config argument
instead of all of them.
* Complain if "--config all" is used in combination with another
--config argument.
* Sort testenv*.cfg files found alphabetically, so they are always
executed in the same order.
Change-Id: I66b976b0332be523c084a6b5d38d0f62134b495d
---
M _testenv/testenv/__init__.py
M _testenv/testenv/testdir.py
M _testenv/testenv/testenv_cfg.py
3 files changed, 31 insertions(+), 13 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
fixeria: Looks good to me, approved
diff --git a/_testenv/testenv/__init__.py b/_testenv/testenv/__init__.py
index 87485c7..2af83ed 100644
--- a/_testenv/testenv/__init__.py
+++ b/_testenv/testenv/__init__.py
@@ -43,7 +43,9 @@
" ./testenv.py run mgw --test TC_crcx\n"
" ./testenv.py run mgw --podman --binary-repo osmocom:latest\n"
" ./testenv.py run mgw --io-uring\n"
- " ./testenv.py run bts --config oml\n",
+ " ./testenv.py run ggsn --config open5gs\n"
+ " ./testenv.py run ggsn --config 'osmo_ggsn_v4_only'\n"
+ " ./testenv.py run ggsn --config 'osmo_ggsn*'\n",
)
sub = parser.add_subparsers(title="action", dest="action", required=True)
@@ -77,7 +79,7 @@
"-c",
"--config",
action="append",
- help="which testenv.cfg to use, in case the testsuite has multiple (e.g. generic|oml|hopping for bts)",
+ help="which testenv.cfg to use (supports * wildcards via fnmatch)",
)
group.add_argument("-i", "--io-uring", action="store_true", help="set LIBOSMO_IO_BACKEND=IO_URING")
diff --git a/_testenv/testenv/testdir.py b/_testenv/testenv/testdir.py
index ee698fff..aa0ba47 100644
--- a/_testenv/testenv/testdir.py
+++ b/_testenv/testenv/testdir.py
@@ -28,7 +28,7 @@
prefix = f"testenv-{testenv.args.testsuite}-"
if testenv.args.config:
- prefix += f"{'-'.join(testenv.args.config)}-"
+ prefix += f"{'-'.join(testenv.args.config).replace('*','')}-"
if testenv.args.binary_repo:
prefix += f"{testenv.args.binary_repo.replace(':','-')}-"
prefix += datetime.datetime.now().strftime("%Y%m%d-%H%M")
diff --git a/_testenv/testenv/testenv_cfg.py b/_testenv/testenv/testenv_cfg.py
index 9642ae8..ba830a1 100644
--- a/_testenv/testenv/testenv_cfg.py
+++ b/_testenv/testenv/testenv_cfg.py
@@ -1,6 +1,7 @@
# Copyright 2024 sysmocom - s.f.m.c. GmbH
# SPDX-License-Identifier: GPL-3.0-or-later
import configparser
+import fnmatch
import glob
import logging
import os.path
@@ -134,14 +135,14 @@
get_vty_host_port(cfg, path)
-def raise_error_config_arg(glob_result):
+def raise_error_config_arg(glob_result, config_arg):
valid = []
for path in glob_result:
basename = os.path.basename(path)
if basename != "testenv.cfg":
valid += [basename.split("_", 1)[1].split(".", -1)[0]]
- msg = f"Invalid parameter for --config: {testenv.args.config}"
+ msg = f"Invalid parameter for --config: {config_arg}"
if valid:
msg += f" (valid: all, {', '.join(valid)})"
@@ -154,7 +155,7 @@
def find_configs():
dir_testsuite = os.path.join(testenv.testsuite.ttcn3_hacks_dir_src, testenv.args.testsuite)
pattern = os.path.join(dir_testsuite, "testenv*.cfg")
- ret = glob.glob(pattern)
+ ret = sorted(glob.glob(pattern))
if not ret:
logging.error(f"Missing testenv.cfg in: {dir_testsuite}")
@@ -185,6 +186,8 @@
def init():
global cfgs
+ cfgs_all = {}
+
config_paths = find_configs()
for path in config_paths:
@@ -201,14 +204,27 @@
handle_latest(cfg, path)
verify(cfg, path)
+ # No --config argument given, and there is only one testenv.cfg
if not testenv.args.config:
cfgs[basename] = cfg
- continue
+ return
- for config_arg in testenv.args.config:
- if config_arg == "all" or f"testenv_{config_arg}.cfg" == basename:
- cfgs[basename] = cfg
- break
+ cfgs_all[basename] = cfg
- if not cfgs:
- raise_error_config_arg(config_paths)
+ # Select configs based on --config argument(s)
+ for config_arg in testenv.args.config:
+ if config_arg == "all":
+ if len(testenv.args.config) != 1:
+ raise testenv.NoTraceException("Can't use multiple --config arguments if one of them is 'all'")
+ cfgs = cfgs_all
+ return
+
+ matched = False
+ for basename in cfgs_all:
+ pattern = f"testenv_{config_arg}.cfg"
+ if fnmatch.fnmatch(basename, pattern):
+ matched = True
+ cfgs[basename] = cfgs_all[basename]
+
+ if not matched:
+ raise_error_config_arg(config_paths, config_arg)
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38285?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: master
Gerrit-Change-Id: I66b976b0332be523c084a6b5d38d0f62134b495d
Gerrit-Change-Number: 38285
Gerrit-PatchSet: 4
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38283?usp=email )
Change subject: ruff.toml: new file
......................................................................
ruff.toml: new file
Add a file in the root dir of the repository to allow running
"ruff format" in order to auto-format the code with expected max line
length, PEP-8, etc.
Replace _testenv/pyproject.toml with .ruff.toml in the root directory of
the repository, so we can exclude "compare-results.py" which doesn't
follow that code style. Otherwise it would get formatted too when
running "ruff format" in the root dir of the repository.
Change-Id: I97ed1ececba85008ca754cf91bf46522e168a894
---
A .ruff.toml
D _testenv/pyproject.toml
2 files changed, 4 insertions(+), 2 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
laforge: Looks good to me, but someone else must approve
diff --git a/.ruff.toml b/.ruff.toml
new file mode 100644
index 0000000..ad8c0b5
--- /dev/null
+++ b/.ruff.toml
@@ -0,0 +1,4 @@
+line-length = 120
+exclude = [
+ "compare-results.py",
+]
diff --git a/_testenv/pyproject.toml b/_testenv/pyproject.toml
deleted file mode 100644
index 3719b74..0000000
--- a/_testenv/pyproject.toml
+++ /dev/null
@@ -1,2 +0,0 @@
-[tool.ruff]
-line-length=120
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38283?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: master
Gerrit-Change-Id: I97ed1ececba85008ca754cf91bf46522e168a894
Gerrit-Change-Number: 38283
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
dexter has submitted this change. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/38287?usp=email )
Change subject: test_construct: move testvectors inside unittest class
......................................................................
test_construct: move testvectors inside unittest class
The unittest class TestGreedyInt has test vectors declared outside
that class, but no other class makes use of this test vectors, so
let's move them into TestGreedyInt, where they should be.
Related: SYS#7094
Change-Id: Ida24295091efd30406e9a354ca5854150127b3d4
---
M tests/test_construct.py
1 file changed, 5 insertions(+), 5 deletions(-)
Approvals:
laforge: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/tests/test_construct.py b/tests/test_construct.py
index 9110144..c2aeece 100755
--- a/tests/test_construct.py
+++ b/tests/test_construct.py
@@ -6,21 +6,21 @@
# pylint: disable=no-name-in-module
from construct import FlagsEnum
-tests = [
+class TestGreedyInt(unittest.TestCase):
+ tests = [
( b'\x80', 0x80 ),
( b'\x80\x01', 0x8001 ),
( b'\x80\x00\x01', 0x800001 ),
( b'\x80\x23\x42\x01', 0x80234201 ),
- ]
+ ]
-class TestGreedyInt(unittest.TestCase):
def test_GreedyInt_decoder(self):
gi = GreedyInteger()
- for t in tests:
+ for t in self.tests:
self.assertEqual(gi.parse(t[0]), t[1])
def test_GreedyInt_encoder(self):
gi = GreedyInteger()
- for t in tests:
+ for t in self.tests:
self.assertEqual(t[0], gi.build(t[1]))
pass
--
To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/38287?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: Ida24295091efd30406e9a354ca5854150127b3d4
Gerrit-Change-Number: 38287
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
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>
Attention is currently required from: fixeria, pespin.
Hello Jenkins Builder, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/38241?usp=email
to look at the new patch set (#4).
The following approvals got outdated and were removed:
Code-Review+1 by pespin, Verified+1 by Jenkins Builder
Change subject: s1ap_proxy: handle E-RAB RELEASE INDICATION
......................................................................
s1ap_proxy: handle E-RAB RELEASE INDICATION
Change-Id: I13584620e28edf529325dc661c4b40d09acacc3f
---
M src/s1ap_proxy.erl
M test/s1ap_proxy_test.erl
2 files changed, 54 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw refs/changes/41/38241/4
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/38241?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: I13584620e28edf529325dc661c4b40d09acacc3f
Gerrit-Change-Number: 38241
Gerrit-PatchSet: 4
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: fixeria, laforge, lynxis lazus.
fixeria has uploaded a new patch set (#6) to the change originally created by pespin. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/37924?usp=email )
The following approvals got outdated and were removed:
Code-Review+1 by laforge, Code-Review-1 by fixeria, Verified+1 by Jenkins Builder
Change subject: s1ap_proxy: Support replying errors
......................................................................
s1ap_proxy: Support replying errors
Sometimes it is needed not only to forward, but to transmit messages
initiated at the S1GW. This is the case, for instance, if the MME
wants to initiate an E-RAB establishment, but the co-located UPF is
not available at the time or responds with an error.
This patch adds the generic infrastructure to be able to reply
(errors) and implements the above mentioned specific case for
the S1AP E-RAB SETUP REQUEST procedure.
Change-Id: I242e84fb09b00f4794b6e1aa770f348a0e60aea4
---
M src/s1ap_proxy.erl
M src/sctp_proxy.erl
M test/s1ap_proxy_test.erl
3 files changed, 281 insertions(+), 147 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw refs/changes/24/37924/6
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/37924?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: I242e84fb09b00f4794b6e1aa770f348a0e60aea4
Gerrit-Change-Number: 37924
Gerrit-PatchSet: 6
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu>