http://invisible-island.net/
Copyright © 1996-2022,2023 by Thomas E. Dickey


VTTEST – VT100/VT220/XTerm test utility

Synopsis

Vttest tests the compatibility (demonstrates the non-compatibility) of so-called “VT100-compatible” terminals. In conformance of the good old hacker traditions, the only documentation of this program is the source code itself. To understand it, you also need a copy of the original VT100 manual from DEC.

Additional tests (past version 1.7) are provided for analysis of vt220 through vt520 terminals, as well as variants of xterm.

History

Vttest was written in 1983-1985 by Per Lindberg at the Stockholm University Computing Center. The last version was 1.7b (1985-04-19). Per Lindberg later distributed 1.7b via the Usenet mod.sources group (Volume 7, Issue 16, September 2, 1986). It became an established part of the Unix source archives, e.g,. as noted in these postings from 1988.

I began this version in May 1996 (starting with 1.7b) to support changes that I am making to xterm. The program has grown from about 2400 lines to more than 18,000 lines of code. See the changelog for details.

I changed the version number to 2.0 in the initial release, in 1996, and went up to 2.7 shortly after. Since then, the patch-date is the effective version number.

Most of my visible changes are via two menu entries at the bottom of the main screen:

Main menu of VTTEST

However, I restructured the entire program, adding screens to existing tests, and menu entries (for instance in the terminal reports). In the restructured program, it is much simpler to add menu entries, since they are built from tables rather than case statements.

On the other hand, I kept the overall indentation style of the program. There are no tab characters.

Color

VT100's never did color.

My original motivation for working on vttest was to provide a way to test the color changes I was making for xterm. Drawing colored text is straightforward. Drawing colored backgrounds presents many choices. For instance:

None of those choices are automatically "right" or "wrong". Designers of different terminals (and emulators) have chosen to implement color in different ways.

For xterm, I chose to match the Linux console behavior. That was a starting point. But (see below) I continued past this point, implementing features from VT220 and later, including controls (DECSCA) that can protect against erasure.

The particular erasure choices used in xterm and Linux console are modeled in ncurses as the back color erase (bce) feature. Early on, we (I and Alexander V. Lukyanov) found that the bce feature was nowhere defined precisely, and settled on the current behavior. Other terminals (such as rxvt) do not exactly match this set of choices, so controls which differ are not in the corresponding terminal description.

I added screens to vttest to illustrate the bce behavior, helping to ensure consistency.

For instance, this was once of the earlier screens I wrote to demonstrate and test erases against the bce color model:

BCE Test – Before BCE Test – After
Before Erase After Erase

The terminal also has to fill color properly for double-sized characters. Here are examples with and without font support for double-sized characters:

Color – With scaled fonts Color – Without scaled fonts
Using scaled fonts Without scaled fonts

Even Linux console has had occasional issues, where it is inconsistent, e.g., a blunder in 2008 as reported on the Linux kernel mailing list here by Alexander V. Lukyanov. The problem was introduced here, and broke the bce feature of Linux console for several months. Vttest might have been useful in that case.

Character Sets

Double-sized characters required some work on xterm. Initially, it only drew normal sized characters with spaces in between (and there were a few issues to resolve). Xterm now draws double-sized characters using scaled fonts (a feature introduced by XFree86). Here is an example from the VT100 tests:

VT100 Double-sized Character Test

After I had been working on vttest for a while, I realized that xterm had features (other than the obvious case of function keys) that were not found in a VT100. These control sequences switch to a different character set for just one character (a single shift) or until undone (locking shifts). The VT100 line-drawing characters are a special case of the latter.

The set of single- and locking-shifts are features of the more advanced VT220 terminal. Seeing that, and understanding that it would allow xterm to be more useful to people around the world, I decided to fill in the missing pieces to make a workable VT220 emulator. Years later, of course, UTF-8 became a more valued feature. But I use different programs than vttest for testing xterm's UTF-8 support.

Some of the features (in particular the character sets) are visible only when the terminal identifies itself as a VT220 or above. For instance, the top-level menu "Test of character sets" shows only the VT100 character sets for VT100s:

VT100 Character Sets

But for VT220s (e.g., xterm with the command line option "-ti 220"), vttest shows a menu, with the VT100 character sets as an option:

Character Set Choices Above VT100

VT220s provide something like ISO-2022 support for several European encodings. Here is an example using the locking shifts, showing French and Italian:

Example of VT220 Locking Shifts

Incidentally, the VT220 and up can be switched into a mode where they identify themselves as lower-level models (analogous to the VT100/VT52 switching). You can do this in vttest using menu 12:

Menu for Modifying Test Parameters

The Linux console used to recognize 8-bit controls. I gave advice to Albert Cahalan (see links), who used vttest to identify and repair most issues. However, later work to change the console driver to support UTF-8 broke that, though comments in the code still claimed that the feature was supported. Early in 2006, I submitted changes which were applied to the console_codes manpage, including the BUGS section. This paragraph is pertinent:

    Some  older  kernel  versions  (after  2.0)  interpret  8-bit   control
    sequences.   These  "C1  controls"  use  codes  between  128 and 159 to
    replace ESC [, ESC ] and similar two-byte control sequence  initiators.
    There  are  fragments  of  that in modern kernels (either overlooked or
    broken by changes to support UTF-8), but the implementation  is  incom-
    plete and should be regarded as unreliable.

VT220 and Beyond

DEC's terminals were all upward-compatible:

Each model also provides more new features than the total in its predecessor. Not all features are useful for a terminal emulation (such as the dual-session feature of VT420). I have implemented tests for the features which either are in xterm, or are simple extensions (such as the variations on status responses).

Vttest organizes these according to the terminal type. Features found in ISO 6429 but not in a particular DEC terminal are via separate menu choices from XTERM and the VTxxx flavors:

Menu for non-VT100 Tests

Early on, I found that ECH (erase character) is a VT220 feature rather than VT102. It is perhaps the most commonly implemented extension of “VT100 emulators”.

Test for ECH (monochrome)

As it is implemented in rxvt (unlike xterm and Linux console) it does not behave the same with regard to color as ED (erase display). After some discussion, it was determined that

For example, I recall using more than one terminal emulator with “VT340” and color, for instance TNVTPlus (developed by FTP Software, Inc.). That, by the way, differed from xterm regarding the way color was set when scrolling in "blank lines". There are as noted several choices, and none are blessed by an official standard. Vttest demonstrates the set of choices used in xterm and Linux console.

Xterm implements several features from models past VT220. One of the more interesting is the ability to work with rectangles on the screen (from VT420). That is (both in vttest and xterm) only provided when the terminal identifies itself as (at least) a VT420:

Menu shown as a VT100 Menu shown as a VT420
As a VT100 As a VT420

Given the proper configuration, vttest shows rectangles. As an extension, xterm supports color:

Rectangle example (monochrome) Rectangle example (color)
Monochrome Color (XTerm)

ISO 6429 Features

ISO 6429 has several features (including scrolling not implemented by DEC terminals). The most useful set of tests is the color menu:

Menu for ISO 6429 Color Tests

XTerm Features

Tests for XTerm

The window modify- and report-operations attributed to dtterm (because that was the only extant usage in 1996) had appeared in the X10 "6.6b" version xterm. Like its successors through X11R6, there is no changelog, so it was not possible to determine when/where the features originated. But they predate dtterm. Some additional information is given in XTerm Control Sequences.

Licensing

The original distribution of vttest used licensing terms which were problematic ("noncommercial"), e.g., for the Debian packagers:

                   This software is (c) 1984 by QZ
               Non-commercial use and copying allowed.

If you are developing a commercial product, and use this program to do
it, and that product is successful, please send a sum of money of your
choice to the address below.
  

I contacted Per Lindberg in 2007, and suggested that it be changed to a BSD license. He agreed. My changes have always been compatible with that.

Documentation


Screenshots

Here are additional screenshots.

Download

There are numerous references on the net to vttest. Here are a few of the more interesting ones:

The System Under Test page only skims the surface of testing a terminal.

These are tools which others have developed: