* [PATCH v2 1/1] scripts/ci: add configuration for a Vagrant virtual machine
@ 2020-12-03 8:15 Nicolas Iooss
2020-12-08 8:35 ` Petr Lautrbach
0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Iooss @ 2020-12-03 8:15 UTC (permalink / raw)
To: selinux; +Cc: Petr Lautrbach, William Roberts
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>
---
scripts/ci/.gitignore | 1 +
scripts/ci/Vagrantfile | 48 ++++++++++++++++++++++++++++++++
scripts/ci/fedora-test-runner.sh | 2 ++
3 files changed, 51 insertions(+)
create mode 100644 scripts/ci/.gitignore
create mode 100644 scripts/ci/Vagrantfile
diff --git a/scripts/ci/.gitignore b/scripts/ci/.gitignore
new file mode 100644
index 000000000000..a977916f6583
--- /dev/null
+++ b/scripts/ci/.gitignore
@@ -0,0 +1 @@
+.vagrant/
diff --git a/scripts/ci/Vagrantfile b/scripts/ci/Vagrantfile
new file mode 100644
index 000000000000..d7c7bb39896d
--- /dev/null
+++ b/scripts/ci/Vagrantfile
@@ -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
diff --git a/scripts/ci/fedora-test-runner.sh b/scripts/ci/fedora-test-runner.sh
index be2cb7d8a5f5..f817499b54ae 100755
--- a/scripts/ci/fedora-test-runner.sh
+++ b/scripts/ci/fedora-test-runner.sh
@@ -75,6 +75,7 @@ git log --oneline -1
#
# Build and replace userspace components
#
+make clean distclean
make -j"$(nproc)" LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install
make -j"$(nproc)" LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install-pywrap
make -j"$(nproc)" LIBDIR=/usr/lib64 SHLIBDIR=/lib64 relabel
@@ -84,6 +85,7 @@ make -j"$(nproc)" LIBDIR=/usr/lib64 SHLIBDIR=/lib64 relabel
# first.
#
cd "$HOME"
+rm -rf selinux-testsuite
git clone --depth=1 https://github.com/SELinuxProject/selinux-testsuite.git
cd selinux-testsuite
--
2.29.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 1/1] scripts/ci: add configuration for a Vagrant virtual machine
2020-12-03 8:15 [PATCH v2 1/1] scripts/ci: add configuration for a Vagrant virtual machine Nicolas Iooss
@ 2020-12-08 8:35 ` Petr Lautrbach
0 siblings, 0 replies; 2+ messages in thread
From: Petr Lautrbach @ 2020-12-08 8:35 UTC (permalink / raw)
To: Nicolas Iooss, selinux; +Cc: William Roberts
Nicolas Iooss <nicolas.iooss@m4x.org> writes:
> 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>
Acked-by: Petr Lautrbach <plautrba@redhat.com>
and merged.
Thanks!
> ---
> scripts/ci/.gitignore | 1 +
> scripts/ci/Vagrantfile | 48 ++++++++++++++++++++++++++++++++
> scripts/ci/fedora-test-runner.sh | 2 ++
> 3 files changed, 51 insertions(+)
> create mode 100644 scripts/ci/.gitignore
> create mode 100644 scripts/ci/Vagrantfile
>
> diff --git a/scripts/ci/.gitignore b/scripts/ci/.gitignore
> new file mode 100644
> index 000000000000..a977916f6583
> --- /dev/null
> +++ b/scripts/ci/.gitignore
> @@ -0,0 +1 @@
> +.vagrant/
> diff --git a/scripts/ci/Vagrantfile b/scripts/ci/Vagrantfile
> new file mode 100644
> index 000000000000..d7c7bb39896d
> --- /dev/null
> +++ b/scripts/ci/Vagrantfile
> @@ -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
> diff --git a/scripts/ci/fedora-test-runner.sh b/scripts/ci/fedora-test-runner.sh
> index be2cb7d8a5f5..f817499b54ae 100755
> --- a/scripts/ci/fedora-test-runner.sh
> +++ b/scripts/ci/fedora-test-runner.sh
> @@ -75,6 +75,7 @@ git log --oneline -1
> #
> # Build and replace userspace components
> #
> +make clean distclean
> make -j"$(nproc)" LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install
> make -j"$(nproc)" LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install-pywrap
> make -j"$(nproc)" LIBDIR=/usr/lib64 SHLIBDIR=/lib64 relabel
> @@ -84,6 +85,7 @@ make -j"$(nproc)" LIBDIR=/usr/lib64 SHLIBDIR=/lib64 relabel
> # first.
> #
> cd "$HOME"
> +rm -rf selinux-testsuite
> git clone --depth=1 https://github.com/SELinuxProject/selinux-testsuite.git
> cd selinux-testsuite
>
> --
> 2.29.2
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-08 8:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 8:15 [PATCH v2 1/1] scripts/ci: add configuration for a Vagrant virtual machine Nicolas Iooss
2020-12-08 8:35 ` Petr Lautrbach
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.