SuperTest on Windows

USING POSIX SUPERTEST ON MICROSOFT WINDOWS

SuperTest is available in two versions: a native Windows version and a POSIX version. The native Windows version of SuperTest runs on 64-bit Windows 10 or higher and is installed like any other Windows application. The POSIX version of SuperTest can also be installed on a Windows system using a Windows POSIX interface. There are several ways to add POSIX compatibility to Windows and you are free to use any of them. On this page, we explain how the POSIX version of SuperTest can be used with the POSIX interface provided by Cygwin.

First of all, what is POSIX and why use it? POSIX is an ISO standardized system interface. It defines command line tools and programmer interfaces to the Operating System. It also defines the interface to the file system, such as the convention to use the forward slash (‘/‘) as a separator in directory paths, and a single new-line character (‘\n‘) as a separator between lines in a text file. For these and other reasons, Windows is not compatible with POSIX. The good thing of POSIX is that it is available out-of-the-box on almost every development platform other than Windows and so it is an obvious choice for the tools to run on. Furthermore, with a little help from Cygwin, SuperTest can run on Windows too. Thus, it is also easy to have a test setup that includes both Linux and Windows compiler host environments and have them share interface and configuration files.

CYGWIN IS LIGHTWEIGHT

The most important thing about Cygwin is to understand that it does not make modifications to the Windows system on which it is installed. The Cygwin installation files are all in a separate directory, which can be removed at any time to remove Cygwin. Cygwin does add one DLL-library file to the Windows system. This DLL contains the API (interface) that translates from POSIX to the underlying Windows system interface. It makes it possible to compile a program written for POSIX and run it on Windows. At run-time, the program links to the DLL to get the API translation. No native Windows programs use this DLL, so their behavior is unchanged.

Another important aspect is that Cygwin programs (those that link against the DLL) run fine side by side with Windows programs. Windows programs can be called from the Cygwin command line shell, and Cygwin programs can be called from the DOS prompt. Environment variables set in the Cygwin shell are exported to Windows programs. This is important when modifying SuperTest’s ‘compscript’ and ‘runscript’ in the Cygwin environment. These SuperTest script can call a Windows native compiler without problem.

Furthermore, Cygwin does not modify the Windows file system, although it does present a different view of the file system. On the Cygwin side, it appears as if the file-system has a top-level directory slash (‘/‘). A number of typical POSIX directories, like ‘/bin‘, can be found there. The Windows top-level drives can be found in ‘/cygdrive’. For example, the
standard system drive ‘C:’ is named ‘/cygdrive/c/‘. Similarly, the Cygwin file system can be found in the directory ‘C:\cygwin64‘ (assuming the default install directory for Cygwin). So, Cygwin’s home directory named ‘/home/‘, is ‘C:\cygwin64\home‘ in Windows.

Cygwin has a command line tool called ‘cygpath’, which translates paths from the Windows conventions to the POSIX conventions. In typical X-nix style, you can view its options with ‘man cygpath’ from Cygwin’s command line shell. Note that of course it can also be called from Windows, provided its path is in the PATH variable of Windows.

INSTALLING CYGWIN

Cygwin comes in two flavors, 32 and 64-bit. Either will work with SuperTest. When compiling programs with a Cygwin native compiler, notice that the 64-bit data-model has a ‘long’ type of 64-bits (so pointers can be stored in ‘long’ variables), which is unlike Windows but common in other 64-bit systems.

Downloading Cygwin results only in the Cygwin installer. It does not include the Cygwin packages – these are downloaded on-demand during the installation process. It is useful to keep the installer after the initial install because it is also used to install additional packages when needed, and to update existing packages.

The installation will ask for the installation root directory, the package download directory (the defaults work fine for these) and the download site (choose one nearby for fastest package downloads). It will then enter the package selector, which is used to add optional packages on top of Cygwin’s core packages. Do not try to install everything: it will take a long time and use a lot of space. For SuperTest, search for and install the following packages:

  • From the directory Devel, select ‘gcc-core’.
  • From the directory Devel, select ‘make’.
  • From the directory Devel, select ‘bison’.
  • From the directory Perl, select ‘perl’.
  • From the directory Python, select ‘python3’.
  • From the directory Utils, select ‘gnupg’.

In the image above, you can see an example of the package selector. By typing ‘gcc-core‘ in the search box, expanding the directory Devel and clicking ‘Skip’ on the left, the latest version of the package is selected for installation.

Note, on some OS/Hardware combinations, installing the ‘gnupg‘ package will provide a totally unhelpful error message related to ‘libusb0‘, asking to install a driver. Do not attempt to install the driver, it will fail. Instead, skip the installation of the package ‘gnupg‘. Gnupg is only used to decript the SuperTest distribution package. Instead, locate a native Gnupg software package and use that to decrypt SuperTest.

At the end, the installer asks if it should make the usual application shortcuts for the command line tool.

USING CYGWIN WITH SUPERTEST

Cygwin is typically used from its command line tool, which provides a POSIX shell and from which Cygwin’s command line tools are available. Note that Cygwin does not require to use the command line tool but for SuperTest it is the appropriate entry point. Cygwin’s applications such as the C-compiler ‘cc‘ can also be used directly from Windows, for example from the DOS command line. Similarly, Windows’ utilities can be used in the Cygwin shell too. Do note that Cygwin’s tools use the POSIX new-line convention for text file I/O, which is different from Windows’.

From within Cygwin’s command line tool, using SuperTest is straightforward. From there, follow the standard SuperTest documentation.