SuperTest on Windows 10
USING POSIX SUPERTEST ON MICROSOFT WINDOWS 10
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 7 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 Windows Subsystem for Linux.
With the Windows 10 version 1607 update, the Windows Subsystem for Linux (WSL) was introduced. The WSL provides users with a Linux command line shell, which allows users to run programs that are compiled for a Linux distribution on a Windows 10 machine. This is done by placing unmodified Linux binaries in so-called pico processes that enable Linux system calls to be directed into the Windows kernel. In other words, Linux system calls are translated and emulated to be used with the Windows kernel. More information on how the Windows Subsystem for Linux works can be found in this Microsoft blog post.
From the Microsoft store several Linux distributions, such as Ubuntu, can be installed to use on the WSL. After installing, a bash command line shell can be used to execute programs through the Linux environment. Besides software compiled for the selected Linux distribution, also programs that are installed on the Windows 10 host machine can be executed through this command line shell. This way, a compiler installed on the Windows host can be used in combination with the SuperTest tools that require the POSIX environment that the Linux distribution provides.
The WSL does not modify the Windows file system, although it does present a different view of the file system. On the WSL 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 ‘/mnt’. For example, the standard system drive ‘C:‘ is named ‘/mnt/c‘. Similarly, on Windows the WSL file system can be found in the directory ‘C:\Users\NAME\AppData\Local\Packages\DIST‘, where ‘DIST‘ depends on the Linux distribution that is installed onto the WSL.
Below, installation and usage instructions to run SuperTest on Windows 10 through the WSL are provided. For these instructions, Ubuntu is our Linux distribution of choice to install onto the WSL.
INSTALLING UBUNTU ONTO THE WINDOWS SUBSYSTEM FOR LINUX
By default, the WSL is disabled on Windows 10. To be able to use it, it needs to be enabled through the Windows Powershell by executing the following command:
- Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Next, the Ubuntu distribution can be installed onto the WSL. This can be done by launching Microsoft Store, searching for Ubuntu and clicking the install button. After installation, the Ubuntu application can be launched to open the bash command line shell. At first launch, the shell will prompt you to select a username and password of choice. After doing this, the Ubuntu environment is ready to use.
USING SUPERTEST ON THE WINDOWS SUBSYSTEM FOR LINUX
Before SuperTest can be executed through the bash command line shell, ‘make‘, ‘gcc‘ and ‘bison‘ need to be installed. This can be done using Ubuntu’s package manager ‘apt‘ by executing the following commands through the bash command line shell:
- sudo apt update
- sudo apt install make gcc bison perl
After installing these packages, the WSL is ready to be used with SuperTest. To use SuperTest, navigate the command line shell to location of the SuperTest folder on your Windows system. For example, if on Windows the folder is located at ‘C:\SuperTestVersion\SuperTest‘, this is done using the following command:
- cd /mnt/c/SuperTestVersion/SuperTest
From there, you can follow the standard SuperTest for POSIX documentation to install and use SuperTest through the bash command line shell.
Note that to configure your compiler of use, you need to set the path to the compiler using the ‘/mnt/‘ format. For example, if on Windows the compiler is located at ‘C:\MinGW\bin\gcc.exe‘, the path should be configured as ‘/mnt/c/MinGW/bin/gcc.exe‘.
It is also important to note that Windows compilers usually generate executable files with a ‘.exe‘ file extension, while by default SuperTest expects executables to be generated without a file extension. This can be solved by adding the following line below line 44 and below line 48 in the default ‘compscript‘ file in the SuperTest ‘target‘ folder:
- mv “$BASENAME”.exe “$BASENAME”