Skip to content

Commit

Permalink
scripts: run tests on Windows
Browse files Browse the repository at this point in the history
This script uses valgrind to spin up a real Windows box
to run pre-built tests in it, thus avoiding to rely only
on Github action or dual booting for running tests on Windows.

Signed-off-by: Charles Oliveira <[email protected]>
  • Loading branch information
chaws committed Aug 30, 2021
1 parent 46d1ea9 commit f53a17e
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
build/
testing.log
*.out
*.exe
.cpackget*
tmp/
.vagrant/
19 changes: 19 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.

# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
config.vm.box = "senglin/win-10-enterprise-vs2015community"
config.vm.box_version = "1.0.0"

config.vm.synced_folder "./", "/vagrant"
end
3 changes: 3 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ coverage-check:
test-public-index:
@./scripts/test-public-index

test-on-windows:
@./scripts/test-on-windows

release: test-all build/cpackget
@./scripts/release

Expand Down
29 changes: 29 additions & 0 deletions scripts/test-on-windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

echo "Testing on Windows"

is_vagrant_up=$1

# Spin up windows box
if [ -z $is_vagrant_up ]
then
vagrant up
fi

cd cmd

# Build test binaries for windows and run it
PACKAGES="utils installer xml"
for package in $PACKAGES
do
cd $package
GOOS=windows go test -c
vagrant ssh -- -t "cd ../../vagrant/cmd/$package; ./$package.test.exe $ARGS"
cd ..
done

# Shut down windows box
if [ -z $is_vagrant_up ]
then
vagrant halt
fi

0 comments on commit f53a17e

Please sign in to comment.