Changeset 2998


Ignore:
Timestamp:
Jun 2, 2012, 12:02:39 PM (3 years ago)
Author:
quozl
Message:

OLPC - test menu, automatic tests; maintain an overall failure state and report it at the end, handle any escape request from the hold message, make the quit item the default afterwards, and provide the timed menu again. #11847.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpu/x86/pc/olpc/via/mfgtest.fth

    r2920 r2998  
    3232
    33330 value pass?
     340 value overall-fail?
     350 value stop?
    3436
    3537: mfg-wait-return  ( -- )
     
    5355         ??cr ." Selftest failed. Return code = " .d cr
    5456         mfg-color-red sq-border!
    55          false to pass?
     57         false to pass?  true to overall-fail?
    5658         red-screen
    5759         flush-keyboard
     
    6365         mfg-color-green sq-border!
    6466         true to pass?
    65          d# 2000 hold-message drop
     67         d# 2000 hold-message  if  true to stop?  then
    6668      then
    6769   else
    6870      ??cr ." Selftest failed due to abort"  cr
    6971      mfg-color-red sq-border!
    70       false to pass?
     72      false to pass?  true to overall-fail?
    7173      red-screen
    7274      flush-keyboard
     
    9698;
    9799
    98 : all-tests-passed  ( -- )
     100: overall  ( -- )
    99101   restore-scroller-bg
    100102   clear-screen
    101    ." All automatic tests passed successfully." cr cr cr
    102    green-screen
     103   overall-fail?  if
     104      ." Some tests failed." cr cr cr
     105      red-screen
     106   else
     107      ." All automatic tests passed successfully." cr cr cr
     108      green-screen
     109   then
    103110   wait-return
    104111   cursor-off  scroller-off  gui-alerts  refresh
     
    141148
    142149: play-item     ( -- )   \ Interactive autorun of all tests
     150   false to overall-fail?
     151   false to stop?
    143152   #mfgcols #mfgtests +  #mfgcols  ?do
    144153      i set-current-sq
     
    148157      loop
    149158      run-menu-item
    150       pass? 0= if unloop exit  then
     159      stop?  if unloop exit  then
    151160   loop
    152    all-tests-passed
    153 ;
    154 
    155 : quit-item     ( -- )  menu-done  ;
     161   0 3 rc>sq set-current-sq \ quit-item
     162   overall
     163;
     164
     165false value quit?
     166: quit-item     ( -- )  true to quit?  menu-done  ;
    156167
    157168: init-menu  ( -- )
     
    197208;
    198209
    199 : autorun-from-gamekey  ( -- )
    200    default-selection set-current-sq refresh
     210: pause-to-interact
     211   refresh
    201212   (cr kill-line
    202213   0  d# 30  do
     
    206217         drop                          ( )
    207218         menu-interact                 ( )
     219         true to quit?
    208220         unloop exit                   ( -- )
    209221      then                             ( )
    210222      d# 100 ms                        ( )
    211223   -1 +loop
     224;
     225
     226: autorun-from-gamekey  ( -- )
     227   false to quit?
     228   default-selection set-current-sq
     229   pause-to-interact
     230   quit?  if  exit  then
    212231   play-item
    213 ;
     232   stop?  if  menu-interact exit  then
     233   quit?  if  exit  then
     234   0 3 rc>sq set-current-sq \ quit-item
     235   pause-to-interact
     236;
     237
    214238: gamekey-auto-menu  ( -- )
    215239   ['] run-menu behavior >r
Note: See TracChangeset for help on using the changeset viewer.