Build/Tests

From The x3270 Wiki

New in 4.2 The x3270 suite includes a number of built-in tests to verify the integrity of the code.

POSIX

Prerequisites

The tools required to run the tests are:

python3
Needed for everything but the library tests. Modules that may not be part of a typical release include requests and pustil.
tightvncserver
Needed for x3270 tests on Linux.
openssl command-line tools
Needed for TLS tests.
xdotool
Needed for certain x3270 tests on Linux.

Makefile targets

The x3270 top-level Makefile supports running tests on POSIX code. (For cross-compiled Windows code, see below.)

Tests have been run successfully on Linux, macOS, Cygwin and Solaris. Other platforms may or may not work.

Tests targets include:

make test
Run all tests
make smoketest
Run smoke tests (rudimentary subset)
make unix-lib-test
Run library tests.
make program-test
Run tests for the specified program.

If you want to pass additional options to the Python unittest package such as -v, place these in the TESTOPTIONS variable. For example:

make test TESTOPTIONS=-v

On Linux, you can also run the tests under valgrind by setting the variable VALGRIND in the environment. For example:

VALGRIND=1 make test

Some tests require additional set-up which must be run as root; without it, they will be skipped. Set-up instructions are displayed as part of the verbose test output when those tests are skipped.

Windows

All Windows tests require a Python 3 installation. The Python requests module is also required.

There is a Python script in the top-level directory called run_windows_tests.py. If the environment indicates that the script is being run from a Visual Studio command prompt, it will assume that Visual Studio should be used to build the code. Otherwise it assumes that the MINGW tools are being used.

Note that if the script is run under Cygwin, a native Windows copy of Python must be used, not the Cygwin version.

The script takes several command-line options, plus a list of tests to run. The options are:

-v
Display verbose information about each test.
-nobuild
Do not rebuild the code.

The test list can include s3270, b3270, wc3270 and lib.

Some tests require additional set-up which must be run while elevated; without it, they will be skipped. Set-up instructions are displayed as part of the verbose test output when those tests are skipped.