README 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. This directory contains shell scripts used as tests for Info. They are
  2. listed in "info/Makefile.am" and will usually be run with "make check".
  3. It should be possible to run a test on its own by running it at the
  4. command line and checking the return value, e.g.
  5. bash $t/goto-quoted.sh
  6. bash $echo $?
  7. 1
  8. shows a test failure.
  9. The tests fall into two categories: tests of non-interactive and
  10. interactive operation.
  11. New tests can be created by copying existing ones. Each test should
  12. start with the lines
  13. srcdir=${srcdir:-.}
  14. . $srcdir/t/Init-test.inc
  15. to allow running at the command line, or with either an in-source or
  16. out-of-source build with "make check". Tests of interactive operation
  17. should follow with the line.
  18. . $t/Init-inter.inc
  19. Any interactive test should also finish with
  20. . $t/Cleanup.inc
  21. to cleanup temporary files and spawned processes. This shell snippet
  22. will exit with whatever the value of RETVAL is, so you can set the
  23. exit status of the script indicating success or failure.
  24. Tests of interactive operation
  25. ------------------------------
  26. These use the "pseudotty" program in the info subdirectory, which
  27. creates a pseudo-terminal for the input and output of the program.
  28. This allows the program to happily enter interactive operation (its standard
  29. file descriptors pass the isatty library function) and avoids affecting
  30. the output of the terminal the test was invoked from. pseudotty reads and
  31. discards all input on its stdin, and passes through any bytes read on
  32. its control channel into the pseudo-terminal. It prints the name of the
  33. pseudoterminal slave device on standard output.
  34. (test script)
  35. ^ |
  36. | `-control----> pseudotty (master) <---> (slave) stdin/stdout ginfo
  37. `-name of slave-----'
  38. pseudotty will stop running either when killed, or when it exits after
  39. its control channel is closed.
  40. Since ginfo is reading to and writing from the pseudoterminal slave
  41. device, if pseudotty exits before ginfo does, ginfo will exit with an
  42. I/O error.
  43. Many of the tests of interactive operation try to position the cursor
  44. on a cross-reference by various means, follow the reference, and dump the node
  45. reached to a file. (It can be compared with a target file in
  46. info/t/node-target, to check that we ended up where we thought we would.)