Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scripts/ci: add configuration for a Vagrant virtual machine
Using Vagrant makes reproducing and debugging CI issues easier: after "vagrant up", a test virtual machine is up and running, and ready to run "fedora-test-runner.sh". In order to make using this VM even easier, a helper script, "run-selinux-test.sh" is created inside and instructions on how to use it are documented at the beginning of Vagrantfile. Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
- Loading branch information
1 parent
f5f6303
commit ce64c47
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.vagrant/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
# Vagrant configuration file which creates a virtual machine that can run the | ||
# test suite using fedora-test-runner.sh, in an environment similar to the one | ||
# used for automated continuous integration tests (Travis-CI) | ||
# | ||
# To create a new virtual machine: | ||
# | ||
# vagrant up --provision | ||
# | ||
# To launch tests (for example after modifications to libsepol, libselinux... are made): | ||
# | ||
# vagrant rsync && echo ./run-selinux-test.sh | vagrant ssh | ||
# | ||
# To destroy the virtual machine (for example to start again from a clean environment): | ||
# | ||
# vagrant destroy | ||
|
||
# Create a helper script in the VM to run the testsuite as root from a clean environment | ||
$script = <<SCRIPT | ||
cat > /home/vagrant/run-selinux-test.sh << EOF | ||
#/bin/sh | ||
set -e -v | ||
# Run the tests | ||
sudo /root/selinux/scripts/ci/fedora-test-runner.sh | ||
echo 'All tests passed :)' | ||
EOF | ||
chmod +x /home/vagrant/run-selinux-test.sh | ||
SCRIPT | ||
|
||
# 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| | ||
config.vm.box = "fedora/33-cloud-base" | ||
config.vm.synced_folder "../..", "/root/selinux" | ||
|
||
config.vm.provider "virtualbox" do |v| | ||
v.memory = 4096 | ||
end | ||
config.vm.provider "libvirt" do |v| | ||
v.memory = 4096 | ||
end | ||
|
||
config.vm.provision :shell, inline: $script | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters