Project

General

Profile

Actions

Bug #4503

closed

printing pc/sc reader device number in tester is non-determinstic

Added by laforge almost 4 years ago. Updated almost 4 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
04/19/2020
Due date:
% Done:

100%

Spec Reference:

Description

pySim-read + pySim-prog print
Using PC/SC reader (dev=5) interfacet
during normal operation. dev=5 is the PC/SC reader number, which is non-deterministic and messes up the *.ok test results.

I think we need to address this separately. The message should not be printed at all during the tests. The PC/SC device numbers are not stable over time (think of USB enumeration order, hotplug order, ...) so they are not reproducible and shouldn't be printed.

So either
  1. we don't print the number at all anymore (works for me), or
  2. we add a command line argument like --deterministic-output
Actions #1

Updated by fixeria almost 4 years ago

So either

we don't print the number at all anymore (works for me), or
we add a command line argument like --deterministic-output

I am not against getting rid of this print, but it sounds like we're removing features just because our unit tests are not flexible enough... One problem is that we relay on lazy stderr / stdout matching, and there is always the risk that something gets printed (e.g. by Python itself) and everything gets broken. Ideally we should use generic Python's unittest framework instead. Another problem is that we use print() everywhere instead of generic Python's logging framework. If we were, we could just change the log level of this message.

P.S. This is just my opinion. I might invest my time into this some day.

Actions #2

Updated by laforge almost 4 years ago

On Sun, Apr 19, 2020 at 12:17:50PM +0000, fixeria [REDMINE] wrote:

I am not against getting rid of this print, but it sounds like we're removing features just because our unit tests are not flexible enough...

The "Feature" consists in echoing back the number which the user gave on the command line. I wouldn't
consider that an important feature at all. Either the user explicitly specified that very number,
or the default (0) is used.

So I agree we shouldn't remove real features just for our lack of test flexibility.

Actions #3

Updated by dexter almost 4 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 80

I have now removed the printing of the reader ID. See also:

https://gerrit.osmocom.org/c/pysim/+/18221 pySim-prog, pySim-read, do not echo reader id

Actions #4

Updated by dexter almost 4 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 80 to 100

The patch that removes the reader number from the log output got merged, so I set this to resolved.

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)