Apache...stSmoke(3pm)

✨ NAME ✨

Apache::TestSmoke β€” the special-tests-sequence failure finder πŸ’… (yes bestie, this is the Apache...stSmoke(3pm) page, we're just making it cute)


🌸 SYNOPSIS 🌸

# get the usage and the default values
% t/SMOKE -help

# repeat all tests 5 times and save the report into
# the file 'myreport'
% t/SMOKE -times=5 -report=myreport

# run all tests default number of iterations, and repeat tests
# default number of times
% t/SMOKE

# same as above but work only the specified tests
% t/SMOKE foo/bar foo/tar

# run once a sequence of tests in a non-random mode
# e.g. when trying to reduce a known long sequence that fails
% t/SMOKE -order=rotate -times=1 foo/bar foo/tar

# show me each currently running test
# it's not the same as running the tests in the verbose mode
% t/SMOKE -verbose

# run t/TEST, but show any problems after *each* tests is run
# useful for bug reports (it actually runs t/TEST -start, then
# t/TEST -run for each test separately and finally t/TEST -stop
% t/SMOKE -bug_mode

# now read the created report file

okay so literally just vibes and t/SMOKE commands, we love to see it 🫢


πŸ’– DESCRIPTION πŸ’–

🧨 The Problem

So here's the tea πŸ“. When you're testing a stateless machine (aka where all the tests are independent, no cap), running all the tests one time is enough to feel confident that everything tested actually works. Iconic. Simple. Beautiful.

But the second you're testing a state machine β€” meaning one test's run can influence another test β€” running everything once is not enough to know the features actually work 😭. It's lowkey very possible that if you run the same tests in a different order and/or repeat them a few times, some tests straight-up fail.

This usually happens when some tests don't restore the system under test back to its pristine state when they're done, which then influences other tests that are out there relying on starting from pristine state β€” when fr fr it's not pristine anymore πŸ’€. And yeah, it's genuinely possible that a single test fails when it's run twice or three times in a sequence. Not the vibe.

πŸ›  The Solution

To reduce the possibility of these dependency errors (the way that tests just betray each other 😩), it's helpful to run random testing, repeated many times, with many different srand seeds ✨.

And before you come for me β€” of course, if no failures get spotted, that doesn't mean there are no test inter-dependencies that could cause a failure in production. Bestie, it just means nothing got caught this round πŸ™ˆ. But random testing definitely helps spot many problems, and it can give better test coverage. Periodt.

πŸŽ€ Resolving Sequence Problems

When this kind of testing is used and a failure gets detected, there are two problems, and they're not the fun kind:

  1. First is being able to reproduce the problem, so if we think we fixed it, we can verify the fix. This one's easy β€” just remember the sequence of tests run up until the failed test, and rerun the same sequence once again after the problem has been fixed. Slay.
  2. Second is being able to understand the cause of the problem. If during the random test the failure happened after running 400 tests, how on earth can we know which previously running test caused the failure of test 401?? Chances are most of those tests were clean and have zero inter-dependency problems. So it would be very helpful if we could reduce that long sequence down to a minimum β€” preferably 1 or 2 tests. That's when we can actually try to understand the cause of the detected problem πŸ’….

This utility attempts to solve both problems, and at the end of each iteration it prints a minimal sequence of tests causing a failure. This doesn't always succeed, but it works in many cases. Iconic behaviour honestly πŸ‘‘

So here's what this utility does:

  1. Runs the tests randomly until the first failure is detected. Or non-randomly if the option -order is set to repeat or rotate.
  2. Then it tries to reduce that sequence of tests to a minimum, and this sequence still causes the same failure.
  3. (XXX: todo): then it reruns the minimal sequence in the verbose mode and saves the output.
  4. It reports all the successful reductions as it goes to STDOUT and report file of the format: smoke-report-<date>.txt.

In addition the systems build parameters are logged into the report file, so the detected problems could be reproduced.

  1. Goto 1 and run again using a new random seed, which potentially should detect different failures.

πŸ¦‹ Reduction Algorithm

Currently for each reduction path, the following reduction algorithms get applied ✨:

  1. Binary search: first try the upper half then the lower.
  2. Random window: randomize the left item, then the right item and return the items between these two points.

🌈 t/SMOKE.PL 🌈

t/SMOKE.PL is driving this module, if you don't have it, create it:

#!perl

use strict;
use warnings FATAL => 'all';

use FindBin;
use lib "$FindBin::Bin/../Apache-Test/lib";
use lib "$FindBin::Bin/../lib";

use Apache::TestSmoke ();

Apache::TestSmoke->new(@ARGV)->run;

usually Makefile.PL converts it into t/SMOKE while adjusting the perl path, but you create t/SMOKE in first place as well 🧚


πŸ‘‘ AUTHOR πŸ‘‘

Stas Bekman


and that's the whole page, bestie πŸ’œ this is perl v5.42.3, dated 2026-08-20, and it came from the User Contributed Perl Documentation for Apache::TestSmoke β€” go run some smoke tests and eat πŸ“

πŸ“¦ where this page comes from