Skip to main content

Back to Back Testing tool

Project description

Installation

pip install pnu-b2bt

B2BT(1)

NAME

b2bt - back-to-back testing

SYNOPSIS

b2bt [-f|--force] [-k|--keep] [-n|--newpath PATH] [-o|--origpath PATH] [-q|--quiet] [-s|--skip] [-t|--timeout VALUE] [-y|--autoconfirm] [-N|--nocolors] [--debug] [--help|-?] [--version] [--] filename [...]

DESCRIPTION

The b2bt utility aims to automate:

  • back-to-back testing (testing a command-line utility against another implementation)
  • non regression testing (testing a command-line utility against a previous version)

It processes one or more XML files describing the test suite for a command-line utility, with its different test cases, execute the 2 commands versions and report potential differences (on return codes, standard output, standard error output, plus custom post processing output in order to check other kind of impacts, on file systems, execution time, etc.).

In a test suite it is possible to specify:

  • optional shell commands to execute before the test, typically to setup the test environment in an automatically generated test sub directory
  • optional standard input to be injected in the command tested
  • mandatory one line shell command-line for the command to be tested
  • optional shell commands to execute after the test, typically to analyze the tested command impact on the test environment. The output of these "post" commands is captured before automatic removal of the test sub directory

Each test case can have a name and a potential timeout (in seconds or fraction of seconds).

By defaut, this utility:

  • executes the original command, unless you use the -s option to skip it (useful when you are testing the new command on another system);
  • executes the original command from the PATH, unless you use the -o option to specify another location;
  • uses a 120.0 s timeout for commands execution, unless you use the -t option to modify it;
  • discards the test results after each comparison, unless you use the -k option to keep them;
  • details the differences between the 2 commands runs, unless you use the -q option to limit it;
  • does not execute again tests when you have kept previous results, unless you use the -f option to overwrite them;
  • asks for confirmation before each test case execution, unless you use the -y option to auto confirm them;
  • uses ANSI colours in the output, unless you use the -N option to disable it;
  • does not execute the new command if it has the same MD5 digest than the original one.

The new command location has to be specified with the -n option if you want a comparison to occur.

OPTIONS

Options Use
-f|--force Overwrite results directories
-k|--keep Keep results directories after running
-n|--newpath PATH Path of the new command
-o|--origpath PATH Path of the original command if not in $PATH
-q|--quiet Don't detail run differences
-s|--skip Skip original command processing
-t|--timeout VALUE Set default timeout (120.0 s) to a new value, with a 30.0 s minimum
-y|--autoconfirm Don't ask for confirmation before test case execution
-N|--nocolors Don't use colors in output
--debug Enable debug mode
--help|-? Print usage and a short help message and exit
--version Print version and exit
-- Options processing terminator

ENVIRONMENT

The B2BT_OPTIONS environment variable can be set with a combination of the following command-line options letters:

  • f in order to overwrite results directories if they exist
  • k in order to keep results directories after running
  • q in order to disable details in run differences
  • s in order to skip original command processing
  • y in order to answer yes to all confirmation requests
  • N in order to disable colors in output

The B2BT_DEBUG environment variable can also be set to any value to enable debug mode.

These 2 environment variables are superseded by command line options.

FILES

The format of the XML files processed is described in the b2bt(5) manual page.

EXIT STATUS

The b2bt utility exits 0 on success, and >0 if an error occurs.

SEE ALSO

b2bt(5), what(1), ident(1)

STANDARDS

The b2bt utility is not a standard UNIX/POSIX command.

It tries to follow the PEP 8 style guide for Python code.

PORTABILITY

To be tested under Windows.

HISTORY

This utility was made for The PNU project / PyNIX in order to test the rewritten commands against the installed ones.

LICENSE

This utility is available under the 3-clause BSD license.

AUTHORS

Hubert Tournier

CAVEATS

If you are comparing commands execution across operating systems, for example between Unix-like and Windows systems, the output might be different due to the path separators ("/" versus "\").

Comparing timeout interrupted commands output is hazardous...

SECURITY CONSIDERATIONS

This utility processes XML files describing commands to be shell executed on your system. If you are not the author of a test suite or are using an untrusted source, this can be dangerous!

To mitigate the risks, the utility will:

  • Warn you if you are using a privileged account and advise you not to do so.
  • Show you every command to be executed and ask for prior confirmation.

We also use the standard Python xml.dom.minidom library which is known to be vulnerable to several XML attacks.

Visual inspection of the XML files to process is recommended, and useful anyway if you are rewriting an existing command.

The program is using MD5 file digests but not for security purposes. It is also calling the what(1) and ident(1) commands from their PATH location, if they are available, assuming system directories precede user directories in the PATH.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pnu_b2bt-1.0.0.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

pnu_b2bt-1.0.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file pnu_b2bt-1.0.0.tar.gz.

File metadata

  • Download URL: pnu_b2bt-1.0.0.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for pnu_b2bt-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0daa1e758536a3025d0d7bf413616880e8ecb88d2ee1fedfe794587606405a0f
MD5 a396f26c1c67ea7a046068181ab528ce
BLAKE2b-256 346e87c546586e3e9864cfd131d0aa8ef366c0d8644ae16fda860ea0f13c1965

See more details on using hashes here.

File details

Details for the file pnu_b2bt-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pnu_b2bt-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for pnu_b2bt-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 570acf523591f879fe04e8b64021cf4a2e068dcc701accb65ee40327f52d36c8
MD5 4253e16090a8f6bdda009b51aa6ef234
BLAKE2b-256 7fa5e8a5be5b815b50cb9d03eb6b2cfc5c72849586119aa274b46c5e696ae808

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page