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 test.abc, set breakpoint on a line, show local variable value, quit
from cmdutils import *
def run():
r=RunTestLib()
r.run_test(
'debugger locals',
'%s -d testdata/debug.abc'%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 test.abc, assert stdout contains 'gross stats', 'sweep m reclaimed n pages.'
from cmdutils import *
def run():
r=RunTestLib()
r.run_test(name='memstats',
command="%s -memstats testdata/memstats.abc" % r.avm,
expectedout=[
'gross stats',
'managed fragmentation',
'gross stats end',
'sweep\\([0-9]+\\) reclaimed [0-9]+ whole pages'
]
