summaryrefslogtreecommitdiff
path: root/tests/README
blob: f1b9ba0cd7e0c81ea7c777636f67825f6e41ea8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
This file describes the flex test suite.

* WHO SHOULD USE THE TEST SUITE?

The test suite is intended to be used by flex developers, i.e., anyone hacking
the flex distribution. If you are simply installing flex, then you can ignore
this directory and its contents.

* STRUCTURE OF THE TEST SUITE

The testsuite consists of several tests. Each test is centered around
a scanner known to work with the most recent version of flex. In
general, after you modify your copy of the flex distribution, you
should re-run the test suite. Some of the tests may require certain
tools to be available (e.g., bison, diff). If any test returns an
error or generates an error message, then your modifications *may*
have broken a feature of flex. At a minimum, you'll want to
investigate the failure and determine if it's truly significant.

* HOW TO RUN THE TEST SUITE

To build and execute all tests from the top level of the flex source tree:

  $ make check

To build and execute a single test:

  $ cd tests/ # from the top level of the flex tree.
  $ make testname.log

  where "testname" is the name of the test. This is an automake-ism
  that will create (or re-create, if need be), a log of the particular
  test run that you're working on.

* HOW TO ADD A NEW TEST TO THE TEST SUITE

** List your test in the TESTS variable in Makefile.am in this
   directory. Note that due to the large number of tests, we use
   variables to group similar tests together. This also helps with
   handling the automake test suite requirements. Hopefully your test
   can be listed in SIMPLE_TESTS. You'll need to add the appropriate
   automake _SOURCES variable as well. If you're unsure, then consult
   the automake manual, paying attention to the parallel test harness
   section.

** On success, your test should return zero.

** On error, your test should return 1 (one) and print a message to
stderr, which will have been redirected to the log file created by the
automake test suite harness.

** If your test is skipped (e.g., because bison was not found), then
   the test should return 77 (seventy-seven). This is the exit status that
   would be recognized by automake's "test-driver" as _skipped_.

** Once your work is done, submit a patch via the flex development
   mailing list, the github pull request mechanism or some other
   suitable means.