[PATCH v4 2/3] tests: Check wmediumd version

Masashi Honma masashi.honma at gmail.com
Sun Mar 12 13:51:39 PDT 2017


On 2017/03/10 21:47, Bob Copeland wrote:
> "is_old_wmediumd" -- is guaranteed to be too vague at some point.
> It would be better IMHO to specify the actual needed features from
> the test case, e.g.:
>
> # completely untested code follows
> def wmediumd_has_position_model():
>     major, minor, patch = wmediumd_get_version()
>     return major >= 0 and minor >= 3
>
> def wmediumd_get_version():
>     try:
>         verstr = subprocess.check_output(['wmediumd', '-V'])
>         if 'wmediumd v' not in verstr:
>             raise HwsimSkip('invalid response from wmediumd version')
>
>         # e.g. 'wmediumd v0.0[.0]'
>         vernum = verstr.split(' ')[1][1:]
>         revs = vernum.split('.')
>
>         # force major, minor, patchlevel
>         while len(revs) < 3:
>             revs += [0]
>         return revs[:3]
>
>     except OSError, e:
>         raise HwsimSkip('wmediumd unavailable')
>
>
>
>>  def output_wmediumd_log(p, params, data):
>>      log_file = open(os.path.abspath(os.path.join(params['logdir'],
>>                                                   'wmediumd.log')), 'a')
>> @@ -93,6 +116,7 @@ def test_wmediumd_path_simple(dev, apdev, params):
>>      # |           |
>>      # +-----X-----+
>>      # This tests if 1 and 2 can communicate each other via 0.
>> +    check_wmediumd_version()
>
>        if not wmediumd_has_position_model():
>             raise HwsimSkip('...')
>
>>      fd, fn = tempfile.mkstemp()
>>      try:
>>          f = os.fdopen(fd, 'w')

Thanks !

I will use just version number of wmediumd instead of
wmediumd_has_position_model(), because I will use error_prob model for
these tests as I mentioned on the another reply.

Masashi Honma.







More information about the Hostap mailing list