network_reconnect_resume_test returns weird results on a system that's been running for > 24 hours

Bug #1038270 reported by Jeff Lane 
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Checkbox
Fix Released
Medium
Unassigned

Bug Description

tested this script on my primary machine which had been up for > 24 hours. I got surprising results:

bladernr@klaatu:~/development/bender/sfeole-wifi-test$
./scripts/wifi_reconnect_resume_test -t 20
Your Wifi Resumed in -89511.28 seconds after the last suspend
PASS: the network connected within the allotted time specified

I this machine has a few wifi reconnects in dmesg and it's doing the check for wifi_resume__time >= resume_time and immediately returning results for the first match. On my system, after multiple starts and stops of wifi, that causes it to return the very first instance, which is indeed 89511 seconds BEFORE the current time.

Here's an output after I added some instrumentation:
bladernr@klaatu:~/development/bender/sfeole-wifi-test$
./scripts/wifi_reconnect_resume_test -t 20
RESUME TIME: 109865.699154
RECONNECT TIMES: [' 31.658051', '20354.420357', '96320.460391',
'109880.553268']
Checking reconnect time 31.658051
Checking reconnect time 20354.420357
wifi_reconnect_time is >= resume_time
Your Wifi Resumed in -89511.28 seconds after the last suspend
PASS: the network connected within the allotted time specified

as you can see with the contents of wifi_reconnect_times, my wireless was restarted 3 times (the first being the initial association after boot).

It appears that Python things that 20354.420357 is a larger number than 109865.699154

Looking further, it is because this is due to how the numbers are derived. The times are timestamps pulled from dmesg, and they are presented as text rather than floats. this is confirmed by replicating the behaviour in a python shell:

In [1]: time1 = 109865.699154
In [2]: time2 = 20354.420357
In [3]: time2 >= time1
Out[3]: False
In [4]: time1 >= time2
Out[4]: True
In [5]: time1 = '109865.699154'
In [6]: time2 = '20354.420357'
In [7]: time1 >= time2
Out[7]: False
In [8]: time2 >= time1
Out[8]: True

When the numbers are set as strings, time2 is indeed greater than or equal to time1. not so when they are assigned as floats.

Related branches

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

No such script exists in Checkbox, unless I've gone blind/crazy

Changed in checkbox:
status: New → Incomplete
Jeff Lane  (bladernr)
summary: - wifi_reconnect_resume_test returns weird results on a system that's been
- running for > 24 hours
+ network_reconnect_resume_test returns weird results on a system that's
+ been running for > 24 hours
Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

This appears to be fixed, so setting to Fix Released

Changed in checkbox:
status: Incomplete → Fix Released
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.