How To: Running OpenTAP's Community Edition editor (GUI) on Ubuntu 20.04

Recently I wanted to run the Community Edition of OpenTAP editor on Ubuntu 20.04. I did some digging and got it to work using WINE 7, which is a Windows emulation system that runs on Linux.

The following script will install the necessary bits on a clean Ubuntu 20.04 VM:

#!/bin/bash 

# enable 32-bit 
sudo dpkg --add-architecture i386 

# add key for wine packages 
sudo wget -nc -O /usr/share/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key 
# add wine packages to get wine 7 
sudo wget -nc -P /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/focal/winehq-focal.sources 
sudo apt update 

# install wine 
sudo apt install winehq-stable winetricks winbind -y  

# initiliaze the default wine environment (default prefix)
WINEDLLOVERRIDES=mscoree=d wineboot --init 

# download updated winetricks version 20220411 (includes Consolas font)
wget https://raw.githubusercontent.com/Winetricks/winetricks/20220411/src/winetricks
chmod +x winetricks

# install .NET 4.8 
./winetricks -q dotnet48 

# disable .NET CLR Optimization service, as it hangs occasionally
wine reg ADD "HKLM\\System\\CurrentControlSet\\Services\\clr_optimization_v4.0.30319_32" /v Start /t REG_DWORD /d 4 /f
wine reg ADD "HKLM\\System\\CurrentControlSet\\Services\\clr_optimization_v4.0.30319_64" /v Start /t REG_DWORD /d 4 /f

# install .NET 6 Desktop x86/x64
wget https://download.visualstudio.microsoft.com/download/pr/b4a17a47-2fe8-498d-b817-30ad2e23f413/00020402af25ba40990c6cc3db5cb270/windowsdesktop-runtime-6.0.8-win-x64.exe
wget https://download.visualstudio.microsoft.com/download/pr/61747fc6-7236-4d5e-85e5-a5df5f480f3a/02203594bf1331f0875aa6491419ffa1/windowsdesktop-runtime-6.0.8-win-x86.exe
wine ./windowsdesktop-runtime-6.0.8-win-x64.exe /install /quiet /norestart
wine ./windowsdesktop-runtime-6.0.8-win-x86.exe /install /quiet /norestart

# install fonts and directx
./winetricks -q corefonts dxvk155 d3dcompiler_47 consolas

# set the windows version to Windows 10 
winecfg /v win10 

# disable HW acceleration if running in a VM (PackageManager has issues) 
wine reg add "HKCU\\SOFTWARE\\Microsoft\\Avalon.Graphics" /v DisableHWAcceleration /t REG_DWORD /d 1 /f 

# download Windows OpenTAP 9.18.4 installer 
wget https://opentap.io/assets/releases/OpenTAP.9.18.4.exe 

# install OpenTAP 
touch ./log.txt
wine ./OpenTAP.9.18.4.exe --quiet --bitness x64 &

# wait for OpenTAP install to finish
tail -f ./log.txt | sed '/Installation completed/ q'
kill $(pidof OpenTAP.9.18.4.exe)

# accept the OpenTAP Editor Community Edition EULA programmatically
wine reg add "HKCU\\SOFTWARE\\Keysight\\Test Automation" /v "EULA Accept" /t REG_SZ /d "Alan Copeland<alan_copeland@keysight.com>" -f

# install Editor CE
wine ~/.wine/drive_c/Program\ Files/OpenTAP/tap.exe package install -y 'Editor CE'

# add aliases to make running OpenTAP easy outside of the script
echo alias tap=\'wine ~/.wine/drive_c/Program\\ Files/OpenTAP/tap.exe\' | tee -a ~/.bashrc
echo alias tapeditor=\'wine ~/.wine/drive_c/Program\\ Files/OpenTAP/editor.exe\' | tee -a ~/.bashrc

In order to make it simple to install, I also made a gist on github here:
https://gist.githubusercontent.com/alan-copeland-keysight/ad9db08e3b7549ea8051514dcc5d3fa4/raw/4d62338a401ffaa51f4ce29be43bd27f8b2d16c5/install.sh

To install the script, you can run the following commands:

wget -O install.sh https://gist.githubusercontent.com/alan-copeland-keysight/ad9db08e3b7549ea8051514dcc5d3fa4/raw/4d62338a401ffaa51f4ce29be43bd27f8b2d16c5/install.sh
chmod +x install.sh
./install.sh
# enter your sudo password

Then get some coffee, as it takes quite a while to install all the bits. Once its done, you can run the following commands:

# source your .bashrc to get these aliases:
source ~/.bashrc

# run the cli
tap

# run the Community Edition editor
tapeditor

And it runs .tapplan’s!

Under the hood, the Windows bits are installed in ~/.wine/drive_c/Program Files/OpenTAP/

Let me know if you have questions or think of tests I should run!

6 Likes

Crazy cool! Way to push the limits @alan_copeland. And then go beyond!

2 Likes

Sweet! Could you follow a similar process to get some of the instrument IO working? Or maybe using PyVISA-py?

Good ideas, I’ll try!

1 Like

The Windows version of the IO Libraries Suite installer is “complex” and fails on kernel driver installs, so it seems like its blocked at this point.

Python 3.7.9 can be installed with:

wget https://www.python.org/ftp/python/3.7.9/python-3.7.9-amd64.exe
wine ./python-3.7.9-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 
wine python --version

The OpenTAP plugin - Python 3.0.0-beta.34 seems to work ok.

Set your Python Settings to:

  • Python Library Path: C:\Program Fiels\Python37\libs
  • Python Path: C:\Program Files\Python37

2 Likes

You’ve blown my mind once again! :exploding_head: :exploding_head: :exploding_head:

3 Likes