diff --git a/Jenkinsfile b/Jenkinsfile index 42fcb9353..ab894cfbb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,11 +11,10 @@ stage ("Builds") { sh "nohup curl https://sh.rustup.rs -sSf | sh -s -- -y" } stage ('Run unit tests') { - sh "sudo chmod a+rw /dev/kvm" sh "scripts/run_unit_tests.sh" } stage ('Run integration tests') { - sh "sudo mount -t tmpfs tmpfs /tmp" + sh "sudo mount -t tmpfs tmpfs /tmp" sh "scripts/run_integration_tests.sh" } } diff --git a/scripts/run_unit_tests.sh b/scripts/run_unit_tests.sh index 609f3d930..23ee7ee72 100755 --- a/scripts/run_unit_tests.sh +++ b/scripts/run_unit_tests.sh @@ -13,8 +13,11 @@ pushd target/debug ls | grep net_util | grep -v "\.d" | xargs -n 1 sudo setcap cap_net_admin,cap_net_raw+ep popd -for f in $(find . -name Cargo.toml -printf '%h\n' | sort -u); do - pushd $f > /dev/null; +sudo adduser $USER kvm +newgrp kvm << EOF || exit 1 +for f in \$(find . -name Cargo.toml -printf '%h\n' | sort -u); do + pushd \$f > /dev/null; cargo test || exit 1; popd > /dev/null; done +EOF