laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/40119?usp=email )
Change subject: edit_{binary,record}_decoded: Support hex-decode of bytes
......................................................................
edit_{binary,record}_decoded: Support hex-decode of bytes
We've created + used osmocom.utils.JsonEncoder as an encoder class
for json.{dump,dumps} for quite some time. However, we missed to
use this decoder class from the edit_{binary,record}_decoded commands
in the pySim-shell VTY.
Change-Id: I158e028f9920d8085cd20ea022be2437c64ad700
Related: OS#6774
---
M pySim/filesystem.py
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/19/40119/1
diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index 7f350ec..8821380 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -661,7 +661,7 @@
filename = '%s/file' % dirname
# write existing data as JSON to file
with open(filename, 'w') as text_file:
- json.dump(orig_json, text_file, indent=4)
+ json.dump(orig_json, text_file, indent=4, cls=JsonEncoder)
# run a text editor
self._cmd.run_editor(filename)
with open(filename, 'r') as text_file:
@@ -963,7 +963,7 @@
filename = '%s/file' % dirname
# write existing data as JSON to file
with open(filename, 'w') as text_file:
- json.dump(orig_json, text_file, indent=4)
+ json.dump(orig_json, text_file, indent=4, cls=JsonEncoder)
# run a text editor
self._cmd.run_editor(filename)
with open(filename, 'r') as text_file:
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/40119?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I158e028f9920d8085cd20ea022be2437c64ad700
Gerrit-Change-Number: 40119
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/40117?usp=email )
Change subject: osmocom.construct: Bytes + GreedyBytes with automatic hexstring-conversion
......................................................................
osmocom.construct: Bytes + GreedyBytes with automatic hexstring-conversion
This is a convenience version of the Bytes / GreedyBytes construct
that accepts not only a bytes/bytearray object, but also a hex-encoded
string within the encoder.
Related: OS#6774
Change-Id: I59f500c925848872a7fa38d6dbf3d6ea72bc3a90
---
M src/osmocom/construct.py
1 file changed, 16 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/python/pyosmocom refs/changes/17/40117/1
diff --git a/src/osmocom/construct.py b/src/osmocom/construct.py
index 7a2851a..620d3f2 100644
--- a/src/osmocom/construct.py
+++ b/src/osmocom/construct.py
@@ -10,9 +10,10 @@
# pylint: disable=import-error,no-name-in-module
from construct.lib.containers import Container, ListContainer
from construct.core import EnumIntegerString
-from construct import Adapter, Prefixed, Int8ub, GreedyBytes, Default, Flag, Byte, Construct, Enum
-from construct import BitsInteger, BitStruct, Bytes, StreamError, stream_read_entire, stream_write
+from construct import Adapter, Prefixed, Int8ub, Default, Flag, Byte, Construct, Enum
+from construct import BitsInteger, BitStruct, StreamError, stream_read_entire, stream_write
from construct import SizeofError, IntegerError, swapbytes
+import construct
from construct.core import evaluate
from construct.lib import integertypes
@@ -33,6 +34,19 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+class Bytes(construct.Bytes):
+ """Just like construct.Bytes but supporting hex-string input."""
+ def _build(self, obj, stream, context, path):
+ data = h2b(data) if isinstance(obj, str) else obj
+ return super()._build(data, stream, context, path)
+
+(a)construct.core.singleton
+class GreedyBytes(construct.GreedyBytes.__class__):
+ """Just like construct.GreedyBytes but supporting hex-string input."""
+ def _build(self, obj, stream, context, path):
+ data = h2b(data) if isinstance(obj, str) else obj
+ return super()._build(data, stream, context, path)
+
class HexAdapter(Adapter):
"""convert a bytes() type to a string of hex nibbles."""
--
To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/40117?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: python/pyosmocom
Gerrit-Branch: master
Gerrit-Change-Id: I59f500c925848872a7fa38d6dbf3d6ea72bc3a90
Gerrit-Change-Number: 40117
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40116?usp=email )
Change subject: start-testsuite: fix passing $TEST to ttcn3_start
......................................................................
start-testsuite: fix passing $TEST to ttcn3_start
Fix that testenv / ttcn3_start kept running after the testsuites were
already done. This was caused by passing an empty string to ttcn3_start
as test argument, which causes it to still use the config file, but run
in a single test mode:
https://gitlab.eclipse.org/eclipse/titan/titan.core/-/blob/9.0.0/mctr2/mctr…
After the first test ran, ttcn3_start sends "emtc" to the MTC, which
replies with "MTC cannot be terminated." as it is still in
MC_EXECUTING_TESTCASE instead of MC_READY:
https://gitlab.eclipse.org/eclipse/titan/titan.core/-/blob/9.0.0/mctr2/cli/…
The ttcn3_start script then waits forever for the "MTC terminated.."
string, which doesn't come since "emtc" isn't sent to the MTC a second
time:
https://gitlab.eclipse.org/eclipse/titan/titan.core/-/blob/9.0.0/mctr2/mctr…
Fixes: 050ba48c ("buildsystem: build out-of-tree")
Change-Id: Ic50de8350e20d101417c5689058b64fe6547126f
---
M start-testsuite.sh
1 file changed, 6 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, approved
diff --git a/start-testsuite.sh b/start-testsuite.sh
index 8c55779..4f2fba4 100755
--- a/start-testsuite.sh
+++ b/start-testsuite.sh
@@ -55,11 +55,16 @@
# below is for the debian packages
TTCN3_BIN_DIR="${TTCN3_BIN_DIR:-/usr/bin}"
TITAN_LIBRARY_PATH="${TITAN_LIBRARY_PATH:-/usr/lib/titan:/usr/ttcn3/lib}"
+
+# Run ttcn3_start with LD_LIBRARY_PATH. Do not put $TEST in quotes as it can be
+# empty and must be omitted in that case. Otherwise ttcn3_start tries to stop
+# the MTC after the first test, which fails with "MTC cannot be terminated" and
+# then ttcn3_start keeps running even after the testsuite has stopped.
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$BUILDDIR/$SUITE_DIR:$TITAN_LIBRARY_PATH" \
"$TTCN3_BIN_DIR/ttcn3_start" \
"$BUILDDIR/$SUITE_DIR/$SUITE_NAME" \
"$CFG" \
- "$TEST"
+ $TEST
expected="$TOPDIR/$SUITE_DIR/expected-results.xml"
if [ ! -f "$expected" ]; then
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40116?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: Ic50de8350e20d101417c5689058b64fe6547126f
Gerrit-Change-Number: 40116
Gerrit-PatchSet: 3
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>
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40116?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder
Change subject: start-testsuite: fix passing $TEST to ttcn3_start
......................................................................
start-testsuite: fix passing $TEST to ttcn3_start
Fix that testenv / ttcn3_start kept running after the testsuites were
already done. This was caused by passing an empty string to ttcn3_start
as test argument, which causes it to still use the config file, but run
in a single test mode:
https://gitlab.eclipse.org/eclipse/titan/titan.core/-/blob/9.0.0/mctr2/mctr…
After the first test ran, ttcn3_start sends "emtc" to the MTC, which
replies with "MTC cannot be terminated." as it is still in
MC_EXECUTING_TESTCASE instead of MC_READY:
https://gitlab.eclipse.org/eclipse/titan/titan.core/-/blob/9.0.0/mctr2/cli/…
The ttcn3_start script then waits forever for the "MTC terminated.."
string, which doesn't come since "emtc" isn't sent to the MTC a second
time:
https://gitlab.eclipse.org/eclipse/titan/titan.core/-/blob/9.0.0/mctr2/mctr…
Fixes: 050ba48c ("buildsystem: build out-of-tree")
Change-Id: Ic50de8350e20d101417c5689058b64fe6547126f
---
M start-testsuite.sh
1 file changed, 6 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/16/40116/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40116?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ic50de8350e20d101417c5689058b64fe6547126f
Gerrit-Change-Number: 40116
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40116?usp=email
to look at the new patch set (#2).
Change subject: start-testsuite: fix passing $TEST to ttcn3_start
......................................................................
start-testsuite: fix passing $TEST to ttcn3_start
Fix that testenv / ttcn3_start kept running after the testsuites were
already done. This was caused by passing an empty string to ttcn3_start
as test argument, which causes it to still use the config file, but run
in a single test mode:
https://gitlab.eclipse.org/eclipse/titan/titan.core/-/blob/9.0.0/mctr2/mctr…
After the first test ran, ttcn3_start sends "emtc" to the MTC, which
replies with "MTC cannot be terminated." as it is still in
MC_EXECUTING_TESTCASE instead of MC_READY:
https://gitlab.eclipse.org/eclipse/titan/titan.core/-/blob/9.0.0/mctr2/cli/…
The ttcn3_start script then waits forever for the "MTC terminated.."
string, which doesn't come since "emtc" isn't sent to the MTC a second
time:
https://gitlab.eclipse.org/eclipse/titan/titan.core/-/blob/9.0.0/mctr2/mctr…
Fixes: 050ba48c ("buildsystem: build out-of-tree")
Change-Id: Ic50de8350e20d101417c5689058b64fe6547126f
---
M start-testsuite.sh
1 file changed, 7 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/16/40116/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40116?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ic50de8350e20d101417c5689058b64fe6547126f
Gerrit-Change-Number: 40116
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder