Cmdline tests

The cmdline testsuite is located in test/cmdline.  The testsuite allows more flexibility by coding scripts in python allowing any executable to run, sending commands to stdin, and asserting output using regular expressions. See test/cmdline/README document for more information.   Two use cases for the cmdline testsuite:

Use case 1: test the interactive cmdline debugger
Test contents: start avmshell -d, set breakpoint on a line, show local variable value, quit

from cmdutils import *

def run():
      'debugger locals',
      '%s -d testdata/'%r.avmrd,
      input='break 53\ncontinue\nnext\ninfo locals\nnext\ninfo locals\nquit\n',
      expectedout=['local1 = undefined','local2 = 10','local2 = 15']

Use case 2: test -memstats returns memory logs to stdout
Test contents: start avmshell -memstats, assert stdout contains 'gross stats', 'sweep m reclaimed n pages.'

from cmdutils import *

def run():
               command="%s -memstats testdata/" % r.avm,
                            'gross stats',
                            'managed fragmentation',
                            'gross stats end',
                            'sweep\\([0-9]+\\) reclaimed [0-9]+ whole pages'