PiDP-8/I Software

Hex Artifact Content
Log In

Artifact 1975c96ae9eb1e43fc7f7c0211531c0b3ba1d98c:


0000: 23 20 6f 73 38 2d 70 72 6f 67 74 65 73 74 3a 20  # os8-progtest: 
0010: 50 65 72 66 6f 72 6d 20 54 65 73 74 73 20 6f 6e  Perform Tests on
0020: 20 61 20 50 72 6f 67 72 61 6d 20 55 6e 64 65 72   a Program Under
0030: 20 4f 53 2f 38 0a 0a 54 68 69 73 20 70 72 6f 67   OS/8..This prog
0040: 72 61 6d 20 75 73 65 73 20 50 79 74 68 6f 6e 20  ram uses Python 
0050: 65 78 70 65 63 74 20 74 6f 20 77 6f 72 6b 20 74  expect to work t
0060: 68 72 6f 75 67 68 20 74 65 73 74 73 20 6f 66 20  hrough tests of 
0070: 61 20 70 72 6f 67 72 61 6d 0a 75 6e 64 65 72 20  a program.under 
0080: 4f 53 2f 38 2e 20 20 54 68 65 20 74 65 73 74 20  OS/8.  The test 
0090: 63 61 73 65 73 20 61 6e 64 20 65 78 70 65 63 74  cases and expect
00a0: 65 64 20 6f 75 74 70 75 74 20 61 72 65 20 65 78  ed output are ex
00b0: 70 72 65 73 73 65 64 20 69 6e 20 59 41 4d 4c 20  pressed in YAML 
00c0: 66 6f 72 6d 61 74 0a 75 74 69 6c 69 7a 69 6e 67  format.utilizing
00d0: 20 74 68 65 20 5b 70 79 79 61 6d 6c 20 6c 69 62   the [pyyaml lib
00e0: 72 61 72 79 5d 5b 70 79 79 61 6d 6c 5d 2e 0a 0a  rary][pyyaml]...
00f0: 49 74 20 69 73 20 66 6f 75 6e 64 20 69 6e 20 74  It is found in t
0100: 68 65 20 60 74 6f 6f 6c 73 60 20 64 69 72 65 63  he `tools` direc
0110: 74 6f 72 79 20 6f 66 20 74 68 65 20 73 6f 75 72  tory of the sour
0120: 63 65 20 74 72 65 65 2e 0a 0a 0a 23 23 20 55 73  ce tree....## Us
0130: 61 67 65 0a 0a 20 20 20 20 6f 73 38 2d 70 72 6f  age..    os8-pro
0140: 67 74 65 73 74 20 5b 6f 70 74 69 6f 6e 73 5d 20  gtest [options] 
0150: 3c 70 72 6f 67 5f 73 70 65 63 3e 0a 0a 54 68 65  <prog_spec>..The
0160: 20 60 70 72 6f 67 5f 73 70 65 63 60 20 69 73 20   `prog_spec` is 
0170: 74 68 65 20 70 72 6f 67 72 61 6d 20 74 6f 20 74  the program to t
0180: 65 73 74 20 6f 70 74 69 6f 6e 61 6c 6c 79 20 66  est optionally f
0190: 6f 6c 6c 6f 77 65 64 20 62 79 20 61 20 73 75 62  ollowed by a sub
01a0: 73 65 74 0a 6f 66 20 74 65 73 74 73 2e 20 46 6f  set.of tests. Fo
01b0: 72 20 65 78 61 6d 70 6c 65 3a 0a 0a 20 20 20 20  r example:..    
01c0: 24 20 74 6f 6f 6c 73 2f 6f 73 38 2d 70 72 6f 67  $ tools/os8-prog
01d0: 74 65 73 74 20 63 63 38 0a 0a e2 80 a6 72 75 6e  test cc8..…run
01e0: 73 20 61 6c 6c 20 43 43 38 20 74 65 73 74 73 2c  s all CC8 tests,
01f0: 20 77 68 69 6c 65 3a 0a 0a 20 20 20 20 24 20 74   while:..    $ t
0200: 6f 6f 6c 73 2f 6f 73 38 2d 70 72 6f 67 74 65 73  ools/os8-progtes
0210: 74 20 63 63 38 3a 70 73 2c 66 69 62 0a 0a e2 80  t cc8:ps,fib..
0220: a6 72 75 6e 73 20 6a 75 73 74 20 74 68 65 20 74  runs just the t
0230: 77 6f 20 43 43 38 20 74 65 73 74 73 20 6f 6e 20  wo CC8 tests on 
0240: 60 70 73 2e 63 60 20 61 6e 64 20 60 66 69 62 2e  `ps.c` and `fib.
0250: 63 60 2e 0a 0a 4d 6f 72 65 20 74 68 61 6e 20 6f  c`...More than o
0260: 6e 65 20 60 70 72 6f 67 5f 73 70 65 63 60 20 63  ne `prog_spec` c
0270: 61 6e 20 61 70 70 65 61 72 20 6f 6e 20 74 68 65  an appear on the
0280: 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 20 74 6f   command line to
0290: 20 74 65 73 74 20 6d 6f 72 65 20 74 68 61 6e 0a   test more than.
02a0: 6f 6e 65 20 70 72 6f 67 72 61 6d 20 61 74 20 61  one program at a
02b0: 20 74 69 6d 65 2e 0a 0a 42 65 63 61 75 73 65 20   time...Because 
02c0: 74 68 69 73 20 74 65 73 74 20 73 79 73 74 65 6d  this test system
02d0: 20 69 73 20 62 61 73 65 64 20 6f 6e 20 74 68 65   is based on the
02e0: 20 5b 70 65 78 70 65 63 74 5d 20 6c 69 62 72 61   [pexpect] libra
02f0: 72 79 2c 20 73 75 63 63 65 73 73 20 69 73 0a 64  ry, success is.d
0300: 65 74 65 72 6d 69 6e 65 64 20 62 79 20 73 65 65  etermined by see
0310: 69 6e 67 20 61 20 73 65 71 75 65 6e 63 65 20 6f  ing a sequence o
0320: 66 20 65 78 70 65 63 74 65 64 20 6f 75 74 70 75  f expected outpu
0330: 74 73 20 63 6f 6d 65 20 66 72 6f 6d 20 74 68 65  ts come from the
0340: 20 74 65 73 74 0a 70 72 6f 67 72 61 6d 2e 20 49   test.program. I
0350: 66 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66  f one or more of
0360: 20 74 68 65 73 65 20 66 61 69 6c 20 74 6f 20 6f   these fail to o
0370: 63 63 75 72 2c 20 74 68 65 20 74 65 73 74 20 77  ccur, the test w
0380: 69 6c 6c 20 61 70 70 65 61 72 20 74 6f 0a 68 61  ill appear to.ha
0390: 6e 67 20 75 6e 74 69 6c 20 70 65 78 70 65 63 74  ng until pexpect
03a0: 20 74 69 6d 65 73 20 6f 75 74 20 77 68 69 6c 65   times out while
03b0: 20 77 61 69 74 69 6e 67 2e 0a 0a 5b 70 65 78 70   waiting...[pexp
03c0: 65 63 74 5d 3a 20 68 74 74 70 73 3a 2f 2f 70 65  ect]: https://pe
03d0: 78 70 65 63 74 2e 72 65 61 64 74 68 65 64 6f 63  xpect.readthedoc
03e0: 73 2e 69 6f 2f 65 6e 2f 73 74 61 62 6c 65 2f 0a  s.io/en/stable/.
03f0: 0a 0a 0a 23 23 23 20 4f 70 74 69 6f 6e 73 0a 0a  ...### Options..
0400: 7c 20 41 72 67 75 6d 65 6e 74 20 20 20 20 20 20  | Argument      
0410: 20 20 20 20 20 20 20 7c 20 4d 65 61 6e 69 6e 67         | Meaning
0420: 0a 7c 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .| -------------
0430: 2d 2d 2d 2d 2d 2d 2d 20 7c 20 2d 2d 2d 2d 2d 2d  ------- | ------
0440: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0450: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0460: 2d 2d 2d 2d 2d 2d 2d 2d 0a 7c 20 60 2d 2d 68 65  --------.| `--he
0470: 6c 70 2c 20 2d 68 60 20 20 20 20 20 20 20 20 20  lp, -h`         
0480: 7c 20 73 68 6f 77 20 74 68 69 73 20 68 65 6c 70  | show this help
0490: 20 6d 65 73 73 61 67 65 20 61 6e 64 20 65 78 69   message and exi
04a0: 74 0a 7c 20 60 2d 2d 76 65 72 62 6f 73 65 60 2c  t.| `--verbose`,
04b0: 20 60 2d 76 60 20 20 20 20 7c 20 69 6e 63 72 65   `-v`    | incre
04c0: 61 73 65 20 6f 75 74 70 75 74 20 76 65 72 62 6f  ase output verbo
04d0: 73 69 74 79 0a 7c 20 60 2d 64 20 44 45 42 55 47  sity.| `-d DEBUG
04e0: 60 20 20 20 20 20 20 20 20 20 20 20 7c 20 73 65  `           | se
04f0: 74 20 64 65 62 75 67 20 6c 65 76 65 6c 3b 20 30  t debug level; 0
0500: 2d 31 34 0a 7c 20 60 2d 2d 64 65 73 74 64 69 72  -14.| `--destdir
0510: 20 44 45 53 54 44 49 52 60 20 20 7c 20 64 65 73   DESTDIR`  | des
0520: 74 69 6e 61 74 69 6f 6e 20 64 69 72 65 63 74 6f  tination directo
0530: 72 79 20 66 6f 72 20 6f 75 74 70 75 74 20 66 69  ry for output fi
0540: 6c 65 73 0a 7c 20 60 2d 2d 73 72 63 64 69 72 20  les.| `--srcdir 
0550: 53 52 43 44 49 52 60 20 20 20 20 7c 20 73 6f 75  SRCDIR`    | sou
0560: 72 63 65 20 64 69 72 65 63 74 6f 72 79 20 66 6f  rce directory fo
0570: 72 20 74 65 73 74 20 60 2e 79 6d 6c 60 20 66 69  r test `.yml` fi
0580: 6c 65 73 0a 7c 20 60 2d 2d 74 61 72 67 65 74 20  les.| `--target 
0590: 54 41 52 47 45 54 60 20 20 20 20 7c 20 74 61 72  TARGET`    | tar
05a0: 67 65 74 20 69 6d 61 67 65 20 66 69 6c 65 0a 7c  get image file.|
05b0: 20 60 2d 2d 64 72 79 2d 72 75 6e 60 2c 20 60 2d   `--dry-run`, `-
05c0: 6e 60 20 20 20 20 7c 20 64 72 79 20 72 75 6e 3a  n`    | dry run:
05d0: 20 6f 6e 6c 79 20 70 72 69 6e 74 20 77 68 61 74   only print what
05e0: 20 77 6f 75 6c 64 20 68 61 70 70 65 6e 0a 7c 20   would happen.| 
05f0: 60 2d 2d 65 78 69 74 66 69 72 73 74 60 2c 20 60  `--exitfirst`, `
0600: 2d 78 60 20 20 7c 20 65 78 69 74 20 6f 6e 20 66  -x`  | exit on f
0610: 69 72 73 74 20 66 61 69 6c 75 72 65 0a 0a 57 68  irst failure..Wh
0620: 65 6e 20 60 2d 2d 73 72 63 64 69 72 60 20 69 73  en `--srcdir` is
0630: 20 6e 6f 74 20 67 69 76 65 6e 2c 20 60 6f 73 38   not given, `os8
0640: 2d 70 72 6f 67 74 65 73 74 60 20 6c 6f 6f 6b 73  -progtest` looks
0650: 20 66 6f 72 20 59 41 4d 4c 20 66 69 6c 65 73 20   for YAML files 
0660: 69 6e 0a 60 73 63 72 69 70 74 73 2f 6f 73 38 2d  in.`scripts/os8-
0670: 70 72 6f 67 74 65 73 74 60 20 72 65 6c 61 74 69  progtest` relati
0680: 76 65 20 74 6f 20 74 68 65 20 50 69 44 50 2d 38  ve to the PiDP-8
0690: 2f 49 20 73 6f 75 72 63 65 20 74 72 65 65 20 72  /I source tree r
06a0: 6f 6f 74 2e 0a 0a 54 68 65 20 64 65 66 61 75 6c  oot...The defaul
06b0: 74 20 64 65 62 75 67 20 6c 65 76 65 6c 20 6f 66  t debug level of
06c0: 20 30 20 73 75 70 70 72 65 73 73 65 73 20 61 6c   0 suppresses al
06d0: 6c 20 64 65 62 75 67 20 6f 75 74 70 75 74 2c 20  l debug output, 
06e0: 77 68 69 6c 65 20 31 34 20 6d 61 6b 65 73 0a 69  while 14 makes.i
06f0: 74 20 71 75 69 74 65 20 6e 6f 69 73 79 2e 0a 0a  t quite noisy...
0700: 54 68 65 20 60 2d 2d 65 78 69 74 66 69 72 73 74  The `--exitfirst
0710: 60 20 6f 70 74 69 6f 6e 20 69 73 20 75 73 65 64  ` option is used
0720: 20 77 68 65 6e 20 77 65 20 77 61 6e 74 20 61 20   when we want a 
0730: 6e 6f 6e 20 7a 65 72 6f 20 73 74 61 74 75 73 20  non zero status 
0740: 65 78 69 74 20 66 72 6f 6d 0a 74 68 65 20 72 75  exit from.the ru
0750: 6e 20 6f 66 20 60 6f 73 38 2d 70 72 6f 67 74 65  n of `os8-progte
0760: 73 74 60 20 6f 6e 20 74 68 65 20 76 65 72 79 20  st` on the very 
0770: 66 69 72 73 74 20 66 61 69 6c 75 72 65 2c 20 72  first failure, r
0780: 61 74 68 65 72 20 74 68 61 6e 20 74 68 65 20 75  ather than the u
0790: 73 75 61 6c 0a 62 65 68 61 76 69 6f 72 20 6f 66  sual.behavior of
07a0: 20 61 20 73 75 63 63 65 73 73 66 75 6c 20 72 75   a successful ru
07b0: 6e 20 62 65 69 6e 67 20 70 65 72 66 6f 72 6d 61  n being performa
07c0: 6e 63 65 20 61 6c 6c 20 74 65 73 74 73 20 61 6e  nce all tests an
07d0: 64 20 72 65 70 6f 72 74 69 6e 67 0a 66 61 69 6c  d reporting.fail
07e0: 75 72 65 73 20 61 6c 6f 6e 67 20 74 68 65 20 77  ures along the w
07f0: 61 79 2e 0a 0a 23 23 20 54 68 65 20 54 65 73 74  ay...## The Test
0800: 20 44 65 66 69 6e 69 74 69 6f 6e 20 46 69 6c 65   Definition File
0810: 0a 0a 54 68 65 20 60 2e 79 6d 6c 60 20 66 69 6c  ..The `.yml` fil
0820: 65 73 20 64 65 66 69 6e 65 73 20 61 20 73 65 72  es defines a ser
0830: 69 65 73 20 6f 66 20 74 65 73 74 73 2c 20 65 61  ies of tests, ea
0840: 63 68 20 6f 6e 65 20 6f 66 20 77 68 69 63 68 20  ch one of which 
0850: 63 6f 6e 73 69 73 74 73 20 6f 66 0a 61 20 73 74  consists of.a st
0860: 61 74 65 20 6d 61 63 68 69 6e 65 2e 20 20 54 68  ate machine.  Th
0870: 65 20 73 74 61 74 65 20 6d 61 63 68 69 6e 65 20  e state machine 
0880: 63 6f 6e 73 69 73 74 73 20 6f 66 20 61 20 73 74  consists of a st
0890: 61 74 65 20 6e 61 6d 65 2c 20 74 68 65 0a 74 65  ate name, the.te
08a0: 73 74 20 74 65 78 74 20 73 74 72 69 6e 67 20 74  st text string t
08b0: 6f 20 73 65 6e 64 2c 20 61 6e 64 20 61 6e 20 61  o send, and an a
08c0: 72 72 61 79 20 6f 66 20 70 6f 73 73 69 62 6c 65  rray of possible
08d0: 20 72 65 73 70 6f 6e 73 65 73 20 61 6e 64 20 74   responses and t
08e0: 68 65 0a 73 74 61 74 65 20 74 6f 20 67 6f 20 74  he.state to go t
08f0: 6f 20 69 66 20 74 68 65 20 72 65 73 70 6f 6e 73  o if the respons
0900: 65 20 69 73 20 72 65 63 65 69 76 65 64 2e 0a 0a  e is received...
0910: 49 6e 20 74 68 65 20 61 62 73 74 72 61 63 74 2c  In the abstract,
0920: 20 65 61 63 68 20 74 65 73 74 20 6e 61 6d 65 20   each test name 
0930: 62 65 67 69 6e 73 20 73 74 61 72 74 73 20 61 74  begins starts at
0940: 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f   the beginning o
0950: 66 20 61 20 6c 69 6e 65 2c 0a 61 6e 64 20 61 6c  f a line,.and al
0960: 6c 20 74 68 65 20 61 73 73 6f 63 69 61 74 65 64  l the associated
0970: 20 73 74 61 74 65 73 20 61 72 65 20 69 6e 64 65   states are inde
0980: 6e 74 65 64 20 6f 6e 65 20 74 61 62 20 73 74 6f  nted one tab sto
0990: 70 2e 0a 45 61 63 68 20 73 74 61 74 65 20 63 6f  p..Each state co
09a0: 6e 73 69 73 74 73 20 6f 66 20 61 20 6e 61 6d 65  nsists of a name
09b0: 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 61 6e 20   followed by an 
09c0: 61 72 72 61 79 20 73 70 65 63 69 66 69 63 61 74  array specificat
09d0: 69 6f 6e 2c 0a 77 68 65 72 65 20 74 68 65 20 66  ion,.where the f
09e0: 69 72 73 74 20 65 6c 65 6d 65 6e 74 20 69 73 20  irst element is 
09f0: 74 68 65 20 74 65 73 74 20 74 65 78 74 20 73 74  the test text st
0a00: 72 69 6e 67 20 74 6f 20 73 65 6e 64 2c 20 61 6e  ring to send, an
0a10: 64 20 74 68 65 0a 73 65 63 6f 6e 64 20 65 6c 65  d the.second ele
0a20: 6d 65 6e 74 20 69 73 20 61 6e 20 61 72 72 61 79  ment is an array
0a30: 20 6f 66 20 31 20 6f 72 20 6d 6f 72 65 20 60 5b   of 1 or more `[
0a40: 72 65 73 70 6f 6e 73 65 2c 20 6e 65 77 73 74 61  response, newsta
0a50: 74 65 5d 60 20 70 61 69 72 73 2e 0a 0a 45 76 65  te]` pairs...Eve
0a60: 72 79 20 73 74 61 74 65 20 6d 61 63 68 69 6e 65  ry state machine
0a70: 20 6d 75 73 74 20 68 61 76 65 20 61 20 e2 80 9c   must have a “
0a80: 60 73 74 61 72 74 60 e2 80 9d 20 73 74 61 74 65  `start`” state
0a90: 2e 0a 0a 45 76 65 72 79 20 73 74 61 74 65 20 6d  ...Every state m
0aa0: 61 63 68 69 6e 65 20 73 68 6f 75 6c 64 20 68 61  achine should ha
0ab0: 76 65 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 20  ve at least one 
0ac0: 73 74 61 74 65 20 74 68 61 74 20 6e 61 6d 65 73  state that names
0ad0: 20 e2 80 9c 60 73 75 63 63 65 73 73 60 e2 80 9d   “`success`”
0ae0: 20 6f 72 0a e2 80 9c 60 66 61 69 6c 75 72 65 60   or.“`failure`
0af0: e2 80 9d 20 61 73 20 74 65 72 6d 69 6e 61 74 69  ” as terminati
0b00: 6f 6e 20 73 74 61 74 65 73 2e 0a 0a 54 68 65 20  on states...The 
0b10: 60 2d 6e 60 2c 20 60 2d 2d 64 72 79 2d 72 75 6e  `-n`, `--dry-run
0b20: 60 20 6f 70 74 69 6f 6e 20 73 68 6f 75 6c 64 20  ` option should 
0b30: 62 65 20 75 73 65 64 20 61 74 20 64 65 76 65 6c  be used at devel
0b40: 6f 70 6d 65 6e 74 20 74 69 6d 65 20 74 6f 0a 63  opment time to.c
0b50: 6f 6e 66 69 72 6d 20 74 68 61 74 20 74 68 65 20  onfirm that the 
0b60: 74 65 73 74 20 73 74 61 74 65 20 6d 61 63 68 69  test state machi
0b70: 6e 65 20 77 69 6c 6c 20 74 65 72 6d 69 6e 61 74  ne will terminat
0b80: 65 20 77 69 74 68 20 73 75 63 63 65 73 73 20 69  e with success i
0b90: 66 20 61 6c 6c 0a 74 65 73 74 73 20 63 6f 6d 65  f all.tests come
0ba0: 20 62 61 63 6b 20 73 75 63 63 65 73 73 66 75 6c   back successful
0bb0: 2e 0a 0a 54 68 65 20 65 61 73 69 65 73 74 20 77  ...The easiest w
0bc0: 61 79 20 74 6f 20 75 6e 64 65 72 73 74 61 6e 64  ay to understand
0bd0: 20 68 6f 77 20 74 6f 20 64 65 66 69 6e 65 20 74   how to define t
0be0: 68 65 20 73 74 61 74 65 20 6d 61 63 68 69 6e 65  he state machine
0bf0: 20 69 73 20 74 6f 0a 73 74 75 64 79 20 61 6e 20   is to.study an 
0c00: 65 78 61 6d 70 6c 65 3a 0a 0a 20 20 20 20 27 70  example:..    'p
0c10: 73 27 3a 0a 20 20 20 20 20 20 20 20 27 73 74 61  s':.        'sta
0c20: 72 74 27 3a 20 5b 22 45 58 45 20 43 43 52 5c 72  rt': ["EXE CCR\r
0c30: 22 2c 20 5b 5b 22 50 52 4f 47 52 41 4d 4d 45 5c  ", [["PROGRAMME\
0c40: 5c 73 2b 3e 22 2c 20 27 70 72 6f 67 6e 61 6d 65  \s+>", 'progname
0c50: 27 5d 5d 5d 0a 20 20 20 20 20 20 20 20 27 70 72  ']]].        'pr
0c60: 6f 67 6e 61 6d 65 27 3a 20 5b 22 70 73 2e 63 5c  ogname': ["ps.c\
0c70: 72 22 2c 20 5b 0a 20 20 20 20 20 20 20 20 20 20  r", [.          
0c80: 20 20 20 20 20 20 5b 20 22 2e 2a 39 32 34 2e 2a        [ ".*924.*
0c90: 43 4f 4d 50 4c 45 54 45 44 5c 72 5c 6e 5c 72 5c  COMPLETED\r\n\r\
0ca0: 6e 23 45 4e 44 20 42 41 54 43 48 5c 72 5c 6e 5c  n#END BATCH\r\n\
0cb0: 72 5c 6e 2e 24 22 2c 0a 20 20 20 20 20 20 20 20  r\n.$",.        
0cc0: 20 20 20 20 20 20 20 20 20 20 27 73 75 63 63 65            'succe
0cd0: 73 73 27 0a 20 20 20 20 20 20 20 20 20 20 20 20  ss'.            
0ce0: 20 20 20 20 5d 0a 20 20 20 20 20 20 20 20 20 20      ].          
0cf0: 20 20 5d 0a 20 20 20 20 20 20 20 20 5d 0a 20 20    ].        ].  
0d00: 20 20 27 66 69 62 27 3a 0a 20 20 20 20 20 20 20    'fib':.       
0d10: 20 27 73 74 61 72 74 27 3a 20 5b 22 45 58 45 20   'start': ["EXE 
0d20: 43 43 52 5c 72 22 2c 20 5b 5b 22 50 52 4f 47 52  CCR\r", [["PROGR
0d30: 41 4d 4d 45 5c 5c 73 2b 3e 22 2c 20 27 70 72 6f  AMME\\s+>", 'pro
0d40: 67 6e 61 6d 65 27 5d 5d 5d 0a 20 20 20 20 20 20  gname']]].      
0d50: 20 20 27 70 72 6f 67 6e 61 6d 65 27 3a 20 5b 22    'progname': ["
0d60: 66 69 62 2e 63 5c 72 22 2c 20 5b 0a 20 20 20 20  fib.c\r", [.    
0d70: 20 20 20 20 20 20 20 20 20 20 20 20 5b 20 22 4f              [ "O
0d80: 56 45 52 46 4c 4f 57 20 41 54 20 23 31 38 20 3d  VERFLOW AT #18 =
0d90: 20 32 35 38 34 5c 72 5c 6e 5c 72 5c 6e 23 45 4e   2584\r\n\r\n#EN
0da0: 44 20 42 41 54 43 48 5c 72 5c 6e 5c 72 5c 6e 2e  D BATCH\r\n\r\n.
0db0: 24 22 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20  $",.            
0dc0: 20 20 20 20 20 20 27 73 75 63 63 65 73 73 27 0a        'success'.
0dd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0de0: 5d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5d 0a  ].            ].
0df0: 20 20 20 20 20 20 20 20 5d 0a 0a 54 68 69 73 20          ]..This 
0e00: 66 69 6c 65 20 64 65 66 69 6e 65 73 20 74 77 6f  file defines two
0e10: 20 74 65 73 74 73 20 66 6f 72 20 74 68 65 20 60   tests for the `
0e20: 63 63 38 60 20 70 61 63 6b 61 67 65 2c 20 60 70  cc8` package, `p
0e30: 73 60 20 61 6e 64 20 60 66 69 62 60 2c 20 77 68  s` and `fib`, wh
0e40: 69 63 68 0a 66 6f 6c 6c 6f 77 20 61 20 76 65 72  ich.follow a ver
0e50: 79 20 73 69 6d 69 6c 61 72 20 73 74 72 75 63 74  y similar struct
0e60: 75 72 65 3a 0a 0a 20 2a 20 42 6f 74 68 20 68 61  ure:.. * Both ha
0e70: 76 65 20 74 68 65 20 72 65 71 75 69 73 69 74 65  ve the requisite
0e80: 20 60 73 74 61 72 74 60 20 73 74 61 74 65 20 61   `start` state a
0e90: 6e 64 20 74 65 72 6d 69 6e 61 74 69 6e 67 20 60  nd terminating `
0ea0: 73 75 63 63 65 73 73 60 20 63 6f 6e 64 69 74 69  success` conditi
0eb0: 6f 6e 2e 0a 20 2a 20 42 6f 74 68 20 72 75 6e 20  on.. * Both run 
0ec0: 74 68 65 20 4f 53 2f 38 20 63 6f 6d 6d 61 6e 64  the OS/8 command
0ed0: 20 60 45 58 45 20 43 43 52 60 20 77 68 69 63 68   `EXE CCR` which
0ee0: 20 72 75 6e 73 20 60 44 53 4b 3a 43 43 52 2e 42   runs `DSK:CCR.B
0ef0: 49 60 2c 0a 20 20 20 70 61 72 74 20 6f 66 20 74  I`,.   part of t
0f00: 68 65 20 43 43 38 20 70 61 63 6b 61 67 65 2e 0a  he CC8 package..
0f10: 20 2a 20 42 6f 74 68 20 72 65 61 63 74 20 74 6f   * Both react to
0f20: 20 74 68 65 20 70 72 6f 67 72 61 6d 20 6e 61 6d   the program nam
0f30: 65 20 69 6e 70 75 74 20 70 72 6f 6d 70 74 20 62  e input prompt b
0f40: 79 20 6c 69 6e 6b 69 6e 67 20 74 6f 20 74 68 65  y linking to the
0f50: 20 60 70 72 6f 67 6e 61 6d 65 60 20 73 74 61 74   `progname` stat
0f60: 65 2e 0a 20 2a 20 45 61 63 68 20 74 65 73 74 20  e.. * Each test 
0f70: 61 6e 73 77 65 72 73 20 74 68 65 20 60 70 72 6f  answers the `pro
0f80: 67 6e 61 6d 65 60 20 73 74 61 74 65 20 62 79 20  gname` state by 
0f90: 73 65 6e 64 69 6e 67 20 74 68 65 20 6e 61 6d 65  sending the name
0fa0: 20 6f 66 20 61 20 43 0a 20 20 20 70 72 6f 67 72   of a C.   progr
0fb0: 61 6d 20 69 6e 73 74 61 6c 6c 65 64 20 77 69 74  am installed wit
0fc0: 68 20 43 43 38 2c 20 61 66 74 65 72 20 77 68 69  h CC8, after whi
0fd0: 63 68 20 74 68 65 20 74 65 73 74 20 77 61 73 20  ch the test was 
0fe0: 6e 61 6d 65 64 2e 0a 20 2a 20 45 61 63 68 20 74  named.. * Each t
0ff0: 65 73 74 20 6c 6f 6f 6b 73 20 66 6f 72 20 65 78  est looks for ex
1000: 70 65 63 74 65 64 20 6f 75 74 70 75 74 20 66 72  pected output fr
1010: 6f 6d 20 74 68 65 20 74 65 73 74 20 70 72 6f 67  om the test prog
1020: 72 61 6d 20 66 6f 6c 6c 6f 77 65 64 20 62 79 0a  ram followed by.
1030: 20 20 20 74 68 65 20 63 6f 6d 6d 6f 6e 20 60 23     the common `#
1040: 45 4e 44 20 42 41 54 43 48 60 20 61 66 74 65 72  END BATCH` after
1050: 20 61 20 63 6f 6d 70 6c 65 74 65 64 20 60 43 43   a completed `CC
1060: 49 2e 42 49 60 20 72 75 6e 2e 20 49 66 20 66 6f  I.BI` run. If fo
1070: 75 6e 64 2c 0a 20 20 20 73 65 6e 64 73 20 74 68  und,.   sends th
1080: 65 20 74 65 73 74 20 73 74 61 74 65 20 6d 61 63  e test state mac
1090: 68 69 6e 65 20 74 6f 20 74 68 65 20 60 73 75 63  hine to the `suc
10a0: 63 65 73 73 60 20 63 6f 6e 64 69 74 69 6f 6e 2e  cess` condition.
10b0: 0a 0a 42 65 63 61 75 73 65 20 74 68 65 20 73 65  ..Because the se
10c0: 63 6f 6e 64 20 65 6c 65 6d 65 6e 74 20 6f 66 20  cond element of 
10d0: 65 61 63 68 20 74 65 73 74 20 69 73 20 61 6e 20  each test is an 
10e0: 61 72 72 61 79 20 6f 66 20 70 61 69 72 73 2c 20  array of pairs, 
10f0: 79 6f 75 20 63 61 6e 0a 68 61 76 65 20 74 68 65  you can.have the
1100: 20 74 65 73 74 20 63 68 65 63 6b 20 66 6f 72 20   test check for 
1110: 6d 75 6c 74 69 70 6c 65 20 65 78 70 65 63 74 65  multiple expecte
1120: 64 20 70 6f 73 73 69 62 6c 65 20 61 6e 73 77 65  d possible answe
1130: 72 73 2c 20 73 65 6e 64 69 6e 67 20 74 68 65 0a  rs, sending the.
1140: 73 74 61 74 65 20 6d 61 63 68 69 6e 65 20 74 6f  state machine to
1150: 20 70 6f 74 65 6e 74 69 61 6c 6c 79 20 64 69 66   potentially dif
1160: 66 65 72 65 6e 74 20 63 6f 6e 64 69 74 69 6f 6e  ferent condition
1170: 73 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 77  s depending on w
1180: 68 69 63 68 20 6f 6e 65 0a 63 6f 6d 65 73 20 62  hich one.comes b
1190: 61 63 6b 2e 20 54 68 69 73 20 67 69 76 65 73 20  ack. This gives 
11a0: 74 68 65 20 73 79 73 74 65 6d 20 61 20 73 69 6d  the system a sim
11b0: 70 6c 65 20 73 6f 72 74 20 6f 66 20 63 6f 6e 64  ple sort of cond
11c0: 69 74 69 6f 6e 61 6c 20 6c 6f 67 69 63 3a 0a 0a  itional logic:..
11d0: 20 20 20 20 27 61 64 76 65 6e 74 27 3a 20 5b 22      'advent': ["
11e0: 41 44 56 45 4e 54 5c 65 22 2c 20 5b 0a 20 20 20  ADVENT\e", [.   
11f0: 20 20 20 20 20 20 20 20 20 5b 20 22 4c 4f 43 41           [ "LOCA
1200: 54 49 4f 4e 20 4f 46 20 54 45 58 54 20 44 41 54  TION OF TEXT DAT
1210: 41 42 41 53 45 5c 5c 73 2b 5c 5c 28 5c 5c 53 2b  ABASE\\s+\\(\\S+
1220: 5c 5c 29 2e 2a 22 2c 20 27 64 61 74 61 62 61 73  \\).*", 'databas
1230: 65 27 20 5d 2c 0a 20 20 20 20 20 20 20 20 20 20  e' ],.          
1240: 20 20 5b 20 22 57 45 4c 43 4f 4d 45 20 54 4f 20    [ "WELCOME TO 
1250: 41 44 56 45 4e 54 55 52 45 21 21 22 2c 20 27 69  ADVENTURE!!", 'i
1260: 6e 73 74 72 75 63 74 69 6f 6e 73 27 20 5d 0a 20  nstructions' ]. 
1270: 20 20 20 20 20 20 20 5d 0a 20 20 20 20 5d 0a 0a         ].    ]..
1280: 59 6f 75 20 63 61 6e 20 73 65 65 20 74 68 65 20  You can see the 
1290: 72 65 73 74 20 6f 66 20 74 68 65 20 74 65 73 74  rest of the test
12a0: 20 5b 68 65 72 65 5d 5b 61 79 6d 6c 5d 2c 20 62   [here][ayml], b
12b0: 75 74 20 74 68 69 73 20 73 68 6f 77 73 20 74 68  ut this shows th
12c0: 65 0a 65 73 73 65 6e 74 69 61 6c 20 65 6c 65 6d  e.essential elem
12d0: 65 6e 74 73 3a 20 74 77 6f 20 70 6f 73 73 69 62  ents: two possib
12e0: 6c 65 20 72 65 73 70 6f 6e 73 65 73 2c 20 73 65  le responses, se
12f0: 6e 64 69 6e 67 20 74 68 65 20 74 65 73 74 20 74  nding the test t
1300: 6f 20 6f 6e 65 20 6f 66 0a 74 77 6f 20 73 74 61  o one of.two sta
1310: 74 65 73 2c 20 60 64 61 74 61 62 61 73 65 60 20  tes, `database` 
1320: 6f 72 20 60 69 6e 73 74 72 75 63 74 69 6f 6e 73  or `instructions
1330: 60 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 77  ` depending on w
1340: 68 65 74 68 65 72 20 41 64 76 65 6e 74 75 72 65  hether Adventure
1350: 0a 68 61 73 20 62 65 65 6e 20 72 75 6e 20 6f 6e  .has been run on
1360: 20 74 68 65 20 62 6f 6f 74 20 6d 65 64 69 61 20   the boot media 
1370: 75 73 65 64 20 62 79 20 74 68 65 20 74 65 73 74  used by the test
1380: 20 62 65 66 6f 72 65 2e 20 57 69 74 68 6f 75 74   before. Without
1390: 20 74 68 69 73 0a 6c 6f 67 69 63 2c 20 77 65 e2   this.logic, we
13a0: 80 99 64 20 68 61 76 65 20 74 6f 20 65 69 74 68  d have to eith
13b0: 65 72 20 72 65 62 75 69 6c 64 20 74 68 65 20 74  er rebuild the t
13c0: 65 73 74 20 6d 65 64 69 61 20 65 61 63 68 20 74  est media each t
13d0: 69 6d 65 20 77 65 20 72 61 6e 20 74 68 65 0a 74  ime we ran the.t
13e0: 65 73 74 20 6f 72 20 72 6f 6c 6c 20 62 61 63 6b  est or roll back
13f0: 20 61 6c 6c 20 73 74 61 74 65 20 63 68 61 6e 67   all state chang
1400: 65 73 20 6d 61 64 65 20 74 6f 20 69 74 2e 0a 0a  es made to it...
1410: 4e 6f 74 69 63 65 20 74 68 65 20 75 73 65 20 6f  Notice the use o
1420: 66 20 60 5c 65 60 20 74 6f 20 73 74 61 72 74 20  f `\e` to start 
1430: 60 41 44 56 45 4e 54 60 2c 20 74 65 72 6d 69 6e  `ADVENT`, termin
1440: 61 74 69 6e 67 20 74 68 65 20 4f 53 2f 38 20 43  ating the OS/8 C
1450: 6f 6d 6d 61 6e 64 20 44 65 63 6f 64 65 72 0a 69  ommand Decoder.i
1460: 6e 70 75 74 20 77 69 74 68 20 61 6e 20 41 53 43  nput with an ASC
1470: 49 49 20 65 73 63 61 70 65 20 63 68 61 72 61 63  II escape charac
1480: 74 65 72 2e 0a 0a 5b 61 79 6d 6c 5d 3a 20 2f 66  ter...[ayml]: /f
1490: 69 6c 65 2f 73 63 72 69 70 74 73 2f 6f 73 38 2d  ile/scripts/os8-
14a0: 70 72 6f 67 74 65 73 74 2f 61 64 76 65 6e 74 2e  progtest/advent.
14b0: 79 6d 6c 0a 0a 0a 23 23 23 20 41 64 64 69 74 69  yml...### Additi
14c0: 6f 6e 61 6c 20 53 79 6e 74 61 78 20 49 6e 66 6f  onal Syntax Info
14d0: 72 6d 61 74 69 6f 6e 0a 0a 41 20 6c 69 6e 65 20  rmation..A line 
14e0: 62 65 67 69 6e 6e 69 6e 67 20 77 69 74 68 20 61  beginning with a
14f0: 20 60 23 60 20 69 73 20 69 67 6e 6f 72 65 64 20   `#` is ignored 
1500: 61 73 20 61 20 63 6f 6d 6d 65 6e 74 2e 0a 0a 0a  as a comment....
1510: 23 23 20 43 72 61 66 74 69 6e 67 20 4e 65 77 20  ## Crafting New 
1520: 53 74 61 74 65 20 4d 61 63 68 69 6e 65 73 0a 0a  State Machines..
1530: 31 2e 20 54 68 65 20 59 41 4d 4c 20 71 75 6f 74  1. The YAML quot
1540: 69 6e 67 20 63 6f 6e 76 65 6e 74 69 6f 6e 73 20  ing conventions 
1550: 61 72 65 20 63 61 72 65 66 75 6c 6c 79 20 63 68  are carefully ch
1560: 6f 73 65 6e 21 0a 0a 20 20 20 20 2a 20 20 20 53  osen!..    *   S
1570: 75 72 72 6f 75 6e 64 20 73 74 61 74 65 20 6e 61  urround state na
1580: 6d 65 73 20 77 69 74 68 20 73 69 6e 67 6c 65 20  mes with single 
1590: 71 75 6f 74 65 73 2e 20 20 4f 74 68 65 72 77 69  quotes.  Otherwi
15a0: 73 65 20 73 74 61 74 65 20 6e 61 6d 65 73 0a 20  se state names. 
15b0: 20 20 20 20 20 20 20 6c 69 6b 65 20 60 79 65 73         like `yes
15c0: 60 20 67 65 74 20 65 76 61 6c 75 61 74 65 64 20  ` get evaluated 
15d0: 61 6e 64 20 74 75 72 6e 65 64 20 69 6e 74 6f 20  and turned into 
15e0: 73 6f 6d 65 74 68 69 6e 67 20 65 6c 73 65 2e 20  something else. 
15f0: 28 60 79 65 73 60 0a 20 20 20 20 20 20 20 20 62  (`yes`.        b
1600: 65 63 6f 6d 65 73 20 60 54 72 75 65 60 2e 29 0a  ecomes `True`.).
1610: 0a 20 20 20 20 2a 20 20 20 53 75 72 72 6f 75 6e  .    *   Surroun
1620: 64 20 73 65 6e 64 20 61 6e 64 20 72 65 70 6c 79  d send and reply
1630: 20 73 74 72 69 6e 67 73 20 77 69 74 68 20 64 6f   strings with do
1640: 75 62 6c 65 20 71 75 6f 74 65 73 2e 20 54 68 65  uble quotes. The
1650: 20 59 41 4d 4c 0a 20 20 20 20 20 20 20 20 65 76   YAML.        ev
1660: 61 6c 75 61 74 69 6f 6e 20 6f 66 20 71 75 6f 74  aluation of quot
1670: 65 64 20 73 74 72 69 6e 67 73 20 69 73 20 74 68  ed strings is th
1680: 65 20 73 69 6d 70 6c 65 73 74 20 74 6f 20 75 6e  e simplest to un
1690: 64 65 72 73 74 61 6e 64 20 61 73 20 69 74 0a 20  derstand as it. 
16a0: 20 20 20 20 20 20 20 67 65 74 73 20 74 72 61 6e         gets tran
16b0: 73 6c 61 74 65 64 20 69 6e 74 6f 20 50 79 74 68  slated into Pyth
16c0: 6f 6e 20 70 65 78 70 65 63 74 20 72 65 67 75 6c  on pexpect regul
16d0: 61 72 20 65 78 70 72 65 73 73 69 6f 6e 73 2e 0a  ar expressions..
16e0: 0a 32 2e 20 20 4f 53 2f 38 20 63 6f 6d 6d 61 6e  .2.  OS/8 comman
16f0: 64 73 20 65 6e 64 20 77 69 74 68 20 61 20 63 61  ds end with a ca
1700: 72 72 69 61 67 65 20 72 65 74 75 72 6e 20 64 65  rriage return de
1710: 6e 6f 74 65 64 20 62 79 20 60 5c 72 60 20 6f 72  noted by `\r` or
1720: 20 65 73 63 61 70 65 0a 20 20 20 20 64 65 6e 6f   escape.    deno
1730: 74 65 64 20 62 79 20 60 5c 65 60 2e 0a 0a 33 2e  ted by `\e`...3.
1740: 20 20 46 6f 72 20 70 72 6f 67 72 61 6d 73 20 6e    For programs n
1750: 65 65 64 69 6e 67 20 3c 6b 62 64 3e 43 74 72 6c  eeding <kbd>Ctrl
1760: 2d 43 3c 2f 6b 62 64 3e 20 74 6f 20 67 65 74 20  -C</kbd> to get 
1770: 6f 75 74 20 6f 66 20 73 6f 6d 65 20 6c 6f 6f 70  out of some loop
1780: 2c 20 75 73 65 0a 20 20 20 20 74 68 65 20 59 41  , use.    the YA
1790: 4d 4c 20 68 65 78 20 63 6f 64 65 20 60 5c 78 30  ML hex code `\x0
17a0: 33 60 2e 0a 0a 34 2e 20 20 60 70 65 78 70 65 63  3`...4.  `pexpec
17b0: 74 60 20 74 72 61 6e 73 6c 61 74 65 73 20 61 6c  t` translates al
17c0: 6c 20 54 54 59 20 6f 75 74 70 75 74 20 79 6f 75  l TTY output you
17d0: 20 73 65 65 20 66 72 6f 6d 20 72 75 6e 6e 69 6e   see from runnin
17e0: 67 20 74 68 65 0a 20 20 20 20 73 69 6d 75 6c 61  g the.    simula
17f0: 74 6f 72 20 74 6f 20 75 70 70 65 72 20 63 61 73  tor to upper cas
1800: 65 2c 20 73 6f 20 74 61 6b 65 20 61 6e 79 74 68  e, so take anyth
1810: 69 6e 67 20 79 6f 75 20 73 65 65 20 61 6e 64 20  ing you see and 
1820: 74 72 61 6e 73 6c 61 74 65 20 69 74 0a 20 20 20  translate it.   
1830: 20 74 6f 20 75 70 70 65 72 20 63 61 73 65 20 69   to upper case i
1840: 6e 20 74 68 65 20 72 65 70 6c 79 20 73 74 72 69  n the reply stri
1850: 6e 67 2e 0a 0a 35 2e 20 20 49 74 20 69 73 20 69  ng...5.  It is i
1860: 6d 70 6f 72 74 61 6e 74 20 74 6f 20 65 73 63 61  mportant to esca
1870: 70 65 20 63 68 61 72 61 63 74 65 72 73 20 74 68  pe characters th
1880: 61 74 20 6e 6f 72 6d 61 6c 6c 79 20 68 61 76 65  at normally have
1890: 20 72 65 67 65 78 0a 20 20 20 20 6d 65 61 6e 69   regex.    meani
18a0: 6e 67 3a 20 60 2e 60 20 60 2b 60 20 60 2a 60 20  ng: `.` `+` `*` 
18b0: 60 24 60 20 60 28 60 20 60 29 60 20 61 6e 64 20  `$` `(` `)` and 
18c0: 60 5c 60 2e 20 20 54 6f 20 64 6f 20 74 68 69 73  `\`.  To do this
18d0: 20 69 6e 20 59 41 4d 4c 2c 0a 20 20 20 20 70 72   in YAML,.    pr
18e0: 65 66 61 63 65 20 65 61 63 68 20 6f 63 63 75 72  eface each occur
18f0: 72 65 6e 63 65 20 77 69 74 68 20 74 77 6f 20 62  rence with two b
1900: 61 63 6b 73 6c 61 73 68 65 73 2e 20 53 6f 20 66  ackslashes. So f
1910: 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 6f 0a 20  or example, to. 
1920: 20 20 20 70 61 73 73 20 69 6e 20 61 20 6c 69 74     pass in a lit
1930: 65 72 61 6c 20 71 75 65 73 74 69 6f 6e 20 6d 61  eral question ma
1940: 72 6b 2c 20 72 65 70 6c 61 63 65 20 60 3f 60 20  rk, replace `?` 
1950: 77 69 74 68 20 60 5c 5c 3f 60 2e 0a 0a 36 2e 20  with `\\?`...6. 
1960: 20 54 6f 20 70 61 73 73 20 69 6e 20 72 65 67 65   To pass in rege
1970: 78 20 65 73 63 61 70 65 73 20 74 68 61 74 20 68  x escapes that h
1980: 61 76 65 20 61 20 62 61 63 6b 73 6c 61 73 68 20  ave a backslash 
1990: e2 80 94 20 66 6f 72 20 65 78 61 6d 70 6c 65 20  — for example 
19a0: 60 5c 73 60 0a 20 20 20 20 66 6f 72 20 77 68 69  `\s`.    for whi
19b0: 74 65 73 70 61 63 65 20 e2 80 94 20 64 6f 75 62  tespace — doub
19c0: 6c 65 20 74 68 65 20 62 61 63 6b 73 6c 61 73 68  le the backslash
19d0: 2c 20 73 6f 20 60 5c 73 60 20 62 65 63 6f 6d 65  , so `\s` become
19e0: 73 20 60 5c 5c 73 60 2e 0a 0a 37 2e 20 20 55 73  s `\\s`...7.  Us
19f0: 65 20 6f 66 20 72 65 67 65 78 e2 80 99 73 20 65  e of regex’s e
1a00: 6e 64 2d 6f 66 2d 73 74 72 69 6e 67 20 6d 61 74  nd-of-string mat
1a10: 63 68 20 28 60 24 60 29 20 63 61 6e 20 6f 66 74  ch (`$`) can oft
1a20: 65 6e 20 69 6d 70 72 6f 76 65 0a 20 20 20 20 72  en improve.    r
1a30: 65 6c 69 61 62 69 6c 69 74 79 2c 20 62 65 63 61  eliability, beca
1a40: 75 73 65 20 69 74 20 65 6e 73 75 72 65 73 20 74  use it ensures t
1a50: 68 65 20 73 74 61 74 65 20 6d 61 63 68 69 6e 65  he state machine
1a60: 20 64 6f 65 73 6e e2 80 99 74 20 70 72 6f 63 65   doesn’t proce
1a70: 65 64 0a 20 20 20 20 62 65 66 6f 72 65 20 4f 53  ed.    before OS
1a80: 2f 38 20 6f 72 20 74 68 65 20 70 72 6f 67 72 61  /8 or the progra
1a90: 6d 20 72 75 6e 6e 69 6e 67 20 75 6e 64 65 72 20  m running under 
1aa0: 69 74 20 69 73 20 72 65 61 64 79 2e 20 4b 65 65  it is ready. Kee
1ab0: 70 20 69 6e 20 6d 69 6e 64 0a 20 20 20 20 74 68  p in mind.    th
1ac0: 61 74 20 60 6f 73 38 2d 70 72 6f 67 74 65 73 74  at `os8-progtest
1ad0: 60 20 72 75 6e 73 20 69 6e 20 79 6f 75 72 20 68  ` runs in your h
1ae0: 6f 73 74 20 6d 61 63 68 69 6e 65 e2 80 99 73 20  ost machine’s 
1af0: 63 6f 6e 74 65 78 74 2c 20 61 6e 64 20 77 68 69  context, and whi
1b00: 6c 65 0a 20 20 20 20 74 68 65 20 70 72 6f 67 72  le.    the progr
1b10: 61 6d 20 75 6e 64 65 72 20 74 65 73 74 20 69 73  am under test is
1b20: 20 72 75 6e 6e 69 6e 67 20 75 6e 74 68 72 6f 74   running unthrot
1b30: 74 6c 65 64 20 6f 6e 20 74 68 65 20 50 44 50 2d  tled on the PDP-
1b40: 38 0a 20 20 20 20 73 69 6d 75 6c 61 74 6f 72 2c  8.    simulator,
1b50: 20 69 74 e2 80 99 73 20 73 74 69 6c 6c 20 6c 69   it’s still li
1b60: 6b 65 6c 79 20 61 20 70 72 6f 67 72 61 6d 20 66  kely a program f
1b70: 72 6f 6d 20 74 68 65 20 31 39 36 30 73 20 6f 72  rom the 1960s or
1b80: 20 31 39 37 30 73 0a 20 20 20 20 65 78 70 65 63   1970s.    expec
1b90: 74 69 6e 67 20 74 6f 20 72 75 6e 20 6f 6e 20 61  ting to run on a
1ba0: 20 6d 61 63 68 69 6e 65 20 63 61 70 61 62 6c 65   machine capable
1bb0: 20 6f 66 20 6f 6e 6c 79 20 61 20 66 65 77 20 68   of only a few h
1bc0: 75 6e 64 72 65 64 20 74 68 6f 75 73 61 6e 64 0a  undred thousand.
1bd0: 20 20 20 20 69 6e 73 74 72 75 63 74 69 6f 6e 73      instructions
1be0: 20 70 65 72 20 73 65 63 6f 6e 64 2c 20 62 65 69   per second, bei
1bf0: 6e 67 20 66 65 64 20 69 6e 74 65 72 61 63 74 69  ng fed interacti
1c00: 76 65 20 69 6e 70 75 74 20 62 79 20 61 20 31 31  ve input by a 11
1c10: 30 20 62 70 73 0a 20 20 20 20 74 65 6c 65 74 79  0 bps.    telety
1c20: 70 65 2e 20 53 6f 6d 65 20 70 72 6f 67 72 61 6d  pe. Some program
1c30: 73 20 63 61 6e 20 67 65 74 20 73 70 61 6d 6d 65  s can get spamme
1c40: 64 20 69 66 20 79 6f 75 20 64 6f 6e e2 80 99 74  d if you don’t
1c50: 20 77 61 69 74 20 6f 75 74 20 74 68 65 0a 20 20   wait out the.  
1c60: 20 20 66 75 6c 6c 20 72 65 70 6c 79 20 6c 69 6e    full reply lin
1c70: 65 20 62 65 66 6f 72 65 20 73 65 6e 64 69 6e 67  e before sending
1c80: 20 74 68 65 20 6e 65 78 74 20 62 69 74 20 6f 66   the next bit of
1c90: 20 69 6e 70 75 74 2e 0a 0a 38 2e 20 20 53 6f 6d   input...8.  Som
1ca0: 65 74 69 6d 65 73 20 67 75 65 73 73 69 6e 67 20  etimes guessing 
1cb0: 74 68 65 20 65 78 61 63 74 20 77 68 69 74 65 73  the exact whites
1cc0: 70 61 63 65 20 69 73 20 64 69 66 66 69 63 75 6c  pace is difficul
1cd0: 74 2e 20 20 54 68 65 20 60 5c 5c 73 2b 60 0a 20  t.  The `\\s+`. 
1ce0: 20 20 20 63 6f 6e 73 74 72 75 63 74 20 74 6f 20     construct to 
1cf0: 6d 61 74 63 68 20 6f 6e 20 6f 6e 65 20 6f 72 20  match on one or 
1d00: 6d 6f 72 65 20 77 68 69 74 65 73 70 61 63 65 20  more whitespace 
1d10: 63 68 61 72 61 63 74 65 72 73 20 69 73 20 6f 66  characters is of
1d20: 74 65 6e 0a 20 20 20 20 68 65 6c 70 66 75 6c 2e  ten.    helpful.
1d30: 0a 0a 39 2e 20 20 48 65 6c 70 66 75 6c 20 6d 61  ..9.  Helpful ma
1d40: 74 63 68 20 73 74 72 69 6e 67 73 3a 0a 0a 20 20  tch strings:..  
1d50: 20 20 53 74 72 69 6e 67 20 20 20 20 20 7c 20 20    String     |  
1d60: 4d 65 61 6e 69 6e 67 0a 20 20 20 20 2d 2d 2d 2d  Meaning.    ----
1d70: 2d 2d 2d 2d 2d 2d 20 7c 20 2d 2d 2d 2d 2d 2d 2d  ------ | -------
1d80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 60  ----------.    `
1d90: 22 5c 6e 5c 2e 24 22 60 20 20 7c 20 4f 53 2f 38  "\n\.$"`  | OS/8
1da0: 20 4d 6f 6e 69 74 6f 72 20 70 72 6f 6d 70 74 2e   Monitor prompt.
1db0: 20 20 41 6c 77 61 79 73 20 6c 6f 6f 6b 20 66 6f    Always look fo
1dc0: 72 20 74 68 69 73 20 61 74 20 74 68 65 20 65 6e  r this at the en
1dd0: 64 2e 0a 20 20 20 20 60 22 5c 6e 5c 2a 24 22 60  d..    `"\n\*$"`
1de0: 20 20 7c 20 4f 53 2f 38 20 43 6f 6d 6d 61 6e 64    | OS/8 Command
1df0: 20 64 65 63 6f 64 65 72 20 70 72 6f 6d 70 74 2e   decoder prompt.
1e00: 20 20 4f 66 74 65 6e 20 74 68 65 20 66 69 72 73    Often the firs
1e10: 74 20 73 74 65 70 20 69 6e 20 72 75 6e 6e 69 6e  t step in runnin
1e20: 67 20 70 72 6f 67 72 61 6d 73 2e 0a 0a 23 23 23  g programs...###
1e30: 20 50 72 6f 62 6c 65 6d 73 20 6d 61 74 63 68 69   Problems matchi
1e40: 6e 67 20 61 67 61 69 6e 73 74 20 6c 6f 6e 67 20  ng against long 
1e50: 73 74 72 69 6e 67 73 20 6f 66 20 6f 75 74 70 75  strings of outpu
1e60: 74 20 63 68 61 72 61 63 74 65 72 73 2e 0a 0a 50  t characters...P
1e70: 79 74 68 6f 6e 20 65 78 70 65 63 74 20 68 61 73  ython expect has
1e80: 20 62 65 65 6e 20 6f 62 73 65 72 76 65 64 20 74   been observed t
1e90: 6f 20 6d 69 73 62 65 68 61 76 65 20 6f 6e 20 6c  o misbehave on l
1ea0: 6f 6e 67 20 73 74 72 69 6e 67 73 20 6f 66 0a 6f  ong strings of.o
1eb0: 75 74 70 75 74 2c 20 66 6f 72 20 65 78 61 6d 70  utput, for examp
1ec0: 6c 65 20 77 68 65 6e 20 74 72 79 69 6e 67 20 6f  le when trying o
1ed0: 75 74 20 42 41 53 49 43 20 67 61 6d 65 73 20 74  ut BASIC games t
1ee0: 68 61 74 20 70 72 69 6e 74 20 74 79 70 65 77 72  hat print typewr
1ef0: 69 74 74 65 72 0a 61 72 74 2e 20 20 54 68 65 20  itter.art.  The 
1f00: 6d 61 74 63 68 20 74 69 6d 65 73 20 6f 75 74 20  match times out 
1f10: 61 6e 64 20 66 61 69 6c 73 2c 20 61 6e 64 20 74  and fails, and t
1f20: 68 65 20 60 62 65 66 6f 72 65 60 20 6d 61 74 63  he `before` matc
1f30: 68 20 73 74 72 69 6e 67 20 69 73 0a 6f 6e 6c 79  h string is.only
1f40: 20 61 20 70 61 72 74 69 61 6c 20 72 65 61 64 20   a partial read 
1f50: 6f 66 20 74 68 65 20 77 68 6f 6c 65 20 6f 75 74  of the whole out
1f60: 70 75 74 2e 0a 0a 4e 65 69 74 68 65 72 20 65 6e  put...Neither en
1f70: 6c 61 72 67 69 6e 67 20 74 68 65 20 70 65 78 70  larging the pexp
1f80: 65 63 74 20 60 6d 61 78 72 65 61 64 60 20 6f 70  ect `maxread` op
1f90: 74 69 6f 6e 20 66 6f 72 20 74 68 65 20 73 70 61  tion for the spa
1fa0: 77 6e 65 64 20 73 75 62 2d 70 72 6f 63 65 73 73  wned sub-process
1fb0: 2c 0a 6e 6f 72 20 73 65 74 74 69 6e 67 20 61 20  ,.nor setting a 
1fc0: 73 6c 65 65 70 20 62 65 74 77 65 65 6e 20 74 65  sleep between te
1fd0: 73 74 73 20 68 65 6c 70 65 64 2e 20 20 48 6f 77  sts helped.  How
1fe0: 65 76 65 72 2c 20 74 68 65 72 65 20 69 73 20 61  ever, there is a
1ff0: 20 77 6f 72 6b 20 61 72 6f 75 6e 64 3a 0a 50 65   work around:.Pe
2000: 72 66 6f 72 6d 20 61 6e 6f 74 68 65 72 20 77 72  rform another wr
2010: 69 74 65 2f 65 78 70 65 63 74 20 63 79 63 6c 65  ite/expect cycle
2020: 2e 20 20 44 6f 69 6e 67 20 74 68 69 73 20 69 73  .  Doing this is
2030: 20 63 68 61 6c 6c 65 6e 67 69 6e 67 2c 20 62 65   challenging, be
2040: 63 61 75 73 65 0a 69 64 65 61 6c 6c 79 20 79 6f  cause.ideally yo
2050: 75 20 77 61 6e 74 20 74 6f 20 73 65 6e 64 20 69  u want to send i
2060: 6e 70 75 74 20 74 68 61 74 20 77 6f 6e 27 74 20  nput that won't 
2070: 6d 65 73 73 20 75 70 20 74 68 65 20 6f 75 74 70  mess up the outp
2080: 75 74 2e 0a 0a 55 6e 64 65 72 20 42 41 53 49 43  ut...Under BASIC
2090: 2c 20 61 6e 20 61 74 74 65 6d 70 74 20 77 61 73  , an attempt was
20a0: 20 6d 61 64 65 20 74 6f 20 73 65 6e 64 20 60 58   made to send `X
20b0: 4f 46 46 60 20 28 27 5c 30 78 30 31 31 27 29 20  OFF` ('\0x011') 
20c0: 62 75 74 20 73 6f 6d 65 74 69 6d 65 73 2c 20 69  but sometimes, i
20d0: 6e 73 74 65 61 64 0a 6f 66 20 73 65 6e 64 69 6e  nstead.of sendin
20e0: 67 20 60 58 4f 46 46 60 20 74 68 61 74 20 77 6f  g `XOFF` that wo
20f0: 75 6c 64 20 62 65 20 69 67 6e 6f 72 65 64 2c 20  uld be ignored, 
2100: 4f 53 2f 38 20 77 6f 75 6c 64 20 65 63 68 6f 20  OS/8 would echo 
2110: 22 58 30 31 31 22 2e 20 20 54 68 65 20 77 6f 72  "X011".  The wor
2120: 6b 2d 61 72 6f 75 6e 64 0a 74 68 61 74 20 61 63  k-around.that ac
2130: 74 75 61 6c 6c 79 20 77 6f 72 6b 65 64 20 77 61  tually worked wa
2140: 73 20 74 6f 3a 0a 0a 31 2e 20 44 65 74 65 63 74  s to:..1. Detect
2150: 20 73 74 61 6c 6c 65 64 20 6f 75 74 70 75 74 20   stalled output 
2160: 77 69 74 68 20 63 61 72 65 66 75 6c 20 63 72 61  with careful cra
2170: 66 74 69 6e 67 20 6f 66 20 61 64 64 69 74 69 6f  fting of additio
2180: 6e 61 6c 20 73 74 61 74 65 20 6d 61 74 63 68 65  nal state matche
2190: 73 2e 20 41 6e 64 20 61 64 64 69 6e 67 0a 61 20  s. And adding.a 
21a0: 6e 65 77 20 73 74 61 74 65 2e 0a 0a 32 2e 20 50  new state...2. P
21b0: 72 65 76 65 6e 74 20 66 61 6c 73 65 20 70 6f 73  revent false pos
21c0: 69 74 69 76 65 20 74 65 73 74 73 20 6f 66 20 73  itive tests of s
21d0: 74 61 6c 6c 65 64 20 6f 75 74 70 75 74 2c 20 62  talled output, b
21e0: 79 20 70 75 74 74 69 6e 67 20 74 68 65 20 6c 6f  y putting the lo
21f0: 6e 67 65 73 74 2c 0a 64 65 66 69 6e 69 74 69 76  ngest,.definitiv
2200: 65 20 6d 61 74 63 68 20 66 69 72 73 74 20 69 6e  e match first in
2210: 20 74 68 65 20 6c 69 73 74 2e 0a 0a 33 2e 20 53   the list...3. S
2220: 65 6e 64 20 61 20 6e 65 77 6c 69 6e 65 2e 0a 0a  end a newline...
2230: 34 2e 20 52 65 74 65 73 74 2e 0a 0a 35 2e 20 49  4. Retest...5. I
2240: 66 20 6e 65 63 65 73 73 61 72 79 20 6c 6f 6f 70  f necessary loop
2250: 20 61 20 63 6f 75 70 6c 65 20 74 69 6d 65 73 2e   a couple times.
2260: 0a 0a 36 2e 20 4d 61 6b 65 20 73 75 72 65 20 74  ..6. Make sure t
2270: 65 73 74 73 20 61 66 74 65 72 20 74 68 65 20 6b  ests after the k
2280: 69 63 6b 20 68 61 6e 64 6c 65 20 74 68 65 20 61  ick handle the a
2290: 64 64 69 74 69 6f 6e 61 6c 20 6e 65 77 6c 69 6e  dditional newlin
22a0: 65 73 20 67 72 61 63 65 66 75 6c 6c 79 2e 0a 0a  es gracefully...
22b0: 45 78 61 6d 70 6c 65 3a 20 20 54 68 65 20 70 6c  Example:  The pl
22c0: 61 79 62 6f 79 20 62 75 6e 6e 79 20 74 79 70 65  ayboy bunny type
22d0: 77 72 69 74 65 72 20 61 72 74 20 6b 65 70 74 20  writer art kept 
22e0: 68 61 6e 67 69 6e 67 20 61 74 20 72 61 6e 64 6f  hanging at rando
22f0: 6d 20 70 6f 69 6e 74 73 2e 0a 54 68 65 20 6f 6c  m points..The ol
2300: 64 20 76 65 72 73 69 6f 6e 3a 0a 0a 20 20 20 20  d version:..    
2310: 27 62 75 6e 6e 79 27 3a 0a 20 20 20 20 20 20 20  'bunny':.       
2320: 20 27 73 74 61 72 74 27 3a 20 5b 22 52 20 42 41   'start': ["R BA
2330: 53 49 43 5c 72 22 2c 20 5b 5b 22 4e 45 57 20 4f  SIC\r", [["NEW O
2340: 52 20 4f 4c 44 2d 2d 24 22 2c 20 27 6f 6c 64 27  R OLD--$", 'old'
2350: 5d 5d 5d 0a 20 20 20 20 20 20 20 20 27 6f 6c 64  ]]].        'old
2360: 27 3a 20 5b 22 4f 4c 44 5c 72 22 2c 20 5b 5b 22  ': ["OLD\r", [["
2370: 46 49 4c 45 20 4e 41 4d 45 2d 2d 24 22 2c 20 27  FILE NAME--$", '
2380: 6e 61 6d 65 27 5d 5d 5d 0a 20 20 20 20 20 20 20  name']]].       
2390: 20 27 6e 61 6d 65 27 3a 20 5b 22 42 55 4e 4e 59   'name': ["BUNNY
23a0: 2e 42 41 5c 72 22 2c 20 5b 5b 22 52 45 41 44 59  .BA\r", [["READY
23b0: 5c 72 5c 6e 24 22 2c 20 27 72 75 6e 27 5d 5d 5d  \r\n$", 'run']]]
23c0: 0a 20 20 20 20 20 20 20 20 27 72 75 6e 27 3a 20  .        'run': 
23d0: 5b 22 52 55 4e 5c 72 22 2c 20 5b 5b 22 2e 2a 42  ["RUN\r", [[".*B
23e0: 55 4e 4e 59 2e 2a 5c 72 5c 6e 52 45 41 44 59 5c  UNNY.*\r\nREADY\
23f0: 72 5c 6e 24 22 2c 20 27 73 75 63 63 65 73 73 27  r\n$", 'success'
2400: 5d 5d 5d 0a 20 20 20 20 20 20 20 20 27 71 75 69  ]]].        'qui
2410: 74 27 3a 20 5b 22 5c 78 30 33 22 2c 20 5b 5b 22  t': ["\x03", [["
2420: 5c 6e 5c 5c 2e 24 22 2c 20 27 73 75 63 63 65 73  \n\\.$", 'succes
2430: 73 27 5d 5d 5d 0a 0a 62 65 63 6f 6d 65 73 3a 0a  s']]]..becomes:.
2440: 0a 20 20 20 20 27 62 75 6e 6e 79 27 3a 0a 20 20  .    'bunny':.  
2450: 20 20 20 20 20 20 27 73 74 61 72 74 27 3a 20 5b        'start': [
2460: 22 52 20 42 41 53 49 43 5c 72 22 2c 20 5b 5b 22  "R BASIC\r", [["
2470: 4e 45 57 20 4f 52 20 4f 4c 44 2d 2d 24 22 2c 20  NEW OR OLD--$", 
2480: 27 6f 6c 64 27 5d 5d 5d 0a 20 20 20 20 20 20 20  'old']]].       
2490: 20 27 6f 6c 64 27 3a 20 20 20 5b 22 4f 4c 44 5c   'old':   ["OLD\
24a0: 72 22 2c 20 5b 5b 22 46 49 4c 45 20 4e 41 4d 45  r", [["FILE NAME
24b0: 2d 2d 24 22 2c 20 27 6e 61 6d 65 27 5d 5d 5d 0a  --$", 'name']]].
24c0: 20 20 20 20 20 20 20 20 27 6e 61 6d 65 27 3a 20          'name': 
24d0: 20 5b 22 42 55 4e 4e 59 2e 42 41 5c 72 22 2c 20   ["BUNNY.BA\r", 
24e0: 5b 5b 22 52 45 41 44 59 5c 72 5c 6e 24 22 2c 20  [["READY\r\n$", 
24f0: 27 72 75 6e 27 5d 5d 5d 0a 20 20 20 20 20 20 20  'run']]].       
2500: 20 27 72 75 6e 27 3a 20 20 20 5b 22 52 55 4e 5c   'run':   ["RUN\
2510: 72 22 2c 20 5b 0a 20 20 20 20 20 20 20 20 20 20  r", [.          
2520: 20 20 20 20 20 20 20 20 20 5b 22 2e 2a 42 55 4e           [".*BUN
2530: 4e 59 2e 2a 5c 72 5c 6e 52 45 41 44 59 5c 72 5c  NY.*\r\nREADY\r\
2540: 6e 24 22 2c 20 27 71 75 69 74 27 5d 2c 0a 20 20  n$", 'quit'],.  
2550: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
2560: 20 5b 22 5e 52 55 4e 2e 2a 22 2c 20 27 6b 69 63   ["^RUN.*", 'kic
2570: 6b 27 5d 0a 20 20 20 20 20 20 20 20 20 20 20 20  k'].            
2580: 20 20 20 20 20 5d 0a 20 20 20 20 20 20 20 20 5d       ].        ]
2590: 0a 20 20 20 20 20 20 20 20 27 6b 69 63 6b 27 3a  .        'kick':
25a0: 20 20 5b 22 5c 72 22 2c 20 5b 0a 20 20 20 20 20    ["\r", [.     
25b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 22                ["
25c0: 2e 2a 5c 72 5c 6e 52 45 41 44 59 5c 72 5c 6e 22  .*\r\nREADY\r\n"
25d0: 2c 20 27 71 75 69 74 27 5d 2c 0a 20 20 20 20 20  , 'quit'],.     
25e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 22                ["
25f0: 2e 2a 42 55 4e 4e 59 2e 2a 22 2c 20 27 6b 69 63  .*BUNNY.*", 'kic
2600: 6b 27 5d 0a 20 20 20 20 20 20 20 20 20 20 20 20  k'].            
2610: 20 20 20 20 20 5d 0a 20 20 20 20 20 20 20 20 5d       ].        ]
2620: 0a 20 20 20 20 20 20 20 20 27 71 75 69 74 27 3a  .        'quit':
2630: 20 20 5b 22 5c 78 30 33 22 2c 20 5b 5b 22 5c 6e    ["\x03", [["\n
2640: 5c 5c 2e 24 22 2c 20 27 73 75 63 63 65 73 73 27  \\.$", 'success'
2650: 5d 5d 5d 0a 0a 41 20 66 65 77 20 73 75 62 74 6c  ]]]..A few subtl
2660: 65 20 61 73 70 65 63 74 73 3a 0a 0a 20 2a 20 54  e aspects:.. * T
2670: 68 65 20 60 6b 69 63 6b 60 20 73 74 61 74 65 20  he `kick` state 
2680: 63 61 6e 20 6c 6f 6f 70 20 75 6e 74 69 6c 20 69  can loop until i
2690: 74 20 67 65 74 73 20 74 68 65 20 22 52 45 41 44  t gets the "READ
26a0: 59 22 20 73 69 67 6e 69 66 79 69 6e 67 20 74 68  Y" signifying th
26b0: 65 20 65 6e 64 20 6f 66 20 74 68 65 20 72 75 6e  e end of the run
26c0: 2e 0a 20 2a 20 54 68 65 20 74 65 73 74 20 66 6f  .. * The test fo
26d0: 72 20 22 52 45 41 44 59 5c 72 5c 6e 22 20 69 6e  r "READY\r\n" in
26e0: 20 74 68 65 20 60 72 75 6e 60 20 73 74 61 74 65   the `run` state
26f0: 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 64 65   contains the de
2700: 74 65 63 74 69 6f 6e 20 6f 66 20 65 6e 64 20 6f  tection of end o
2710: 66 20 73 74 72 69 6e 67 20 28 27 24 27 29 0a 20  f string ('$'). 
2720: 20 20 62 75 74 20 74 68 65 20 74 65 73 74 20 69    but the test i
2730: 6e 20 74 68 65 20 60 6b 69 63 6b 60 20 73 74 61  n the `kick` sta
2740: 74 65 20 64 6f 65 73 20 6e 6f 74 2c 20 62 65 63  te does not, bec
2750: 61 75 73 65 20 74 68 65 72 65 20 77 69 6c 6c 20  ause there will 
2760: 62 65 20 65 78 74 72 61 20 6e 65 77 6c 69 6e 65  be extra newline
2770: 73 2e 0a 20 2a 20 54 68 65 20 77 6f 72 6b 2d 61  s.. * The work-a
2780: 72 6f 75 6e 64 20 68 65 72 65 20 72 65 6c 69 65  round here relie
2790: 73 20 6f 6e 20 74 68 65 20 68 6f 70 65 20 74 68  s on the hope th
27a0: 61 74 20 74 68 65 72 65 27 6c 6c 20 62 65 20 61  at there'll be a
27b0: 20 73 74 72 69 6e 67 20 77 69 74 68 20 74 68 65   string with the
27c0: 20 77 68 6f 6c 65 20 77 6f 72 64 0a 20 20 20 22   whole word.   "
27d0: 42 55 4e 4e 59 22 20 69 6e 20 69 74 20 77 69 74  BUNNY" in it wit
27e0: 68 20 74 68 65 20 70 61 72 74 69 61 6c 20 72 65  h the partial re
27f0: 61 64 2e 0a 20 2a 20 4e 6f 74 65 20 74 68 61 74  ad.. * Note that
2800: 20 74 68 65 20 77 69 6c 64 20 63 61 72 64 20 6d   the wild card m
2810: 61 74 63 68 65 73 20 28 27 2e 2a 27 29 20 61 72  atches ('.*') ar
2820: 65 20 6e 6f 6e 2d 67 72 65 65 64 79 2c 20 61 6e  e non-greedy, an
2830: 64 20 6d 61 74 63 68 20 6f 6e 20 74 68 65 20 73  d match on the s
2840: 6d 61 6c 6c 65 73 74 20 73 75 63 63 65 73 73 2e  mallest success.
2850: 0a 20 20 20 54 68 61 74 27 73 20 77 68 79 20 74  .   That's why t
2860: 68 65 20 6c 6f 6e 67 65 73 74 20 6d 61 74 63 68  he longest match
2870: 20 66 6f 72 20 74 68 65 20 73 75 63 63 65 73 73   for the success
2880: 66 75 6c 20 72 75 6e 20 69 73 20 74 68 65 20 66  ful run is the f
2890: 69 72 73 74 20 74 65 73 74 20 74 6f 20 61 70 70  irst test to app
28a0: 6c 79 2e 0a 0a 5b 70 79 79 61 6d 6c 5d 3a 20 68  ly...[pyyaml]: h
28b0: 74 74 70 73 3a 2f 2f 70 79 79 61 6d 6c 2e 6f 72  ttps://pyyaml.or
28c0: 67 2f 77 69 6b 69 2f 50 79 59 41 4d 4c 44 6f 63  g/wiki/PyYAMLDoc
28d0: 75 6d 65 6e 74 61 74 69 6f 6e 0a 0a 23 23 23 20  umentation..### 
28e0: 3c 61 20 69 64 3d 22 6c 69 63 65 6e 73 65 22 3e  <a id="license">
28f0: 3c 2f 61 3e 4c 69 63 65 6e 73 65 0a 0a 43 6f 70  </a>License..Cop
2900: 79 72 69 67 68 74 20 c2 a9 20 32 30 32 30 20 62  yright © 2020 b
2910: 79 20 42 69 6c 6c 20 43 61 74 74 65 79 2e 20 4c  y Bill Cattey. L
2920: 69 63 65 6e 73 65 64 20 75 6e 64 65 72 20 74 68  icensed under th
2930: 65 20 74 65 72 6d 73 20 6f 66 20 5b 74 68 65 20  e terms of [the 
2940: 53 49 4d 48 20 6c 69 63 65 6e 73 65 5d 5b 73 6c  SIMH license][sl
2950: 5d 2e 0a 0a 5b 73 6c 5d 3a 20 68 74 74 70 73 3a  ]...[sl]: https:
2960: 2f 2f 74 61 6e 67 65 6e 74 73 6f 66 74 2e 63 6f  //tangentsoft.co
2970: 6d 2f 70 69 64 70 38 69 2f 64 6f 63 2f 74 72 75  m/pidp8i/doc/tru
2980: 6e 6b 2f 53 49 4d 48 2d 4c 49 43 45 4e 53 45 2e  nk/SIMH-LICENSE.
2990: 6d 64 0a                                         md.