1# -*- mode: ruby -*- 2# vi: set ft=ruby : 3# Vagrant configuration file which creates a virtual machine that can run the 4# test suite using fedora-test-runner.sh, in an environment similar to the one 5# used for automated continuous integration tests (GitHub Actions) 6# 7# To create a new virtual machine: 8# 9# vagrant up --provision 10# 11# To launch tests (for example after modifications to libsepol, libselinux... are made): 12# 13# vagrant rsync && echo ./run-selinux-test.sh | vagrant ssh 14# 15# To destroy the virtual machine (for example to start again from a clean environment): 16# 17# vagrant destroy 18 19# Create a helper script in the VM to run the testsuite as root from a clean environment 20$script = <<SCRIPT 21cat > /home/vagrant/run-selinux-test.sh << EOF 22#/bin/sh 23set -e -v 24 25# Run the tests 26sudo /root/selinux/scripts/ci/fedora-test-runner.sh 27echo 'All tests passed :)' 28EOF 29chmod +x /home/vagrant/run-selinux-test.sh 30SCRIPT 31 32# All Vagrant configuration is done below. The "2" in Vagrant.configure 33# configures the configuration version (we support older styles for 34# backwards compatibility). Please don't change it unless you know what 35# you're doing. 36Vagrant.configure("2") do |config| 37 config.vm.box = "fedora/39-cloud-base" 38 config.vm.synced_folder "../..", "/root/selinux" 39 40 config.vm.provider "virtualbox" do |v| 41 v.memory = 4096 42 end 43 config.vm.provider "libvirt" do |v| 44 v.memory = 4096 45 end 46 47 config.vm.provision :shell, inline: $script 48end 49