SuperTest on Windows

USING SUPERTEST ON MICROSOFT WINDOWS

The SuperTest tools require a POSIX environment to run in. All X-nix derived systems (Linux, BSD, macOS, Solaris) provide this, but Microsoft Windows is not POSIX compatible out of the box. There are several ways to add POSIX compatibility to Windows and you are free to use any of them. Solid Sands has selected Cygwin to provide the POSIX interface and Solid Sands makes sure that SuperTest runs on Cygwin without problems and with full support.

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, and ‘perl’.
  • From the directory Utils, select ‘gnupg’. 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.