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

Reduction Algorithm

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

t/SMOKE.PL

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

AUTHOR

132       Stas Bekman
133
134
135
136perl v5.34.0                      2021-07-22              Apache::TestSmoke(3)
Impressum