1Apache::TestSmoke(3)  User Contributed Perl Documentation Apache::TestSmoke(3)
2
3
4

NAME

6       Apache::TestSmoke - Special Tests Sequence Failure Finder
7

SYNOPSIS

9         # get the usage and the default values
10         % t/SMOKE -help
11
12         # repeat all tests 5 times and try 20 random iterations
13         # and save the report into the file 'myreport'
14         % t/SMOKE -times=5 -iterations=20 -report=myreport
15
16         # run all tests default number of iterations, and repeat tests
17         # default number of times
18         % t/SMOKE
19
20         # same as above but work only the specified tests
21         % t/SMOKE foo/bar foo/tar
22
23         # run once a sequence of tests in a non-random mode
24         # e.g. when trying to reduce a known long sequence that fails
25         % t/SMOKE -order=rotate -times=1 foo/bar foo/tar
26
27         # show me each currently running test
28         # it's not the same as running the tests in the verbose mode
29         % t/SMOKE -verbose
30
31         # run t/TEST, but show any problems after *each* tests is run
32         # useful for bug reports (it actually runs t/TEST -start, then
33         # t/TEST -run for each test separately and finally t/TEST -stop
34         % t/SMOKE -bug_mode
35
36         # now read the created report file
37

DESCRIPTION

39       The Problem
40
41       When we try to test a stateless machine (i.e. all tests are indepen‐
42       dent), running all tests once ensures that all tested things properly
43       work. However when a state machine is tested (i.e. where a run of one
44       test may influence another test) it's not enough to run all the tests
45       once to know that the tested features actually work. It's quite possi‐
46       ble that if the same tests are run in a different order and/or repeated
47       a few times, some tests may fail.  This usually happens when some tests
48       don't restore the system under test to its pristine state at the end of
49       the run, which may influence other tests which rely on the fact that
50       they start on pristine state, when in fact it's not true anymore. In
51       fact it's possible that a single test may fail when run twice or three
52       times in a sequence.
53
54       The Solution
55
56       To reduce the possibility of such dependency errors, it's helpful to
57       run random testing repeated many times with many different srand seeds.
58       Of course if no failures get spotted that doesn't mean that there are
59       no tests inter-dependencies, which may cause a failure in production.
60       But random testing definitely helps to spot many problems and can give
61       better test coverage.
62
63       Resolving Sequence Problems
64
65       When this kind of testing is used and a failure is detected there are
66       two problems:
67
68       1   First is to be able to reproduce the problem so if we think we
69           fixed it, we could verify the fix. This one is easy, just remember
70           the sequence of tests run till the failed test and rerun the same
71           sequence once again after the problem has been fixed.
72
73       2   Second is to be able to understand the cause of the problem. If
74           during the random test the failure has happened after running 400
75           tests, how can we possibly know which previously running tests has
76           caused to the failure of the test 401. Chances are that most of the
77           tests were clean and don't have inter-dependency problem. Therefore
78           it'd be very helpful if we could reduce the long sequence to a min‐
79           imum. Preferably 1 or 2 tests. That's when we can try to understand
80           the cause of the detected problem.
81
82       This utility attempts to solve both problems, and at the end of each
83       iteration print a minimal sequence of tests causing to a failure. This
84       doesn't always succeed, but works in many cases.
85
86       This utility:
87
88       1   Runs the tests randomly until the first failure is detected. Or
89           non-randomly if the option -order is set to repeat or rotate.
90
91       2   Then it tries to reduce that sequence of tests to a minimum, and
92           this sequence still causes to the same failure.
93
94       3   (XXX: todo): then it reruns the minimal sequence in the verbose
95           mode and saves the output.
96
97       4   It reports all the successful reductions as it goes to STDOUT and
98           report file of the format: smoke-report-<date>.txt.
99
100           In addition the systems build parameters are logged into the report
101           file, so the detected problems could be reproduced.
102
103       5   Goto 1 and run again using a new random seed, which potentially
104           should detect different failures.
105

Reduction Algorithm

107       Currently for each reduction path, the following reduction algorithms
108       get applied:
109
110       1   Binary search: first try the upper half then the lower.
111
112       2   Random window: randomize the left item, then the right item and
113           return the items between these two points.
114

t/SMOKE.PL

116       t/SMOKE.PL is driving this module, if you don't have it, create it:
117
118         #!perl
119
120         use strict;
121         use warnings FATAL => 'all';
122
123         use FindBin;
124         use lib "$FindBin::Bin/../Apache-Test/lib";
125         use lib "$FindBin::Bin/../lib";
126
127         use Apache::TestSmoke ();
128
129         Apache::TestSmoke->new(@ARGV)->run;
130
131       usually Makefile.PL converts it into t/SMOKE while adjusting the perl
132       path, but you create t/SMOKE in first place as well.
133

AUTHOR

135       Stas Bekman
136
137
138
139perl v5.8.8                       2006-11-19              Apache::TestSmoke(3)
Impressum