Merge lp:~bladernr/checkbox/1153894-clarify-mediacard-instructions into lp:checkbox

Proposed by Jeff Lane 
Status: Merged
Approved by: Zygmunt Krynicki
Approved revision: 2105
Merged at revision: 2115
Proposed branch: lp:~bladernr/checkbox/1153894-clarify-mediacard-instructions
Merge into: lp:checkbox
Diff against target: 152 lines (+46/-20)
3 files modified
debian/changelog (+5/-0)
jobs/mediacard.txt.in (+13/-9)
scripts/removable_storage_test (+28/-11)
To merge this branch: bzr merge lp:~bladernr/checkbox/1153894-clarify-mediacard-instructions
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Jeff Lane  Needs Resubmitting
Review via email: mp+162259@code.launchpad.net

Description of the change

Clarifies the SD/SDHC mediacard instructions to specify UNLOCKED cards. At least one user apparently tried running storage tests against a locked SD card causing an obvious failure.

To post a comment you must log in.
Revision history for this message
Jeff Lane  (bladernr) wrote :

On further contemplation, I also took the liberty of adding better error handling to trap the OSError that is thrown when users try this test on locked SD cards and provide better output than a traceback. I also added some error handling to take care of the math that throws a ZeroDivisionError when we're unable to write data to the devices.

New output on a failed device looks like this:
bladernr@klaatu:~/development/git-workspace/checkbox$ ./scripts/removable_storage_test --memorycard sdio
Found the following mounted sdio partitions:
    /dev/mmcblk0p1 : /media/bladernr/5747-AD2E : None bits/s
--------------------
/dev/mmcblk0p1 (Total Data Size / iteration: 1.0005 MB):
ERROR:root:Unable to open /media/bladernr/5747-AD2E/tmp3_qmnf.0 for writing.
ERROR:root: [Errno 30] Read-only file system: '/media/bladernr/5747-AD2E/tmp3_qmnf.0'
ERROR:root:Failed to copy /tmp/tmp3_qmnf to /media/bladernr/5747-AD2E/tmp3_qmnf.0
ERROR:root:Unable to remove tempfile /media/bladernr/5747-AD2E/tmp3_qmnf.0
ERROR:root: [Errno 30] Read-only file system: '/media/bladernr/5747-AD2E/tmp3_qmnf.0'
 [Iteration 0] Average Speed: 0.0000
 Summary:
  Total Data Written: 1.0005 MB
  Total Time to write: 0.0000 secs
  Average Write Time: 0.0000 secs
  Average Write Speed: 0.0000 MB/s
WARNING:root:Completed 1 test iterations, but there were errors

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

   Total Data Written: 1.0005 MB

So we managed to write one megabyte to a read-only filesystem? neat!

107 outfile.write(self.data)

You probably want to see how much data was actually written and count that instead

review: Needs Fixing
2099. By Jeff Lane 

"[r=zkrynicki][bug=1103647][author=bladernr] automatic merge by tarmac"

2100. By Brendan Donegan

"[r=zkrynicki][bug=1093718][author=brendan-donegan] automatic merge by tarmac"

2101. By Jeff Lane 

"[r=brendan-donegan][bug=1100594][author=bladernr] automatic merge by tarmac"

2102. By Jeff Lane 

"[r=zkrynicki][bug=1128017][author=bladernr] automatic merge by tarmac"

2103. By Jeff Lane 

"[r=zkrynicki][bug=1116681][author=bladernr] automatic merge by tarmac"

Revision history for this message
Jeff Lane  (bladernr) wrote :

this stupid commit message stuff in git is confusing... I apparently squashed the wrong thing but the messages DO reflect the changes done.

Anyway, fixed the output, had to redo the whole branch because I messed it all up trying to rebase on the latest trunk which caused git to delete all my changes :( I finally just gave up and redid it from scratch.

review: Needs Resubmitting
Revision history for this message
Jeff Lane  (bladernr) wrote :

Made some changes based on Zygmunt's comments in IRC

2104. By Jeff Lane 

scripts: removable_storage_test: Resolved Tracebacks

removable_storage_test no longer tracebacks on locked SD/SDHC cards and
provides better output on OSError. Also handles ZeroDivisionErrors that
could occur in the summary when no data is written during testing.

2105. By Jeff Lane 

jobs: mediacard.txt.in: SD/SDHC test instructions now specify UNLOCKED media cards

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-05-06 19:19:21 +0000
3+++ debian/changelog 2013-05-06 21:48:25 +0000
4@@ -15,6 +15,11 @@
5 using and set video type and plugin accordingly. (LP: #1100594)
6 * scripts/network_check: added ability to specify custom target URL for
7 debugging failures (LP: #1128017)
8+ * scripts/removable_storage_test: Added error handling to trap OSError on
9+ non-writable media and modified output to handle subsequent
10+ ZeroDivisionError issues when summarizing test results.
11+ jobs/media.txt.in: Modified instructions for SD/SDHC to specify using
12+ UNLOCKED cards to avoid issues when testing read-only media (LP: #1153894)
13
14 [ Sylvain Pineau ]
15 * jobs/suspend.txt.in, scripts/gpu_test: Remove the need of running the script
16
17=== modified file 'jobs/mediacard.txt.in'
18--- jobs/mediacard.txt.in 2013-05-01 16:25:38 +0000
19+++ jobs/mediacard.txt.in 2013-05-06 21:48:25 +0000
20@@ -85,9 +85,9 @@
21 _description:
22 PURPOSE:
23 This test will check that the systems media card reader can
24- detect the insertion of a Secure Digital (SD) media card
25+ detect the insertion of an UNLOCKED Secure Digital (SD) media card
26 STEPS:
27- 1. Click "Test" and insert an SD card into the reader.
28+ 1. Click "Test" and insert an UNLOCKED SD card into the reader.
29 If a file browser opens up, you can safely close it.
30 (Note: this test will time-out after 20 seconds.)
31 2. Do not remove the device after this test.
32@@ -126,9 +126,10 @@
33 _description:
34 PURPOSE:
35 This test will check that the systems media card reader can
36- detect the insertion of an SD card after the system has been suspended
37+ detect the insertion of an UNLOCKED SD card after the system
38+ has been suspended
39 STEPS:
40- 1. Click "Test" and insert an SD card into the reader.
41+ 1. Click "Test" and insert an UNLOCKED SD card into the reader.
42 If a file browser opens up, you can safely close it.
43 (Note: this test will time-out after 20 seconds.)
44 2. Do not remove the device after this test.
45@@ -152,7 +153,8 @@
46 _description:
47 PURPOSE:
48 This test will check that the system correctly detects
49- the removal of an SD card from the systems card reader after the system has been suspended.
50+ the removal of an SD card from the systems card reader
51+ after the system has been suspended.
52 STEPS:
53 1. Click "Test" and remove the SD card from the reader.
54 (Note: this test will time-out after 20 seconds.)
55@@ -176,9 +178,10 @@
56 _description:
57 PURPOSE:
58 This test will check that the systems media card reader can
59- detect the insertion of a Secure Digital High-Capacity (SDHC) media card
60+ detect the insertion of a UNLOCKED Secure Digital High-Capacity
61+ (SDHC) media card
62 STEPS:
63- 1. Click "Test" and insert an SDHC card into the reader.
64+ 1. Click "Test" and insert an UNLOCKED SDHC card into the reader.
65 If a file browser opens up, you can safely close it.
66 (Note: this test will time-out after 20 seconds.)
67 2. Do not remove the device after this test.
68@@ -217,9 +220,10 @@
69 _description:
70 PURPOSE:
71 This test will check that the systems media card reader can
72- detect the insertion of an SDHC media card after the system has been suspended
73+ detect the insertion of an UNLOCKED SDHC media card after the
74+ system has been suspended
75 STEPS:
76- 1. Click "Test" and insert an SDHC card into the reader.
77+ 1. Click "Test" and insert an UNLOCKED SDHC card into the reader.
78 If a file browser opens up, you can safely close it.
79 (Note: this test will time-out after 20 seconds.)
80 2. Do not remove the device after this test.
81
82=== modified file 'scripts/removable_storage_test'
83--- scripts/removable_storage_test 2012-10-09 11:34:04 +0000
84+++ scripts/removable_storage_test 2013-05-06 21:48:25 +0000
85@@ -115,7 +115,13 @@
86 return True
87
88 def write_file(self, data, dest):
89- with open(dest, 'wb', 0) as outfile:
90+ try:
91+ outfile = open(dest, 'wb', 0)
92+ except OSError as exc:
93+ logging.error("Unable to open %s for writing.", dest)
94+ logging.error(" %s", exc)
95+ return False
96+ with outfile:
97 try:
98 outfile.write(self.data)
99 except IOError as exc:
100@@ -130,7 +136,8 @@
101 try:
102 os.unlink(target)
103 except OSError as exc:
104- logging.error("Unable to remove tempfile %s: %s", target, exc)
105+ logging.error("Unable to remove tempfile %s", target)
106+ logging.error(" %s", exc)
107
108 def _probe_disks(self):
109 """
110@@ -519,23 +526,33 @@
111 test.clean_up(file)
112 total_write_time = sum(write_times)
113 avg_write_time = total_write_time / args.count
114- avg_write_speed = ((
115- total_write_size / total_write_time)
116- / 1024 / 1024)
117- iteration_write_times.append(total_write_time)
118- print("\t[Iteration %s] Average Speed: %0.4f"
119- % (iteration, avg_write_speed))
120+ try:
121+ avg_write_speed = ((
122+ total_write_size / total_write_time)
123+ / 1024 / 1024)
124+ except ZeroDivisionError:
125+ avg_write_speed = 0.00
126+ finally:
127+ iteration_write_times.append(total_write_time)
128+ print("\t[Iteration %s] Average Speed: %0.4f"
129+ % (iteration, avg_write_speed))
130 for iteration in range(args.iterations):
131 iteration_write_time = sum(iteration_write_times)
132 print("\tSummary:")
133- print("\t\tTotal Data Written: %0.4f MB"
134+ print("\t\tTotal Data Attempted: %0.4f MB"
135 % iteration_write_size)
136 print("\t\tTotal Time to write: %0.4f secs"
137 % iteration_write_time)
138 print("\t\tAverage Write Time: %0.4f secs" %
139 (iteration_write_time / args.iterations))
140- print("\t\tAverage Write Speed: %0.4f MB/s" %
141- (iteration_write_size / iteration_write_time))
142+ try:
143+ avg_write_speed = (iteration_write_size /
144+ iteration_write_time)
145+ except ZeroDivisionError:
146+ avg_write_speed = 0.00
147+ finally:
148+ print("\t\tAverage Write Speed: %0.4f MB/s" %
149+ avg_write_speed)
150 finally:
151 for key in range(args.count):
152 test.clean_up(test_files[key].tfile.name)

Subscribers

People subscribed via source and target branches