laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/38255?usp=email )
Change subject: pySim-shell: New '-e' command line argument
......................................................................
pySim-shell: New '-e' command line argument
Using '-e' it is possible to specify *multiple* pySim-shell commands
which shall be executed at startup. This extends the current ability
to execute just a single command.
Example:
./pySim-shell.py -p0 -e 'select ADF.USIM/EF.IMSI' -e 'read_binary_decoded'
Change-Id: I74004f46105553f077c039ca0f86f75afccc7342
---
M pySim-shell.py
1 file changed, 9 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/pySim-shell.py b/pySim-shell.py
index 8c260aa..37d58ae 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -1056,6 +1056,8 @@
adm_group.add_argument('-A', '--pin-adm-hex', metavar='PIN_ADM1_HEX', dest='pin_adm_hex', default=None,
help='ADM PIN used for provisioning, as hex string (16 characters long)')
+option_parser.add_argument('-e', '--execute-command', action='append', default=[],
+ help='A pySim-shell command that will be executed at startup')
option_parser.add_argument("command", nargs='?',
help="A pySim-shell command that would optionally be executed at startup")
option_parser.add_argument('command_args', nargs=argparse.REMAINDER,
@@ -1122,6 +1124,13 @@
print(e)
print("---------------------8<---------------------")
+ # Run optional commands
+ for c in opts.execute_command:
+ if not startup_errors:
+ app.onecmd_plus_hooks(c)
+ else:
+ print("Errors during startup, refusing to execute command (%s)" % c)
+
# Run optional command
if opts.command:
if not startup_errors:
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38255?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I74004f46105553f077c039ca0f86f75afccc7342
Gerrit-Change-Number: 38255
Gerrit-PatchSet: 4
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: dexter <pmaier(a)sysmocom.de>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/38268?usp=email )
Change subject: contrib/jenkins: run pysim tests too
......................................................................
contrib/jenkins: run pysim tests too
Related: OS#6570
Change-Id: I6bb7f137d3124e68574bc599969a8e7fd8b68904
---
M contrib/jenkins.sh
1 file changed, 23 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh
index afd66eb..e5f8147 100755
--- a/contrib/jenkins.sh
+++ b/contrib/jenkins.sh
@@ -48,7 +48,30 @@
make -C "docs" publish publish-html
fi
;;
+"pysim")
+ # Run the pysim tests with pyosmocom from this tree (OS#6570)
+ virtualenv -p python3 venv --system-site-packages
+ . venv/bin/activate
+ pip install . --force-reinstall
+ deactivate
+ # Clone pysim and remove pyosmocom from requirements.txt, we want to
+ # use the version that was just installed into the venv instead
+ rm -rf pysim
+ git clone https://gerrit.osmocom.org/pysim --depth=1 --branch=master
+ cd pysim
+ sed -i '/^pyosmocom>=.*/d' requirements.txt
+ if grep -q pyosmocom requirements.txt; then
+ cat requirements.txt
+ set +x
+ echo "ERROR: failed to remove pyosmocom from pysim's requirements.txt"
+ exit 1
+ fi
+
+ # Let pysim enter the same venv and run the tests
+ ln -s ../venv .
+ SKIP_CLEAN_WORKSPACE=1 JOB_TYPE="test" contrib/jenkins.sh
+ ;;
*)
set +x
echo "ERROR: JOB_TYPE has unexpected value '$JOB_TYPE'."
--
To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/38268?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: I6bb7f137d3124e68574bc599969a8e7fd8b68904
Gerrit-Change-Number: 38268
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Attention is currently required from: laforge.
Hello Jenkins Builder, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/38195?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: filesystem: pass total_len to construct of when encoding file contents
......................................................................
filesystem: pass total_len to construct of when encoding file contents
In our construct models we frequently use a context parameter "total_len",
we also pass this parameter to construct when we decode files, but we
do not pass it when we generate files. This is a problem, because when
total_len is used in the construct model, this parameter must be known
also when decoding the file.
Let's make sure that the total_len is properly determined and and passed
to construct (via pyosmocom)
Related: OS#5714
Change-Id: I1b7a51594fbc5d9fe01132c39354a2fa88d53f9b
---
M pySim/filesystem.py
M pySim/gsm_r.py
M pySim/runtime.py
M pySim/sysmocom_sja2.py
M pySim/ts_31_102.py
M pySim/ts_31_102_telecom.py
M pySim/ts_51_011.py
7 files changed, 94 insertions(+), 37 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/95/38195/3
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38195?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: I1b7a51594fbc5d9fe01132c39354a2fa88d53f9b
Gerrit-Change-Number: 38195
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Attention is currently required from: laforge.
dexter has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/38195?usp=email )
Change subject: filesystem: pass total_len to construct of when encoding file contents
......................................................................
Patch Set 3:
(1 comment)
File pySim/filesystem.py:
https://gerrit.osmocom.org/c/pysim/+/38195/comment/63d2106f_d68471e6?usp=em… :
PS2, Line 1338: def _decode_bin(self, raw_bin_data: bytearray):
: chunks = [raw_bin_data[i:i+self.rec_len]
: for i in range(0, len(raw_bin_data), self.rec_len)]
: return [self.decode_record_bin(x) for x in chunks]
:
: def _encode_bin(self, abstract_data) -> bytes:
: chunks = [self.encode_record_bin(x) for x in abstract_data]
: # FIXME: pad to file size
: return b''.join(chunks)
> you are not passing the total_len as argument to the self.{encode,decode}_record_bin here. […]
Thanks for the explaination, I think I got my head around this now.
I have now revisited the code and have added a total_len parameter to the _encode_bin and _encode_hex methods. I also thing that we should also have total_len parameters on the _encode_record_hex and _encode_record_bin methods, in case someone needs the total_len parameter in one of those custom methods.
All derived classes with custom encoder methods should now accept a total_len parameters. I have put a kwargs on each method that does not use the total_len parameter. I have seen that _encode_record_bin/hex have kwargs as well, so I think that makes sense.
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38195?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I1b7a51594fbc5d9fe01132c39354a2fa88d53f9b
Gerrit-Change-Number: 38195
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Mon, 23 Sep 2024 16:16:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Attention is currently required from: osmith.
laforge has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/38268?usp=email )
Change subject: contrib/jenkins: run pysim tests too
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/38268?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: I6bb7f137d3124e68574bc599969a8e7fd8b68904
Gerrit-Change-Number: 38268
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 23 Sep 2024 16:14:37 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes