mirror of https://github.com/dynup/kpatch
test: add ability to run tests remotely
Create a "make remote" target and a poor man's ansible to allow setting up a remote F22 system and running integration tests on it. To run tests remotely: make remote SSH_HOST=my.remote.f22.box
This commit is contained in:
parent
69b241ab38
commit
aa9f7fb1f6
|
@ -1,4 +1,11 @@
|
||||||
all: clean
|
all:
|
||||||
|
$(error please specify local or remote)
|
||||||
|
|
||||||
|
local: slow
|
||||||
|
|
||||||
|
remote: remote_slow
|
||||||
|
|
||||||
|
slow: clean
|
||||||
../kpatch-test
|
../kpatch-test
|
||||||
|
|
||||||
quick: clean
|
quick: clean
|
||||||
|
@ -9,3 +16,24 @@ cached:
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.ko *.log COMBINED.patch
|
rm -f *.ko *.log COMBINED.patch
|
||||||
|
|
||||||
|
check_host:
|
||||||
|
ifndef SSH_HOST
|
||||||
|
$(error SSH_HOST is undefined)
|
||||||
|
endif
|
||||||
|
|
||||||
|
SSH_USER ?= root
|
||||||
|
|
||||||
|
remote_setup: check_host
|
||||||
|
ssh $(SSH_USER)@$(SSH_HOST) exit
|
||||||
|
ssh $(SSH_USER)@$(SSH_HOST) "ls kpatch-setup &> /dev/null" || \
|
||||||
|
(scp remote-setup $(SSH_USER)@$(SSH_HOST):kpatch-setup && \
|
||||||
|
ssh $(SSH_USER)@$(SSH_HOST) "./kpatch-setup")
|
||||||
|
|
||||||
|
remote_sync: remote_setup
|
||||||
|
ssh $(SSH_USER)@$(SSH_HOST) "rm -rf kpatch-test"
|
||||||
|
rsync -Cavz --include=core $(shell readlink -f ../../..) $(SSH_USER)@$(SSH_HOST):kpatch-test
|
||||||
|
ssh $(SSH_USER)@$(SSH_HOST) "cd kpatch-test/kpatch && make"
|
||||||
|
|
||||||
|
remote_slow: remote_sync
|
||||||
|
ssh $(SSH_USER)@$(SSH_HOST) "cd kpatch-test/kpatch/test/integration/f22 && make slow"
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
#!/bin/bash -x
|
||||||
|
|
||||||
|
# install rpms on a Fedora 22 system to prepare it for kpatch integration tests
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
|
||||||
|
[[ $UID != 0 ]] && sudo=sudo
|
||||||
|
|
||||||
|
warn() {
|
||||||
|
echo "ERROR: $1" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
die() {
|
||||||
|
warn "$@"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
install_rpms() {
|
||||||
|
# crude workaround for a weird dnf bug where it fails to download
|
||||||
|
$sudo dnf install -y $* || $sudo dnf install -y $*
|
||||||
|
}
|
||||||
|
|
||||||
|
install_rpms gcc elfutils elfutils-devel rpmdevtools pesign openssl numactl-devel wget patchutils
|
||||||
|
|
||||||
|
$sudo dnf builddep -y kernel || $sudo dnf builddep -y kernel
|
||||||
|
|
||||||
|
# install kernel debuginfo and devel RPMs for target kernel
|
||||||
|
kverrel=$(uname -r)
|
||||||
|
kverrel=${kverrel%.x86_64}
|
||||||
|
kver=${kverrel%%-*}
|
||||||
|
krel=${kverrel#*-}
|
||||||
|
install_rpms https://kojipkgs.fedoraproject.org/packages/kernel/$kver/$krel/x86_64/kernel-debuginfo-$kver-$krel.x86_64.rpm https://kojipkgs.fedoraproject.org/packages/kernel/$kver/$krel/x86_64/kernel-debuginfo-common-x86_64-$kver-$krel.x86_64.rpm https://kojipkgs.fedoraproject.org/packages/kernel/$kver/$krel/x86_64/kernel-devel-$kver-$krel.x86_64.rpm
|
||||||
|
|
||||||
|
# install version of gcc which was used to build the target kernel
|
||||||
|
gccver=$(gcc --version |head -n1 |cut -d' ' -f3-)
|
||||||
|
kgccver=$(readelf -p .comment /usr/lib/debug/lib/modules/$(uname -r)/vmlinux |grep GCC: | tr -s ' ' | cut -d ' ' -f6-)
|
||||||
|
if [[ $gccver != $kgccver ]]; then
|
||||||
|
gver=$(echo $kgccver | awk '{print $1}')
|
||||||
|
grel=$(echo $kgccver | sed 's/.*-\(.*\))/\1/')
|
||||||
|
grel=$grel.$(rpm -q gcc |sed 's/.*\.\(.*\)\.x86_64/\1/')
|
||||||
|
install_rpms https://kojipkgs.fedoraproject.org/packages/gcc/$gver/$grel/x86_64/cpp-$gver-$grel.x86_64.rpm https://kojipkgs.fedoraproject.org/packages/gcc/$gver/$grel/x86_64/gcc-$gver-$grel.x86_64.rpm https://kojipkgs.fedoraproject.org/packages/gcc/$gver/$grel/x86_64/libgomp-$gver-$grel.x86_64.rpm
|
||||||
|
fi
|
||||||
|
|
||||||
|
install_rpms ccache
|
||||||
|
ccache -M 5G
|
Loading…
Reference in New Issue