diff mbox

[v3,2/3] tests: Check wmediumd version

Message ID 1488426486-3965-2-git-send-email-masashi.honma@gmail.com
State Superseded
Headers show

Commit Message

Masashi Honma March 2, 2017, 3:48 a.m. UTC
Some wmediumd tests requires new wmediumd features. Modified SNR table,
location-based config and log levels. The wmediumd 0.2 does not have
these features, so skip such a tests.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
---
 tests/hwsim/test_wmediumd.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

Jouni Malinen March 2, 2017, 9:27 a.m. UTC | #1
On Thu, Mar 02, 2017 at 12:48:05PM +0900, Masashi Honma wrote:
> Some wmediumd tests requires new wmediumd features. Modified SNR table,
> location-based config and log levels. The wmediumd 0.2 does not have
> these features, so skip such a tests.

> diff --git a/tests/hwsim/test_wmediumd.py b/tests/hwsim/test_wmediumd.py
> +def check_wmediumd_version():
>
> +    if stdoutdata.find('wmediumd v0.2 ') > -1:
> +        LocalVariables.is_old_wmediumd = True
> +        raise HwsimSkip('wmediumd not available')
> +    else:
> +        LocalVariables.is_old_wmediumd = False

I guess that should really state that wmediumd is not new enough instead
of not being available.

Where can one get new enough wmediumd, though? The current snapshot of
https://github.com/bcopeland/wmediumd.git advertises v0.2. As such, this
patch seems to be disabling the wmediumd_path_simple test case
unconditionally with the currently available wmediumd..
Bob Copeland March 2, 2017, 3:14 p.m. UTC | #2
On Thu, Mar 02, 2017 at 11:14:36AM +0000, Masashi Honma wrote:
> > Where can one get new enough wmediumd, though? The current snapshot of
> > https://github.com/bcopeland/wmediumd.git advertises v0.2. As such, this
> > patch seems to be disabling the wmediumd_path_simple test case
> > unconditionally with the currently available wmediumd..
> >
> 
> Bob said on previous mail he will update the version number soon.

Yeah, I'll do it today, I just want to do something about the -x thing
first so I can back up my claim that same major versions will be
backwards compatible :)
Jouni Malinen March 3, 2017, 9:31 a.m. UTC | #3
On Thu, Mar 02, 2017 at 12:48:05PM +0900, Masashi Honma wrote:
> Some wmediumd tests requires new wmediumd features. Modified SNR table,
> location-based config and log levels. The wmediumd 0.2 does not have
> these features, so skip such a tests.

Now that there is 0.3 version in wmediumd.git, I started running tests
with it. For some reason, all the wmediumd test cases (i.e., the
existing ones and the one added in this series) are failing about half
of the time due to connectivity check failing. Any idea why that
happens? Is there now some packet loss being enabled by default that
causes this? Is that on purpose?

I cannot really move to this setup since the hwsim test cases are
supposed to pass every time they are run. In other words, either the
test cases need to be modified if wmediumd is dropping packets or
wmediumd need to be modified. I'm not sure what exactly changed here, so
I'm just going back to my old wmediumd snapshot from a year ago for
now and won't be applying these patches until the current issues are
resolved.
Masashi Honma March 3, 2017, 9:11 p.m. UTC | #4
On 2017/03/03 18:31, Jouni Malinen wrote:
> Now that there is 0.3 version in wmediumd.git, I started running tests
> with it. For some reason, all the wmediumd test cases (i.e., the
> existing ones and the one added in this series) are failing about half
> of the time due to connectivity check failing. Any idea why that
> happens? Is there now some packet loss being enabled by default that
> causes this? Is that on purpose?

If the message "get_error_prob_from_per_matrix: invalid rate_idx=xxx"
is included in wmediumd.log, it is known bug and patch was already sent.
https://github.com/bcopeland/wmediumd/pull/7/files
Bob, could you merge this ?

> I cannot really move to this setup since the hwsim test cases are
> supposed to pass every time they are run. In other words, either the
> test cases need to be modified if wmediumd is dropping packets or
> wmediumd need to be modified. I'm not sure what exactly changed here, so
> I'm just going back to my old wmediumd snapshot from a year ago for
> now and won't be applying these patches until the current issues are
> resolved.

With wmediumd, frame transmission could fail because the result of tx is
defined with rand(). I understand hwsim test case should be passed every
time. I will rewrite the test.

Masashi Honma.
Masashi Honma March 9, 2017, 11:08 p.m. UTC | #5
On 2017/03/03 18:31, Jouni Malinen wrote:
> Now that there is 0.3 version in wmediumd.git, I started running tests
> with it. For some reason, all the wmediumd test cases (i.e., the
> existing ones and the one added in this series) are failing about half
> of the time due to connectivity check failing. Any idea why that
> happens? Is there now some packet loss being enabled by default that
> causes this? Is that on purpose?
>
> I cannot really move to this setup since the hwsim test cases are
> supposed to pass every time they are run. In other words, either the
> test cases need to be modified if wmediumd is dropping packets or
> wmediumd need to be modified. I'm not sure what exactly changed here, so
> I'm just going back to my old wmediumd snapshot from a year ago for
> now and won't be applying these patches until the current issues are
> resolved.

I am sorry for wasting your time.
I have found a root cause (buffer over run) in wmediumd and fixed it.
After that, I tried to run wmediumd_path_simple test 100 times and it
passed all the tests.

Bob, could you merge this pull request ?
# I have closed old #7 pull request.
https://github.com/bcopeland/wmediumd/pull/9

And I fixed a PER table bug in wmediumd also. So I will send v4 of this
series of patches which fixes node positions based on the new PER table.

Masashi Honma.
Bob Copeland March 10, 2017, 12:18 p.m. UTC | #6
On Fri, Mar 10, 2017 at 08:08:13AM +0900, Masashi Honma wrote:
> On 2017/03/03 18:31, Jouni Malinen wrote:
> I am sorry for wasting your time.
> I have found a root cause (buffer over run) in wmediumd and fixed it.
> After that, I tried to run wmediumd_path_simple test 100 times and it
> passed all the tests.
> 
> Bob, could you merge this pull request ?
> # I have closed old #7 pull request.
> https://github.com/bcopeland/wmediumd/pull/9
> 
> And I fixed a PER table bug in wmediumd also. So I will send v4 of this
> series of patches which fixes node positions based on the new PER table.

I'll pick these up, but I'm going back to using analytical model by
default -- this is why I haven't yet merged the other PR you sent.  Having
plotted the PER table it doesn't look very good around the transition
areas (too few points), so I'd prefer to just use functions here.
Masashi Honma March 12, 2017, 8:40 p.m. UTC | #7
On 2017/03/10 21:18, Bob Copeland wrote:
> I'll pick these up, but I'm going back to using analytical model by
> default -- this is why I haven't yet merged the other PR you sent.  Having
> plotted the PER table it doesn't look very good around the transition
> areas (too few points), so I'd prefer to just use functions here.
>

I see. After you went back to use function instead of PER table, the
hostap/tests needs to be modified to suite to new RSSI level. So I will
modify the tests to use error_prob config to be independent of RSSI
level.

Masashi Honma.
diff mbox

Patch

diff --git a/tests/hwsim/test_wmediumd.py b/tests/hwsim/test_wmediumd.py
index 9da54d3..a3e475b 100644
--- a/tests/hwsim/test_wmediumd.py
+++ b/tests/hwsim/test_wmediumd.py
@@ -11,6 +11,9 @@  from test_wpas_mesh import check_mesh_support, check_mesh_group_added
 from test_wpas_mesh import check_mesh_peer_connected, add_open_mesh_network
 from test_wpas_mesh import check_mesh_group_removed
 
+class LocalVariables:
+    is_old_wmediumd = None
+
 CFG = """
 ifaces :
 {
@@ -34,6 +37,26 @@  ifaces :
 };
 """
 
+def check_wmediumd_version():
+    if LocalVariables.is_old_wmediumd != None:
+        if LocalVariables.is_old_wmediumd:
+            raise HwsimSkip('wmediumd not available')
+        return
+
+    try:
+        stdoutdata = subprocess.check_output(['wmediumd', '-V'])
+    except OSError, e:
+        if e.errno == errno.ENOENT:
+            LocalVariables.is_old_wmediumd = True
+            raise HwsimSkip('wmediumd not available')
+        raise
+
+    if stdoutdata.find('wmediumd v0.2 ') > -1:
+        LocalVariables.is_old_wmediumd = True
+        raise HwsimSkip('wmediumd not available')
+    else:
+        LocalVariables.is_old_wmediumd = False
+
 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()
     fd, fn = tempfile.mkstemp()
     try:
         f = os.fdopen(fd, 'w')