From bea88937f4564e282063fb44aeac485012cfae87 Mon Sep 17 00:00:00 2001 From: Martin Pärtel Date: Sun, 12 Nov 2023 20:43:24 +0200 Subject: CI: run Vagrant tests. --- vagrant/bionic64/Vagrantfile | 25 ------------------------- vagrant/centos8/Vagrantfile | 5 ++++- vagrant/debian10/Vagrantfile | 3 +++ vagrant/debian11/Vagrantfile | 3 +++ vagrant/freebsd12/Vagrantfile | 3 +++ vagrant/test.rb | 12 ++++++++++-- vagrant/ubuntu1804/Vagrantfile | 28 ++++++++++++++++++++++++++++ vagrant/ubuntu2004/Vagrantfile | 28 ++++++++++++++++++++++++++++ vagrant/ubuntu2204/Vagrantfile | 28 ++++++++++++++++++++++++++++ vagrant/xenial64/Vagrantfile | 25 ------------------------- 10 files changed, 107 insertions(+), 53 deletions(-) delete mode 100644 vagrant/bionic64/Vagrantfile create mode 100644 vagrant/ubuntu1804/Vagrantfile create mode 100644 vagrant/ubuntu2004/Vagrantfile create mode 100644 vagrant/ubuntu2204/Vagrantfile delete mode 100644 vagrant/xenial64/Vagrantfile (limited to 'vagrant') diff --git a/vagrant/bionic64/Vagrantfile b/vagrant/bionic64/Vagrantfile deleted file mode 100644 index aab9518..0000000 --- a/vagrant/bionic64/Vagrantfile +++ /dev/null @@ -1,25 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant.configure("2") do |config| - config.vm.box = "ubuntu/bionic64" - - config.vm.synced_folder ".", "/vagrant", disabled: true - config.vm.synced_folder "../../", "/bindfs", - type: "rsync", - rsync__auto: false, - rsync__exclude: ["vagrant"], - rsync__args: ["-av", "--delete-after"] - - config.vm.provider "virtualbox" do |v| - v.name = "bindfs-bionic64" - end - - config.vm.provision "shell", inline: <<-SHELL - apt-get update - apt-get install -y fuse libfuse-dev build-essential pkg-config ruby valgrind - apt-get clean - adduser vagrant fuse - echo user_allow_other > /etc/fuse.conf - SHELL -end diff --git a/vagrant/centos8/Vagrantfile b/vagrant/centos8/Vagrantfile index af2cba8..1793dd6 100644 --- a/vagrant/centos8/Vagrantfile +++ b/vagrant/centos8/Vagrantfile @@ -2,7 +2,7 @@ # vi: set ft=ruby : Vagrant.configure("2") do |config| - config.vm.box = "centos/8" + config.vm.box = "roboxes/centos8" config.vm.synced_folder ".", "/vagrant", disabled: true config.vm.synced_folder "../../", "/bindfs", @@ -14,6 +14,9 @@ Vagrant.configure("2") do |config| config.vm.provider "virtualbox" do |v| v.name = "bindfs-centos8" end + config.vm.provider "libvirt" do |v| + v.driver = if File.exist?('/dev/kvm') then 'kvm' else 'qemu' end + end config.vm.provision "shell", inline: <<-SHELL # CentOS 8 is EOL diff --git a/vagrant/debian10/Vagrantfile b/vagrant/debian10/Vagrantfile index d56a8f2..f42dbab 100644 --- a/vagrant/debian10/Vagrantfile +++ b/vagrant/debian10/Vagrantfile @@ -14,6 +14,9 @@ Vagrant.configure("2") do |config| config.vm.provider "virtualbox" do |v| v.name = "bindfs-debian10" end + config.vm.provider "libvirt" do |v| + v.driver = if File.exist?('/dev/kvm') then 'kvm' else 'qemu' end + end config.vm.provision "shell", reboot: true, inline: <<-SHELL export DEBIAN_FRONTEND='noninteractive' diff --git a/vagrant/debian11/Vagrantfile b/vagrant/debian11/Vagrantfile index 138da49..61c3298 100644 --- a/vagrant/debian11/Vagrantfile +++ b/vagrant/debian11/Vagrantfile @@ -14,6 +14,9 @@ Vagrant.configure("2") do |config| config.vm.provider "virtualbox" do |v| v.name = "bindfs-debian11" end + config.vm.provider "libvirt" do |v| + v.driver = if File.exist?('/dev/kvm') then 'kvm' else 'qemu' end + end config.vm.provision "shell", reboot: true, inline: <<-SHELL export DEBIAN_FRONTEND='noninteractive' diff --git a/vagrant/freebsd12/Vagrantfile b/vagrant/freebsd12/Vagrantfile index 213c18c..d48bc11 100644 --- a/vagrant/freebsd12/Vagrantfile +++ b/vagrant/freebsd12/Vagrantfile @@ -14,6 +14,9 @@ Vagrant.configure("2") do |config| config.vm.provider "virtualbox" do |v| v.name = "bindfs-freebsd12" end + config.vm.provider "libvirt" do |v| + v.driver = if File.exist?('/dev/kvm') then 'kvm' else 'qemu' end + end config.vm.provision "shell", inline: <<-SHELL pkg update diff --git a/vagrant/test.rb b/vagrant/test.rb index de4ffcc..e7a08f6 100755 --- a/vagrant/test.rb +++ b/vagrant/test.rb @@ -6,6 +6,7 @@ Usage: test.rb [--nohalt] [vm1 [...]] Options: -h --help Print this and exit. --nohalt Don't halt VMs when done. + --print-logs Prints each VM's logs when it completes. If VM names are given, only those are tested. @@ -19,6 +20,7 @@ require 'fileutils' Dir.chdir(File.dirname(__FILE__)) halt_vms = true +print_logs = false specifically_selected_vms = [] ARGV.each do |arg| if arg == '-h' || arg == '--help' @@ -26,6 +28,8 @@ ARGV.each do |arg| exit elsif arg == '--nohalt' halt_vms = false + elsif arg == '--print-logs' + print_logs = true elsif !arg.start_with?('-') specifically_selected_vms << arg else @@ -63,12 +67,12 @@ errors = [] threads = dirs.map do |dir| Thread.new do begin - File.open(dir + "/test.log", "wb") do |logfile| + File.open(dir + "/test.log", "w+b") do |logfile| run_and_log = -> (command) do logfile.puts "" logfile.puts "##### #{command} #####" logfile.flush - pid = Process.spawn(command, chdir: dir, out: logfile, err: :out) + pid = Process.spawn(command, chdir: dir, out: logfile, err: logfile) Process.waitpid(pid) $?.success? end @@ -101,6 +105,10 @@ threads = dirs.map do |dir| mutex.synchronize do puts "Finished VM: #{dir}" end + if print_logs + puts File.read(dir + "/test.log") + puts + end end end end diff --git a/vagrant/ubuntu1804/Vagrantfile b/vagrant/ubuntu1804/Vagrantfile new file mode 100644 index 0000000..6626a1c --- /dev/null +++ b/vagrant/ubuntu1804/Vagrantfile @@ -0,0 +1,28 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "roboxes/ubuntu1804" + + config.vm.synced_folder ".", "/vagrant", disabled: true + config.vm.synced_folder "../../", "/bindfs", + type: "rsync", + rsync__auto: false, + rsync__exclude: ["vagrant"], + rsync__args: ["-av", "--delete-after"] + + config.vm.provider "virtualbox" do |v| + v.name = "bindfs-ubuntu1804" + end + config.vm.provider "libvirt" do |v| + v.driver = if File.exist?('/dev/kvm') then 'kvm' else 'qemu' end + end + + config.vm.provision "shell", inline: <<-SHELL + apt-get update + apt-get install -y fuse libfuse-dev build-essential pkg-config ruby valgrind + apt-get clean + adduser vagrant fuse + echo user_allow_other > /etc/fuse.conf + SHELL +end diff --git a/vagrant/ubuntu2004/Vagrantfile b/vagrant/ubuntu2004/Vagrantfile new file mode 100644 index 0000000..c37e5be --- /dev/null +++ b/vagrant/ubuntu2004/Vagrantfile @@ -0,0 +1,28 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "roboxes/ubuntu2004" + + config.vm.synced_folder ".", "/vagrant", disabled: true + config.vm.synced_folder "../../", "/bindfs", + type: "rsync", + rsync__auto: false, + rsync__exclude: ["vagrant"], + rsync__args: ["-av", "--delete-after"] + + config.vm.provider "virtualbox" do |v| + v.name = "bindfs-ubuntu2004" + end + config.vm.provider "libvirt" do |v| + v.driver = if File.exist?('/dev/kvm') then 'kvm' else 'qemu' end + end + + config.vm.provision "shell", inline: <<-SHELL + apt-get update + apt-get install -y fuse libfuse-dev build-essential pkg-config ruby valgrind + apt-get clean + adduser vagrant fuse + echo user_allow_other > /etc/fuse.conf + SHELL +end diff --git a/vagrant/ubuntu2204/Vagrantfile b/vagrant/ubuntu2204/Vagrantfile new file mode 100644 index 0000000..06be5fd --- /dev/null +++ b/vagrant/ubuntu2204/Vagrantfile @@ -0,0 +1,28 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "roboxes/ubuntu2204" + + config.vm.synced_folder ".", "/vagrant", disabled: true + config.vm.synced_folder "../../", "/bindfs", + type: "rsync", + rsync__auto: false, + rsync__exclude: ["vagrant"], + rsync__args: ["-av", "--delete-after"] + + config.vm.provider "virtualbox" do |v| + v.name = "bindfs-ubuntu2204" + end + config.vm.provider "libvirt" do |v| + v.driver = if File.exist?('/dev/kvm') then 'kvm' else 'qemu' end + end + + config.vm.provision "shell", inline: <<-SHELL + apt-get update + apt-get install -y fuse libfuse-dev build-essential pkg-config ruby valgrind + apt-get clean + adduser vagrant fuse + echo user_allow_other > /etc/fuse.conf + SHELL +end diff --git a/vagrant/xenial64/Vagrantfile b/vagrant/xenial64/Vagrantfile deleted file mode 100644 index 2e79925..0000000 --- a/vagrant/xenial64/Vagrantfile +++ /dev/null @@ -1,25 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant.configure("2") do |config| - config.vm.box = "ubuntu/xenial64" - - config.vm.synced_folder ".", "/vagrant", disabled: true - config.vm.synced_folder "../../", "/bindfs", - type: "rsync", - rsync__auto: false, - rsync__exclude: ["vagrant"], - rsync__args: ["-av", "--delete-after"] - - config.vm.provider "virtualbox" do |v| - v.name = "bindfs-xenial64" - end - - config.vm.provision "shell", inline: <<-SHELL - apt-get update - apt-get install -y fuse libfuse-dev build-essential pkg-config ruby valgrind - apt-get clean - adduser vagrant fuse - echo user_allow_other > /etc/fuse.conf - SHELL -end -- cgit v1.2.3