In order to catch any regression in ReactOS, but also to develop ReactOS using test-driven development method, ReactOS devs were using two testbots. One was running all the tests in a ReactOS virtual machine run by KVM under Linux, while the second one was running them in a ReactOS virtual machine run by Virtual Box under Windows.
The fact is that, under Linux, to achieve such work, we are using an application developed internally named sysreg2. This one, uses the libvirt API to create a KVM domain, to start it, and to check the serial output of the VM, to get the results of the tests run in ReactOS.
We recently decided that another testbot could be handy. It has been decided that as a first step, using VMware Player under Linux would provide interesting results. In order to keep the behavior of the testbots unified, sysreg2 was to be adapted to also manage this VM.
Fortunately, libvirt also provides a compatibility layer with VMware Player. The API is still the same, so, normally, it would not have required that many efforts to get the switch, as long as, the good connection address is provided for libvirt to the hypervisor: vmwareplayer:///session, in our case. Then, internally, libvirt simply convert its XML domains to VMX domains and uses VMware tools: vmplayer and vmrun.
But actually, it did not work that easily. First, VMware Player tools were silently failing at startup. A simple strace shown that the tools were trying to load several X11 libraries. And when those had been installed, the tools were lacking a DISPLAY. Installing a complete X11 server and client just for VMware would have been kind of overkill method.
The solution used has been to make usage of two bootstrap scripts for VMware tools and of XVFB. XVFB is an X virtual frame buffer. So that, the applications run within this VFB just think and act as if they had a display, whereas they actually do not really have. So, once installed, the bootstrap scripts were basically just issuing a xvfb-run of the VMware tool with its args.
Expect for vmrun. Two other issues raised. First, it needed a complete X11 install along with GTK to be able to display the VM window. The solution here has been to append, at the end of the run command the “nogui” instruction. So that vmrun does not try to display anything. The bootstrap script was modified that way, as we cannot really manage the libvirt commands issued to those tools. The other issues also came from libvirt commands. When libvirt tries to destroy a domain, it asks VMware to do a “soft” shutdown of the machine. In case (and it happens with ReactOS…) where the machine is totally locked, this is pointless. There, the bootstrap script has been modified again to force to “hard” any shutdown instruction it was receiving before passing to the real tool.
Also, VMware and KVM do not exactly support same kind of hardware, especially for serial devices. So, it has required rethink and rework about the way sysreg2 and VMware can communicate. Finally, the adopted solution was to make sysreg2 create an Unix socket so that virtual machine can connect on it and write (also read).
We got a testbot working successfully :-).