Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[testudo] verify the SD car image version during stage2 testing

Signed-off-by: Christopher Hall <hsw@openmoko.com>
  • Loading branch information...
commit 4db4f8ee09a078dddd5bcc4ff82d879139bc45a8 1 parent 83ac3e4
@hxw hxw authored
View
2  samo-lib/forth/programs/stage2.4th
@@ -3,6 +3,8 @@
\ signal to testudo
cr .( *START-TEST*) cr
+include version.4th
+test-version-main
include key-test.4th
test-keys-main
include lcd-test.4th
View
66 samo-lib/forth/programs/version.4th
@@ -0,0 +1,66 @@
+\ display SD Card version
+
+: test-version-sequence ( -- )
+ s" version.txt" r/o open-file ?dup
+ if
+ ." open error = " dec. drop
+ cr
+ false exit
+ then
+
+ >r \ save fileid
+
+ begin
+ here 256 r@ read-line ?dup \ u2 f ior ior?
+ if
+ ." read error = " dec. 2drop
+ r> close-file drop
+ cr
+ false exit
+ then
+ while \ u2
+ here swap \ c-addr u
+ 2dup type cr
+ s" VERSION:" \ c-addr u c-addr' u'
+ 2over \ c-addr u c-addr' u' c-addr u
+ >r over \ c-addr u c-addr' u' c-addr u' R: u
+ dup r> > if
+ 2drop 2drop 2drop
+ else
+ compare 0= if
+ 0 2 lcd-at-xy
+ lcd-type
+ else
+ 2drop
+ then
+ then
+ repeat
+ drop
+ r> close-file drop
+
+ button-flush
+ ctp-flush
+ key-flush
+
+ ." *VERSION*" cr
+ key \ external process will send Y or N
+
+ [char] Y = \ return true if Y received
+;
+
+: test-version-main ( -- )
+ lcd-cls
+ s" SD Card Version Test" lcd-type
+
+ test-version-sequence if
+ s" PASS"
+ else
+ s" FAIL"
+ then
+ lcd-text-columns 2/ lcd-text-rows 2/ lcd-at-xy
+ 2dup lcd-type
+ 500000 delay-us
+ type ." : version test" cr
+;
+
+
View
57 testudo/src/ui2.py
@@ -193,6 +193,7 @@ def runTest(self):
if '' == self.serialNumber.get_text():
raise StopTestException('Serial number invalid')
serialNumber = self.serialNumber.get_text()
+ versionNumber = self.versionNumber.get_text()
program = ProgramPin()
@@ -209,6 +210,7 @@ def runTest(self):
starting = True
run = True
+ current_version = 'NONE'
while run:
line = ''
@@ -247,6 +249,8 @@ def runTest(self):
else:
self.write('FAIL: FLASH S/N(%s) != %s\n' % (psn, serialNumber), 'fail-text')
raise StopTestException('Serial Number mismatch')
+ elif line.startswith('VERION:'):
+ current_version = line.split(' ')[-1]
if '. Boot Test Program' == line[1:]:
s.write(line[0:1])
@@ -267,6 +271,12 @@ def runTest(self):
else:
s.write('Y')
+ elif '*VERSION*' == line:
+ if current_version == versionNumber:
+ s.write('Y')
+ else:
+ s.write('N')
+
else:
i = psu.current
self.write('INFO: current = %7.3f mA @ %5.1f V\n' % (1000 * i, psu.voltage))
@@ -507,22 +517,51 @@ def __init__(self):
vbox1.pack_end(button_box, expand = False, fill = False, padding = 0)
- hbox = gtk.HBox(homogeneous = False, spacing = 5)
+ table1 = gtk.Table(rows = 2, columns = 3, homogeneous = False)
+ table1.set_col_spacings(3)
+ table1.set_row_spacings(2)
self.autoSave = gtk.CheckButton("Auto-save")
self.autoSave.set_active(True)
- hbox.pack_start(self.autoSave, expand = False, fill = True, padding = 0)
-
- label = gtk.Label('Serial Number')
- hbox.pack_start(label, expand = True, fill = True, padding = 0)
+ self.autoSave.show()
+ table1.attach(self.autoSave, 0, 1, 0, 1,
+ xoptions = gtk.EXPAND | gtk.FILL, yoptions = 0,
+ xpadding = 0, ypadding = 1)
+
+ label = gtk.Label('Serial Number:')
+ label.set_alignment(xalign = 1.0, yalign = 0.5)
+ label.show()
+ table1.attach(label, 1, 2, 0, 1,
+ xoptions = gtk.FILL, yoptions = 0,
+ xpadding = 0, ypadding = 1)
self.serialNumber = gtk.Entry()
self.serialNumber.set_max_length(32)
- hbox.pack_start(self.serialNumber, expand = True, fill = True, padding = 0)
-
- hbox.show_all()
+ self.serialNumber.set_width_chars(32)
+ self.serialNumber.show()
+ table1.attach(self.serialNumber, 2, 3, 0, 1,
+ xoptions = gtk.EXPAND | gtk.FILL, yoptions = 0,
+ xpadding = 0, ypadding = 1)
+
+ label = gtk.Label('SD Card Version:')
+ label.set_alignment(xalign = 1.0, yalign = 0.5)
+ label.set_justify(gtk.JUSTIFY_RIGHT)
+ label.show()
+ table1.attach(label, 1, 2, 1, 2,
+ xoptions = gtk.FILL, yoptions = 0,
+ xpadding = 0, ypadding = 1)
+
+ self.versionNumber = gtk.Entry()
+ self.versionNumber.set_max_length(32)
+ self.versionNumber.set_width_chars(32)
+ self.versionNumber.show()
+ table1.attach(self.versionNumber, 2, 3, 1, 2,
+ xoptions = gtk.EXPAND | gtk.FILL, yoptions = 0,
+ xpadding = 0, ypadding = 1)
+
+ table1.show()
+ vbox1.pack_start(table1, expand = False, fill = False, padding = 0)
- vbox1.pack_start(hbox, expand = False, fill = False, padding = 0)
self.status = gtk.Label('')
self.status.set_alignment(0, 0)
Please sign in to comment.
Something went wrong with that request. Please try again.