#!/bin/expect-dyn # BRINTOS-32 self-test (interactive half): mc full-screen UI in a pty. # GREEN: panels drawn (ncurses), hint/function-key bar, F10 quit. # RED witness: unknown TERM must fail loudly (terminfo db really consulted). set timeout 30 set pass 0 set env(TERM) xterm spawn /usr/bin/mc -b --nomouse expect { -re {Help.*Menu|MC-4|bin} { incr pass; puts "\nR1-ui-drawn ok" } timeout { puts "MC-FAIL ui-draw"; exit 1 } eof { puts "MC-FAIL mc-died"; exit 1 } } # F10 = quit; mc may ask to confirm ("Do you really want to quit") send "\033\[21~" expect { -re {(?i)(really want to quit|quit the midnight)} { send "\r"; exp_continue } eof { incr pass; puts "R1-quit ok" } timeout { # some skins map confirm differently; try 'y' send "y" expect { eof { incr pass; puts "R1-quit ok (y)" } timeout { puts "MC-FAIL quit"; exit 1 } } } } # RED witness: bogus TERM -> loud failure, NOT a working screen set env(TERM) bogus-term-brintos spawn /usr/bin/mc -b --nomouse expect { -re {(?i)(error opening terminal|unknown terminal|could not open|unable to use)} { incr pass; puts "\nRED-witness ok (bogus TERM refused)" } -re {Help.*Menu} { puts "MC-FAIL red-witness (bogus TERM accepted)"; exit 1 } timeout { puts "MC-FAIL red-witness-timeout"; exit 1 } eof { incr pass; puts "\nRED-witness ok (mc exited)" } } puts "pass=$pass/3 ALL-MC-UI-OK"