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/.
fixeria gerrit-no-reply at lists.osmocom.orgfixeria has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmocom-bb/+/14572 ) Change subject: trx_toolkit/data_msg.py: tests: use random reference data ...................................................................... trx_toolkit/data_msg.py: tests: use random reference data Having fn = 1024 and tn = 0 in all tests decreases the chances to spot encoding / decoding bugs of higher or lower values. Let's randomize the reference data before all the tests. Change-Id: Id3c5be9faaf0bef727b975c7182098af0cec6e71 --- M src/target/trx_toolkit/data_msg.py 1 file changed, 14 insertions(+), 27 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/target/trx_toolkit/data_msg.py b/src/target/trx_toolkit/data_msg.py index da109d9..5cfb745 100644 --- a/src/target/trx_toolkit/data_msg.py +++ b/src/target/trx_toolkit/data_msg.py @@ -432,10 +432,6 @@ log.basicConfig(level = log.DEBUG, format = "[%(levelname)s] %(filename)s:%(lineno)d %(message)s") - # Common reference data - fn = 1024 - tn = 0 - # Generate two random bursts burst_l12trx_ref = [] burst_trx2l1_ref = [] @@ -450,17 +446,18 @@ log.info("Generating the reference messages") # Create messages of both types - msg_l12trx_ref = DATAMSG_L12TRX(fn = fn, tn = tn) - msg_trx2l1_ref = DATAMSG_TRX2L1(fn = fn, tn = tn) + msg_l12trx_ref = DATAMSG_L12TRX(burst = burst_l12trx_ref) + msg_trx2l1_ref = DATAMSG_TRX2L1(burst = burst_trx2l1_ref) - # Fill in message specific fields - msg_trx2l1_ref.rssi = -88 - msg_l12trx_ref.pwr = 0x33 - msg_trx2l1_ref.toa256 = -256 + # Validate header randomization + for i in range(0, 100): + msg_l12trx_ref.rand_hdr() + msg_trx2l1_ref.rand_hdr() - # Specify the reference bursts - msg_l12trx_ref.burst = burst_l12trx_ref - msg_trx2l1_ref.burst = burst_trx2l1_ref + assert(msg_l12trx_ref.validate()) + assert(msg_trx2l1_ref.validate()) + + log.info("Validate header randomization: OK") log.info("Encoding the reference messages") @@ -493,10 +490,10 @@ log.info("Compare bursts: OK") # Compare both parsed messages with the reference data - assert(msg_l12trx_dec.fn == fn) - assert(msg_trx2l1_dec.fn == fn) - assert(msg_l12trx_dec.tn == tn) - assert(msg_trx2l1_dec.tn == tn) + assert(msg_l12trx_dec.fn == msg_l12trx_ref.fn) + assert(msg_trx2l1_dec.fn == msg_trx2l1_ref.fn) + assert(msg_l12trx_dec.tn == msg_l12trx_ref.tn) + assert(msg_trx2l1_dec.tn == msg_trx2l1_ref.tn) log.info("Compare FN / TN: OK") @@ -507,16 +504,6 @@ log.info("Compare message specific data: OK") - # Validate header randomization - for i in range(0, 100): - msg_l12trx_ref.rand_hdr() - msg_trx2l1_ref.rand_hdr() - - assert(msg_l12trx_ref.validate()) - assert(msg_trx2l1_ref.validate()) - - log.info("Validate header randomization: OK") - # Bit conversation test usbits_ref = list(range(0, 256)) sbits_ref = list(range(-127, 128)) -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/14572 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Id3c5be9faaf0bef727b975c7182098af0cec6e71 Gerrit-Change-Number: 14572 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <axilirator at gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <axilirator at gmail.com> Gerrit-Reviewer: laforge <laforge at gnumonks.org> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190624/e63477b7/attachment.htm>