Merge lp:~cr3/checkbox/floppy_test into lp:checkbox

Proposed by Marc Tardif
Status: Merged
Merged at revision: 1454
Proposed branch: lp:~cr3/checkbox/floppy_test
Merge into: lp:checkbox
Diff against target: 99 lines (+19/-18)
2 files modified
debian/changelog (+2/-1)
scripts/floppy_test (+17/-17)
To merge this branch: bzr merge lp:~cr3/checkbox/floppy_test
Reviewer Review Type Date Requested Status
Daniel Manrique (community) Approve
Review via email: mp+111475@code.launchpad.net

Description of the change

The changes in this merge request were not tested because nobody can find a freaking floppy drive and the only floppies we can find are under bladernr's washing machine.

To post a comment you must log in.
Revision history for this message
Daniel Manrique (roadmr) wrote :

The code looks fine, it at least doesn't crash, and since we were unable to test this further I guess I'll merge it. Thanks!

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 2012-06-21 16:03:50 +0000
3+++ debian/changelog 2012-06-21 18:47:18 +0000
4@@ -27,8 +27,9 @@
5 * [FEATURE] Added new interactive and auto-verifying touchpad scrolling
6 test.
7 * [FEATURE] Python 2 to 3 conversion:
8+ * scripts/ansi_parser
9 * scripts/cking_suite
10- * scripts/ansi_parser
11+ * scripts/floppy_test
12 * scripts/network_bandwidth_test
13 * Removed sleep_test script no longer used by any test definition.
14
15
16=== modified file 'scripts/floppy_test'
17--- scripts/floppy_test 2012-05-22 18:01:21 +0000
18+++ scripts/floppy_test 2012-06-21 18:47:18 +0000
19@@ -1,9 +1,9 @@
20-#!/usr/bin/python
21+#!/usr/bin/env python3
22
23 import os
24 import sys
25 import filecmp
26-import commands
27+import subprocess
28 import posixpath
29
30 DEFAULT_DIR = "/tmp/checkbox.floppy"
31@@ -28,9 +28,9 @@
32 def run(self):
33 floppyDevice = self.device
34 if floppyDevice:
35- print " Testing on floppy drive %s " % floppyDevice
36+ print(" Testing on floppy drive %s " % floppyDevice)
37 else:
38- print " Error ! No floppy drive found !"
39+ print(" Error ! No floppy drive found !")
40 return 1
41 # remove temp files if they exist
42 os.system("umount /media/floppy 2>/dev/null")
43@@ -51,45 +51,45 @@
44 os.system("umount %s" % self.image_dir)
45 # start testing
46 (noFloppyDisk, junkOutput1) = \
47- commands.getstatusoutput("dd bs=1c if=%s count=0 2>/dev/null"
48+ subprocess.getstatusoutput("dd bs=1c if=%s count=0 2>/dev/null"
49 % floppyDevice)
50 if noFloppyDisk != 0:
51- print "Error ! No floppy disc or bad media in %s !" % floppyDevice
52+ print("Error ! No floppy disc or bad media in %s !" % floppyDevice)
53 return 1
54 else:
55 # writing files
56- print " Writing data to floppy disc ... "
57+ print(" Writing data to floppy disc ... ")
58 (ddStatus, ddOutput) = \
59- commands.getstatusoutput("dd if=%s of=%s bs=1k count=1440"
60+ subprocess.getstatusoutput("dd if=%s of=%s bs=1k count=1440"
61 % (self.image, floppyDevice))
62 if ddStatus == 0:
63- print " Write data to floppy disc done ! "
64+ print(" Write data to floppy disc done ! ")
65 else:
66- print " Error ! Write data to floppy disc error ! "
67- print " Please check if your floppy disc is write-protected !"
68+ print(" Error ! Write data to floppy disc error ! ")
69+ print(" Please check if your floppy disc is write-protected !")
70 return 1
71 # comparing files
72 os.system("mount %s %s" % (floppyDevice, self.device_dir))
73 os.system("mount -o loop %s %s" % (self.image, self.image_dir))
74- print " Comparing files ... "
75+ print(" Comparing files ... ")
76 fileList = os.listdir(self.image_dir)
77 returnValue = 0
78 for textFile in fileList:
79 file1 = os.path.join(self.device_dir, textFile)
80 file2 = os.path.join(self.image_dir, textFile)
81 if filecmp.cmp(file1, file2):
82- print " comparing file %s" % textFile
83+ print(" comparing file %s" % textFile)
84 else:
85- print (" -- Error ! File %s comparison failed ! -- "
86- % textFile)
87+ print(" -- Error ! File %s comparison failed ! -- "
88+ % textFile)
89 returnValue = 1
90- print " File comparison done ! "
91+ print(" File comparison done ! ")
92 # remove temp files
93 os.system("umount /media/floppy 2>/dev/null")
94 os.system("umount %s %s " % (self.image_dir, self.device_dir))
95 os.system("rm -rf %s %s %s"
96 % (self.device_dir, self.image_dir, self.image))
97- print "Done !"
98+ print("Done !")
99 return returnValue
100
101

Subscribers

People subscribed via source and target branches