master - test: Disable lvmetad logging in lvconvert-{mirror, raid}*.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f0d314bd6dcf22...
Commit: f0d314bd6dcf22cee8e18c6e21fa06829a0f01ac
Parent: fa2e84caa80053dbc5a8b42d2d3e2e1492736243
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon Jul 21 21:44:53 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Thu Feb 5 13:47:19 2015 +0100
test: Disable lvmetad logging in lvconvert-{mirror,raid}*.
---
test/lib/aux.sh | 5 ++++-
test/shell/lvconvert-mirror-basic.sh | 2 ++
test/shell/lvconvert-mirror.sh | 3 +++
test/shell/lvconvert-raid.sh | 3 +++
4 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 9def304..84edb7d 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -80,6 +80,7 @@ prepare_dmeventd() {
}
prepare_lvmetad() {
+ test $# -eq 0 && default_opts="-l wire,debug"
rm -f debug.log
# skip if we don't have our own lvmetad...
(which lvmetad 2>/dev/null | grep "$abs_builddir") || skip
@@ -90,8 +91,10 @@ prepare_lvmetad() {
local run_valgrind=
test "${LVM_VALGRIND_LVMETAD:-0}" -eq 0 || run_valgrind="run_valgrind"
+ kill_sleep_kill_ LOCAL_LVMETAD ${LVM_VALGRIND_LVMETAD:-0}
+
echo "preparing lvmetad..."
- $run_valgrind lvmetad -f "$@" -s "$TESTDIR/lvmetad.socket" -l wire,debug &
+ $run_valgrind lvmetad -f "$@" -s "$TESTDIR/lvmetad.socket" $default_opts "$@" &
echo $! > LOCAL_LVMETAD
while ! test -e "$TESTDIR/lvmetad.socket"; do echo -n .; sleep .1; done # wait for the socket
echo ok
diff --git a/test/shell/lvconvert-mirror-basic.sh b/test/shell/lvconvert-mirror-basic.sh
index 07bafb9..ce5b344 100644
--- a/test/shell/lvconvert-mirror-basic.sh
+++ b/test/shell/lvconvert-mirror-basic.sh
@@ -110,6 +110,8 @@ test_lvconvert() {
fi
}
+# disable lvmetad logging as it bogs down test systems
+test -e LOCAL_LVMETAD && aux prepare_lvmetad ""
aux prepare_pvs 5 5
vgcreate -s 32k $vg $(cat DEVICES)
diff --git a/test/shell/lvconvert-mirror.sh b/test/shell/lvconvert-mirror.sh
index d8f057a..6ba2ab2 100644
--- a/test/shell/lvconvert-mirror.sh
+++ b/test/shell/lvconvert-mirror.sh
@@ -11,6 +11,9 @@
. lib/inittest
+# disable lvmetad logging as it bogs down test systems
+test -e LOCAL_LVMETAD && aux prepare_lvmetad ""
+
aux prepare_pvs 5 10
# proper DEVRANGE needs to be set according to extent size
DEVRANGE="0-32"
diff --git a/test/shell/lvconvert-raid.sh b/test/shell/lvconvert-raid.sh
index 12e0420..34c94bf 100644
--- a/test/shell/lvconvert-raid.sh
+++ b/test/shell/lvconvert-raid.sh
@@ -11,6 +11,9 @@
. lib/inittest
+# disable lvmetad logging as it bogs down test systems
+test -e LOCAL_LVMETAD && aux prepare_lvmetad ""
+
get_image_pvs() {
local d
local images
9 years, 2 months
master - NIX: Re-work VM monitoring.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fa2e84caa80053...
Commit: fa2e84caa80053dbc5a8b42d2d3e2e1492736243
Parent: f96c310eea7e4f6a6cc567e2f5b52a2d1f5f4c90
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Sun Jun 29 17:37:35 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Thu Feb 5 13:47:19 2015 +0100
NIX: Re-work VM monitoring.
---
nix/default.nix | 35 ++++++++++++++++++++++-------------
1 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/nix/default.nix b/nix/default.nix
index c73ec29..19df6e8 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -1,3 +1,4 @@
+# -*- mode: nix; indent-tabs-mode: nil -*-
{ nixpkgs ? <nixpkgs>, lvm2Src, release ? false,
rawhide32 ? "" , rawhide64 ? "" ,
fc20_32_updates ? "", fc20_64_updates ? "",
@@ -72,34 +73,42 @@ let
counter=0
rm -f j.current j.last t.current t.last
while true; do
+ if ! test -f pid; then
+ counter=0
+ sleep 60
+ continue
+ fi
+
cat xchg/results-ndev/journal xchg/results-udev/journal > j.current 2> /dev/null
cat xchg/results-ndev/timestamp xchg/results-udev/timestamp > t.current 2> /dev/null
- # the journal didn't change for 10 minutes, kill the VM
- if diff j.current j.last > /dev/null 2> /dev/null; then
+ if diff j.current j.last >& /dev/null; then
counter=$(($counter + 1));
else
counter=0
fi
- if test $counter -eq 10 || diff t.current t.last > /dev/null 2> /dev/null; then
- kill $1
- sleep 3600 # wait for the parent to kill us
+ if test $counter -eq 10 || diff t.current t.last >& /dev/null; then
+ echo
+ echo "VM got stuck; timestamps: $(cat t.current) $(cat t.last), counter = $counter."
+ echo "last journal entry: $(tail -n 1 j.current), previously $(tail -n 1 j.last)"
+ kill -- -$(cat pid)
fi
sleep 60
- mv j.current j.last
- mv t.current t.last
+ mv j.current j.last >& /dev/null
+ mv t.current t.last >& /dev/null
done
}
- for i in seq 1 20; do # we allow up to 20 VM restarts
+ monitor &
+
+ for i in `seq 1 20`; do # we allow up to 20 VM restarts
${vmtools.qemu}/bin/qemu-img create -f qcow2 /dev/shm/testdisk.img 4G
setsid bash -e ${vmtools.vmRunCommand (vmtools.qemuCommandLinux kernel)} &
pid=$!
- sleep 60 # give the VM some time to get up and running
- monitor $pid &
- mon=$!
+ sleep 180 # give the VM some time to get up and running
+ echo $pid > pid # monitor go
wait $pid || true
- kill $mon
+ rm -f pid # disarm the monitor process
# if we have any new results, stash them
mv xchg/results-*'/'*.txt $out/test-results/ || true
@@ -109,7 +118,7 @@ let
break
fi
- sleep 5 # wait for the VM to clean up before starting up a new one
+ sleep 10 # wait for the VM to clean up before starting up a new one
done
cat xchg/results-ndev/list xchg/results-udev/list > $out/test-results/list || true
9 years, 2 months
master - NIX: Add Fedora 20 jobs.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f96c310eea7e4f...
Commit: f96c310eea7e4f6a6cc567e2f5b52a2d1f5f4c90
Parent: 0abad40f416a3831c9e4b44924468bd7b591a4fa
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Sun Jun 29 17:37:16 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Thu Feb 5 13:47:19 2015 +0100
NIX: Add Fedora 20 jobs.
---
nix/default.nix | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/nix/default.nix b/nix/default.nix
index 55ad8e1..c73ec29 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -1,5 +1,6 @@
{ nixpkgs ? <nixpkgs>, lvm2Src, release ? false,
rawhide32 ? "" , rawhide64 ? "" ,
+ fc20_32_updates ? "", fc20_64_updates ? "",
fc19_32_updates ? "", fc19_64_updates ? "",
fc18_32_updates ? "", fc18_64_updates ? "",
T ? "" }:
@@ -190,6 +191,8 @@ let
in {
rawhidex86_64 = rawhide "rawhide" "x86_64" rawhide64;
rawhidei386 = rawhide "rawhide" "i386" rawhide32;
+ fedora20ux86_64 = update "20" "x86_64" fc20_64_updates pkgs.vmTools.rpmDistros.fedora20x86_64;
+ fedora20ui386 = update "20" "i386" fc20_32_updates pkgs.vmTools.rpmDistros.fedora20i386;
fedora19ux86_64 = update "19" "x86_64" fc19_64_updates pkgs.vmTools.rpmDistros.fedora19x86_64;
fedora19ui386 = update "19" "i386" fc19_32_updates pkgs.vmTools.rpmDistros.fedora19i386;
fedora18ux86_64 = update "18" "x86_64" fc18_64_updates pkgs.vmTools.rpmDistros.fedora18x86_64;
@@ -252,12 +255,18 @@ let
fedora16 = [ "clusterlib-devel" "openaislib-devel" "cman" "systemd-devel" "libudev-devel" ];
fedora17 = [ "dlm-devel" "corosynclib-devel" "device-mapper-persistent-data"
"dlm" "systemd-devel" "perl-Digest-MD5" "libudev-devel" ];
+
fedora18 = [ "dlm-devel" "corosynclib-devel" "device-mapper-persistent-data"
"dlm" "systemd-devel" "perl-Digest-MD5" ];
fedora18u = fedora18;
+
fedora19 = [ "dlm-devel" "dlm" "corosynclib-devel" "perl-Digest-MD5" "systemd-devel" "procps-ng" ];
fedora19u = fedora19;
- rawhide = fedora19;
+
+ fedora20 = fedora19;
+ fedora20u = fedora20;
+
+ rawhide = fedora20;
};
wrapper = fun: { arch, image, build ? {}, istest ? false }: with lib;
@@ -275,6 +284,8 @@ let
};
configs = {
+ fc20_x86_64 = { arch = "x86_64"; image = "fedora20"; };
+ fc20_i386 = { arch = "i386" ; image = "fedora20"; };
fc19_x86_64 = { arch = "x86_64"; image = "fedora19"; };
fc19_i386 = { arch = "i386" ; image = "fedora19"; };
fc18_x86_64 = { arch = "x86_64"; image = "fedora18"; };
9 years, 2 months
master - NIX: Existence of results list no longer indicates that the suite has finished.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0abad40f416a38...
Commit: 0abad40f416a3831c9e4b44924468bd7b591a4fa
Parent: e3ac180ab37a5cfe39ac739d48b9176c0e4f6003
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Sat Jun 28 12:51:18 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Thu Feb 5 13:47:19 2015 +0100
NIX: Existence of results list no longer indicates that the suite has finished.
---
nix/default.nix | 19 ++++++++-----------
1 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/nix/default.nix b/nix/default.nix
index 8de3eba..55ad8e1 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -27,17 +27,14 @@ let
dmsetup targets
export LVM_TEST_BACKING_DEVICE=/dev/vdb
- if ! test -e /tmp/xchg/results-ndev/list; then
- lvm2-testsuite --batch --outdir /tmp/xchg/results-ndev --continue \
- --flavours ndev-vanilla,ndev-cluster,ndev-lvmetad
- fi
-
- if ! test -e /tmp/xchg/results-udev/list; then
- (/usr/lib/systemd/systemd-udevd || /usr/lib/udev/udevd || /sbin/udevd || \
- find / -xdev -name \*udevd) &
- lvm2-testsuite --batch --outdir /tmp/xchg/results-udev --continue \
- --flavours udev-vanilla,udev-cluster,udev-lvmetad
- fi
+
+ lvm2-testsuite --batch --outdir /tmp/xchg/results-ndev --continue \
+ --flavours ndev-vanilla,ndev-cluster,ndev-lvmetad
+
+ (/usr/lib/systemd/systemd-udevd || /usr/lib/udev/udevd || /sbin/udevd || \
+ find / -xdev -name \*udevd) >& /tmp/udevd.log &
+ lvm2-testsuite --batch --outdir /tmp/xchg/results-udev --continue \
+ --flavours udev-vanilla,udev-cluster,udev-lvmetad --watch /tmp/udevd.log
# if we made it this far, all test results are in
9 years, 2 months
master - NIX: Drop -h from rpm invocations as it messes up logs.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e3ac180ab37a5c...
Commit: e3ac180ab37a5cfe39ac739d48b9176c0e4f6003
Parent: 6380869f27bfd4f271cb1c8ba3d023e1c94f77fd
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Sat Jun 28 12:50:57 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Thu Feb 5 13:47:19 2015 +0100
NIX: Drop -h from rpm invocations as it messes up logs.
---
nix/default.nix | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/nix/default.nix b/nix/default.nix
index b6a4f98..8de3eba 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -17,7 +17,7 @@ let
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# we always run in a fresh image, so need to install everything again
- ls ${build}/rpms/*/*.rpm | grep -v sysvinit | xargs rpm -Uvh # */
+ ls ${build}/rpms/*/*.rpm | grep -v sysvinit | xargs rpm -Uv # */
rpm -Uv ${pkgs.fetchurl {
url = "http://archives.fedoraproject.org/pub/archive/fedora/linux/updates/16/i38...";
sha256 = "0ycdh5mb7p5ll76mqk0p6gpnjskvxxgh3a3bfr1crh94nvpwhp4z"; }}
9 years, 2 months
master - NIX: Use nixpkgs kernel for building, distro kernel for testing.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6380869f27bfd4...
Commit: 6380869f27bfd4f271cb1c8ba3d023e1c94f77fd
Parent: 2b6f9152ccbc74ab4c599089dc6bf0ae43ccd123
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Sat Jun 28 11:16:46 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Thu Feb 5 13:47:19 2015 +0100
NIX: Use nixpkgs kernel for building, distro kernel for testing.
---
nix/default.nix | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/nix/default.nix b/nix/default.nix
index 843440e..b6a4f98 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -229,10 +229,11 @@ let
};
};
- vm = pkgs: xmods: with lib; rec {
+ vm = { pkgs, xmods, dmmods ? false }: with lib; rec {
tools = import "${nixpkgs}/pkgs/build-support/vm/default.nix" {
inherit pkgs; rootModules = rootmods ++ xmods ++
- [ "loop" "dm_mod" "dm_snapshot" "dm_mirror" "dm_zero" "dm_raid" "dm_thin_pool" ]; };
+ (if dmmods then [ "loop" "dm_mod" "dm_snapshot" "dm_mirror" "dm_zero" "dm_raid" "dm_thin_pool" ]
+ else []); };
release = import "${nixpkgs}/pkgs/build-support/release/default.nix" {
pkgs = pkgs // { vmTools = tools; }; };
imgs = tools.diskImageFuns //
@@ -262,11 +263,13 @@ let
rawhide = fedora19;
};
- wrapper = fun: { arch, image, build ? {} }: with lib;
- let use = vm (if eqStrings arch "i386" then pkgs.pkgsi686Linux else pkgs)
- (if image == "centos64" || image == "centos65" then [] else [ "9p" "9pnet_virtio" ]);
+ wrapper = fun: { arch, image, build ? {}, istest ? false }: with lib;
+ let use = vm { pkgs = if eqStrings arch "i386" then pkgs.pkgsi686Linux else pkgs;
+ xmods = if istest && (image == "centos64" || image == "centos65")
+ then [] else [ "9p" "9pnet_virtio" ];
+ dmmods = istest; };
in fun {
- inherit build;
+ inherit build istest;
VM = use.rpmbuild;
diskFun = builtins.getAttr "${image}${arch}" use.imgs;
extras = extra_rpms.common ++ builtins.getAttr image extra_rpms;
@@ -301,7 +304,8 @@ let
};
rpms = lib.mapAttrs (n: v: wrapper mkBuild v) configs;
- tests = lib.mapAttrs (n: v: wrapper mkTest (v // { build = builtins.getAttr n rpms; })) configs;
+ tests = let make = n: v: wrapper mkTest (v // { build = builtins.getAttr n rpms; istest = true; });
+ in lib.mapAttrs make configs;
jobs = tests // {
tarball = pkgs.releaseTools.sourceTarball rec {
9 years, 2 months
master - NIX: Adapt to the append-based test journal.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2b6f9152ccbc74...
Commit: 2b6f9152ccbc74ab4c599089dc6bf0ae43ccd123
Parent: 285db7a240229e17fabaaf03ad9febd90afe8a8e
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Sat Jun 28 11:16:22 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Thu Feb 5 13:47:19 2015 +0100
NIX: Adapt to the append-based test journal.
---
nix/default.nix | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/nix/default.nix b/nix/default.nix
index 9b466ba..843440e 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -16,7 +16,7 @@ let
#!/bin/bash
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
- # we always run in a fresh image, so need to install everything again
+ # we always run in a fresh image, so need to install everything again
ls ${build}/rpms/*/*.rpm | grep -v sysvinit | xargs rpm -Uvh # */
rpm -Uv ${pkgs.fetchurl {
url = "http://archives.fedoraproject.org/pub/archive/fedora/linux/updates/16/i38...";
@@ -72,8 +72,9 @@ let
monitor() {
set +e
counter=0
+ rm -f j.current j.last t.current t.last
while true; do
- cat xchg/results-ndev/journal* xchg/results-udev/journal* > j.current 2> /dev/null
+ cat xchg/results-ndev/journal xchg/results-udev/journal > j.current 2> /dev/null
cat xchg/results-ndev/timestamp xchg/results-udev/timestamp > t.current 2> /dev/null
# the journal didn't change for 10 minutes, kill the VM
if diff j.current j.last > /dev/null 2> /dev/null; then
@@ -95,6 +96,7 @@ let
${vmtools.qemu}/bin/qemu-img create -f qcow2 /dev/shm/testdisk.img 4G
setsid bash -e ${vmtools.vmRunCommand (vmtools.qemuCommandLinux kernel)} &
pid=$!
+ sleep 60 # give the VM some time to get up and running
monitor $pid &
mon=$!
@@ -112,8 +114,7 @@ let
sleep 5 # wait for the VM to clean up before starting up a new one
done
- # (ab)use the journals in case the lists weren't actually written yet
- cat xchg/results-ndev/journal xchg/results-udev/journal > $out/test-results/list || true
+ cat xchg/results-ndev/list xchg/results-udev/list > $out/test-results/list || true
'';
};
9 years, 2 months
master - NIX: Implement a smarter VM monitoring loop.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=285db7a240229e...
Commit: 285db7a240229e17fabaaf03ad9febd90afe8a8e
Parent: dcf5182a96c7eb65fe5d61ce5ceea9ba5bf7a3f2
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Fri Jun 27 23:09:30 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Thu Feb 5 13:47:19 2015 +0100
NIX: Implement a smarter VM monitoring loop.
---
nix/default.nix | 48 ++++++++++++++++++++++++++++++++++++++----------
1 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/nix/default.nix b/nix/default.nix
index bd3d969..9b466ba 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -61,30 +61,58 @@ let
builder = pkgs.writeScript "vm-test" ''
#!${pkgs.bash}/bin/bash
. $stdenv/setup
- set -x
export QEMU_OPTS="-drive file=/dev/shm/testdisk.img,if=virtio -m 256M"
- export KERNEL_OPTS="log_buf_len=131072"
+ export KERNEL_OPTS="log_buf_len=131072 loglevel=1"
export mountDisk=1
mkdir -p $out/test-results $out/nix-support
touch $out/nix-support/failed
- # give it 9x 20 minutes, i.e. about 3 hours
- for i in seq 1 9; do
+ monitor() {
+ set +e
+ counter=0
+ while true; do
+ cat xchg/results-ndev/journal* xchg/results-udev/journal* > j.current 2> /dev/null
+ cat xchg/results-ndev/timestamp xchg/results-udev/timestamp > t.current 2> /dev/null
+ # the journal didn't change for 10 minutes, kill the VM
+ if diff j.current j.last > /dev/null 2> /dev/null; then
+ counter=$(($counter + 1));
+ else
+ counter=0
+ fi
+ if test $counter -eq 10 || diff t.current t.last > /dev/null 2> /dev/null; then
+ kill $1
+ sleep 3600 # wait for the parent to kill us
+ fi
+ sleep 60
+ mv j.current j.last
+ mv t.current t.last
+ done
+ }
+
+ for i in seq 1 20; do # we allow up to 20 VM restarts
${vmtools.qemu}/bin/qemu-img create -f qcow2 /dev/shm/testdisk.img 4G
setsid bash -e ${vmtools.vmRunCommand (vmtools.qemuCommandLinux kernel)} &
pid=$!
- ( sleep 1200 ; kill -- -$pid ) &
- if wait $pid; then
- rm -f $out/nix-support/failed
+ monitor $pid &
+ mon=$!
+
+ wait $pid || true
+ kill $mon
+
+ # if we have any new results, stash them
+ mv xchg/results-*'/'*.txt $out/test-results/ || true
+
+ if test -n "$(cat xchg/in-vm-exit)"; then # the VM is done
+ test 0 -eq "$(cat xchg/in-vm-exit)" && rm -f $out/nix-support/failed
break
fi
- mv xchg/results-*'/'*.txt $out/test-results/
- sleep 5
+
+ sleep 5 # wait for the VM to clean up before starting up a new one
done
- # use journals in case the lists weren't actually written yet
+ # (ab)use the journals in case the lists weren't actually written yet
cat xchg/results-ndev/journal xchg/results-udev/journal > $out/test-results/list || true
'';
};
9 years, 2 months
master - NIX: Use --batch mode for running the testsuite.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dcf5182a96c7eb...
Commit: dcf5182a96c7eb65fe5d61ce5ceea9ba5bf7a3f2
Parent: 4b5ae314049cebbd1b4f6ad35fd11d957a50db8e
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Fri Jun 27 23:09:02 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Thu Feb 5 13:47:19 2015 +0100
NIX: Use --batch mode for running the testsuite.
---
nix/default.nix | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/nix/default.nix b/nix/default.nix
index 2ea248e..bd3d969 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -28,14 +28,14 @@ let
export LVM_TEST_BACKING_DEVICE=/dev/vdb
if ! test -e /tmp/xchg/results-ndev/list; then
- lvm2-testsuite --outdir /tmp/xchg/results-ndev --continue \
+ lvm2-testsuite --batch --outdir /tmp/xchg/results-ndev --continue \
--flavours ndev-vanilla,ndev-cluster,ndev-lvmetad
fi
if ! test -e /tmp/xchg/results-udev/list; then
(/usr/lib/systemd/systemd-udevd || /usr/lib/udev/udevd || /sbin/udevd || \
find / -xdev -name \*udevd) &
- lvm2-testsuite --outdir /tmp/xchg/results-udev --continue \
+ lvm2-testsuite --batch --outdir /tmp/xchg/results-udev --continue \
--flavours udev-vanilla,udev-cluster,udev-lvmetad
fi
9 years, 2 months
master - NIX: Refactor around the new test runner.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4b5ae314049ceb...
Commit: 4b5ae314049cebbd1b4f6ad35fd11d957a50db8e
Parent: d5537e7d6b28d2a7f2214529797aade0ed29efab
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Fri Jun 27 01:25:18 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Thu Feb 5 13:47:19 2015 +0100
NIX: Refactor around the new test runner.
- The RPM build and the tests are now executed in separate VMs.
- Run the testsuite by using the new lvm2-testsuite RPM.
- The VM running the tests is restarted from the outside if it hangs, and the
runner keeps a journal to avoid running a bad test ad infinitum.
- TODO: lcov reports and more intelligent VM rebooting (track the journal)
---
nix/default.nix | 229 ++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 149 insertions(+), 80 deletions(-)
diff --git a/nix/default.nix b/nix/default.nix
index abd3d01..2ea248e 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -2,47 +2,106 @@
rawhide32 ? "" , rawhide64 ? "" ,
fc19_32_updates ? "", fc19_64_updates ? "",
fc18_32_updates ? "", fc18_64_updates ? "",
- lvm2Nix ? lvm2Src, T ? "" }:
+ T ? "" }:
let
pkgs = import nixpkgs {};
- mkVM = { VM, extras ? [], diskFun, kernel }:
- VM rec {
- inherit kernel;
- name = "lvm2";
- fullName = "LVM2";
- src = jobs.tarball;
+ lib = pkgs.lib;
+ mkTest = { build, diskFun, extras ? [], kernel, vmtools, ... }: pkgs.stdenv.mkDerivation rec {
diskImage = diskFun { extraPackages = extras; };
- memSize = 2047;
-
- # fc16 lcov is broken and el6 has none... be creative
- prepareImagePhase = ''
- rpm -Uv ${pkgs.fetchurl {
- url = "http://archives.fedoraproject.org/pub/archive/fedora/linux/updates/16/i38...";
- sha256 = "0ycdh5mb7p5ll76mqk0p6gpnjskvxxgh3a3bfr1crh94nvpwhp4z"; }}
- dmesg -n 1 # avoid spilling dmesg into the main log, we capture it in harness
+ name = "lvm2-test-${diskImage.name}";
+
+ # this is the builder that runs in the guest
+ origBuilder = pkgs.writeScript "vm-test-guest" ''
+ #!/bin/bash
+ export PATH=/usr/bin:/bin:/usr/sbin:/sbin
+
+ # we always run in a fresh image, so need to install everything again
+ ls ${build}/rpms/*/*.rpm | grep -v sysvinit | xargs rpm -Uvh # */
+ rpm -Uv ${pkgs.fetchurl {
+ url = "http://archives.fedoraproject.org/pub/archive/fedora/linux/updates/16/i38...";
+ sha256 = "0ycdh5mb7p5ll76mqk0p6gpnjskvxxgh3a3bfr1crh94nvpwhp4z"; }}
+
+ mkdir -p /tmp/xchg/results-{udev,ndev}
+
+ dmsetup targets
+
+ export LVM_TEST_BACKING_DEVICE=/dev/vdb
+ if ! test -e /tmp/xchg/results-ndev/list; then
+ lvm2-testsuite --outdir /tmp/xchg/results-ndev --continue \
+ --flavours ndev-vanilla,ndev-cluster,ndev-lvmetad
+ fi
+
+ if ! test -e /tmp/xchg/results-udev/list; then
+ (/usr/lib/systemd/systemd-udevd || /usr/lib/udev/udevd || /sbin/udevd || \
+ find / -xdev -name \*udevd) &
+ lvm2-testsuite --outdir /tmp/xchg/results-udev --continue \
+ --flavours udev-vanilla,udev-cluster,udev-lvmetad
+ fi
+
+ # if we made it this far, all test results are in
+
+ # TODO: coverage reports
+ # make lcov || true
+ # cp -R lcov_reports $out/coverage && \
+ # echo "report coverage $out/coverage" >> $out/nix-support/hydra-build-products || \
+ # true # not really fatal, although kinda disappointing
'';
- postBuild = ''
- mkdir -p $out/nix-support
- cd `cat /tmp/build-location`
- mv test/results/list test/results/list-rpm
- ls /tmp/rpmout/RPMS/*/*.rpm | grep -v sysvinit | xargs rpm -Uvh # */
- (/usr/lib/systemd/systemd-udevd || /usr/lib/udev/udevd || /sbin/udevd || find / -xdev -name \*udevd) &
- make check_system QUIET=1 T=${T} || touch $out/nix-support/failed
- mv test/results/list test/results/list-system
- cat test/results/list-* > test/results/list
- cp -R test/results $out/test-results && \
- echo "report tests $out/test-results" >> $out/nix-support/hydra-build-products || \
- true
- make lcov || true
- cp -R lcov_reports $out/coverage && \
- echo "report coverage $out/coverage" >> $out/nix-support/hydra-build-products || \
- true # not really fatal, although kinda disappointing
+ buildInputs = [ pkgs.coreutils pkgs.bash pkgs.utillinux ];
+
+ # make a qcow copy of the main image
+ preVM = ''
+ diskImage=$(pwd)/disk-image.qcow2
+ origImage=${diskImage}
+ if test -d "$origImage"; then origImage="$origImage/disk-image.qcow2"; fi
+ ${vmtools.qemu}/bin/qemu-img create -b "$origImage" -f qcow2 $diskImage
+ '';
+
+ builder = pkgs.writeScript "vm-test" ''
+ #!${pkgs.bash}/bin/bash
+ . $stdenv/setup
+ set -x
+
+ export QEMU_OPTS="-drive file=/dev/shm/testdisk.img,if=virtio -m 256M"
+ export KERNEL_OPTS="log_buf_len=131072"
+ export mountDisk=1
+
+ mkdir -p $out/test-results $out/nix-support
+ touch $out/nix-support/failed
+
+ # give it 9x 20 minutes, i.e. about 3 hours
+ for i in seq 1 9; do
+ ${vmtools.qemu}/bin/qemu-img create -f qcow2 /dev/shm/testdisk.img 4G
+ setsid bash -e ${vmtools.vmRunCommand (vmtools.qemuCommandLinux kernel)} &
+ pid=$!
+ ( sleep 1200 ; kill -- -$pid ) &
+ if wait $pid; then
+ rm -f $out/nix-support/failed
+ break
+ fi
+ mv xchg/results-*'/'*.txt $out/test-results/
+ sleep 5
+ done
+
+ # use journals in case the lists weren't actually written yet
+ cat xchg/results-ndev/journal xchg/results-udev/journal > $out/test-results/list || true
'';
+ };
+
+ mkBuild = { VM, extras ? [], diskFun, ... }:
+ VM rec {
+ name = "lvm2-build-${diskImage.name}";
+ fullName = "lvm2-build-${diskImage.name}";
+
+ src = jobs.tarball;
+ diskImage = diskFun { extraPackages = extras; };
+ memSize = 512;
+ checkPhase = ":";
postInstall = ''
- for i in $out/rpms/*/*.rpm; do
+ mkdir -p $out/nix-support
+ for i in $out/rpms/*/*.rpm; do # */
if echo $i | grep -vq "\.src\.rpm$"; then
echo "file rpm $i" >> $out/nix-support/hydra-build-products
else
@@ -58,11 +117,11 @@ let
centos_url = ver: arch: if ver == "6.5"
then "http://ftp.fi.muni.cz/pub/linux/centos/${ver}/os/${arch}/"
else "http://vault.centos.org/${ver}/os/${arch}/";
- fedora_url = ver: arch: if pkgs.lib.eqStrings ver "rawhide" || pkgs.lib.eqStrings ver "19"
+ fedora_url = ver: arch: if lib.eqStrings ver "rawhide" || lib.eqStrings ver "19"
then "ftp://ftp.fi.muni.cz/pub/linux/fedora/linux/development/${ver}/${arch}/os/"
else "mirror://fedora/linux/releases/${ver}/Everything/${arch}/os/";
fedora_update_url = ver: arch: "mirror://fedora/linux/updates/${ver}/${arch}";
- extra_distros = with pkgs.lib; let
+ extra_distros = with lib; let
centos = { version, sha, arch }: {
name = "centos-${version}-${arch}";
fullName = "CentOS ${version} (${arch})";
@@ -141,7 +200,7 @@ let
};
};
- vm = pkgs: xmods: with pkgs.lib; rec {
+ vm = pkgs: xmods: with lib; rec {
tools = import "${nixpkgs}/pkgs/build-support/vm/default.nix" {
inherit pkgs; rootModules = rootmods ++ xmods ++
[ "loop" "dm_mod" "dm_snapshot" "dm_mirror" "dm_zero" "dm_raid" "dm_thin_pool" ]; };
@@ -174,17 +233,48 @@ let
rawhide = fedora19;
};
- mkRPM = { arch, image }: with pkgs.lib;
+ wrapper = fun: { arch, image, build ? {} }: with lib;
let use = vm (if eqStrings arch "i386" then pkgs.pkgsi686Linux else pkgs)
(if image == "centos64" || image == "centos65" then [] else [ "9p" "9pnet_virtio" ]);
- in mkVM {
+ in fun {
+ inherit build;
VM = use.rpmbuild;
diskFun = builtins.getAttr "${image}${arch}" use.imgs;
extras = extra_rpms.common ++ builtins.getAttr image extra_rpms;
+ vmtools = use.tools;
kernel = use.tools.makeKernelFromRPMDist (builtins.getAttr "${image}${arch}" use.rpmdistros);
};
- jobs = rec {
+ configs = {
+ fc19_x86_64 = { arch = "x86_64"; image = "fedora19"; };
+ fc19_i386 = { arch = "i386" ; image = "fedora19"; };
+ fc18_x86_64 = { arch = "x86_64"; image = "fedora18"; };
+ fc18_i386 = { arch = "i386" ; image = "fedora18"; };
+ fc17_x86_64 = { arch = "x86_64"; image = "fedora17"; };
+ fc17_i386 = { arch = "i386" ; image = "fedora17"; };
+ fc16_x86_64 = { arch = "x86_64"; image = "fedora16"; };
+ fc16_i386 = { arch = "i386" ; image = "fedora16"; };
+
+ fc18u_x86_64 = { arch = "x86_64"; image = "fedora18u"; };
+ fc18u_i386 = { arch = "i386"; image = "fedora18u"; };
+ fc19u_x86_64 = { arch = "x86_64"; image = "fedora19u"; };
+ fc19u_i386 = { arch = "i386"; image = "fedora19u"; };
+
+ #centos63_i386 = { arch = "i386" ; image = "centos63"; };
+ #centos63_x86_64 = { arch = "x86_64" ; image = "centos63"; };
+ centos64_i386 = { arch = "i386" ; image = "centos64"; };
+ centos64_x86_64 = { arch = "x86_64" ; image = "centos64"; };
+ centos65_i386 = { arch = "i386" ; image = "centos65"; };
+ centos65_x86_64 = { arch = "x86_64" ; image = "centos65"; };
+
+ rawhide_i386 = { arch = "i386" ; image = "rawhide"; };
+ rawhide_x86_64 = { arch = "x86_64" ; image = "rawhide"; };
+ };
+
+ rpms = lib.mapAttrs (n: v: wrapper mkBuild v) configs;
+ tests = lib.mapAttrs (n: v: wrapper mkTest (v // { build = builtins.getAttr n rpms; })) configs;
+
+ jobs = tests // {
tarball = pkgs.releaseTools.sourceTarball rec {
name = "lvm2-tarball";
versionSuffix = if lvm2Src ? revCount
@@ -193,31 +283,34 @@ let
src = lvm2Src;
autoconfPhase = ":";
distPhase = ''
- set -x
make distclean
+
version=`cat VERSION | cut "-d(" -f1`${versionSuffix}
version_dm=`cat VERSION_DM | cut "-d-" -f1`${versionSuffix}
- sed -e s,-git,${versionSuffix}, -i VERSION VERSION_DM
- rm -rf spec; cp -R ${lvm2Nix}/spec/* .
+
chmod u+w *
- (echo "%define enable_profiling 1";
- echo "%define check_commands \\";
- echo "make lcov-reset \\";
- echo "dmsetup targets\\";
- echo "mkdir -p \$out/nix-support \\";
- echo "make check QUIET=1 T=${T} || touch \$out/nix-support/failed \\"
- echo "pwd > /tmp/build-location \\"
- echo "touch rpm-no-clean") >> source.inc
+
+ # set up versions
+ sed -e s,-git,${versionSuffix}, -i VERSION VERSION_DM
sed -e "s,\(device_mapper_version\) [0-9.]*$,\1 $version_dm," \
-e "s,^\(Version:[^0-9%]*\)[0-9.]*$,\1 $version," \
-e "s,^\(Release:[^0-9%]*\)[0-9.]\+,\1 0.HYDRA," \
- -e "s:%with clvmd corosync:%with clvmd corosync,singlenode:" \
- -i source.inc
- sed -e '/^%changelog/,$d' \
- -i lvm2.spec
- echo "%changelog" >> lvm2.spec;
- echo "* `date +"%a %b %d %Y"` Petr Rockai <prockai(a)redhat.com> - $version" >> lvm2.spec;
- echo "- AUTOMATED BUILD BY Hydra" >> lvm2.spec
+ -i spec/source.inc
+
+ # tweak RPM configuration
+ echo "%define enable_profiling 1" >> spec/source.inc
+ echo "%define enable_testsuite 1" >> spec/source.inc
+ sed -e "s:%with clvmd corosync:%with clvmd corosync,singlenode:" -i spec/source.inc
+
+ # synthesize a changelog
+ sed -e '/^%changelog/,$d' -i spec/lvm2.spec
+ (echo "%changelog";
+ echo "* `date +"%a %b %d %Y"` Petr Rockai <prockai(a)redhat.com> - $version";
+ echo "- AUTOMATED BUILD BY Hydra") >> spec/lvm2.spec
+
+ mv spec/* . && rmdir spec # */ # RPM needs the spec file in the source root
+
+ # make a tarball
mkdir ../LVM2.$version
mv * ../LVM2.$version
ensureDir $out/tarballs
@@ -225,29 +318,5 @@ let
tar cvzf $out/tarballs/LVM2.$version.tgz LVM2.$version
'';
};
-
- fc19_x86_64 = mkRPM { arch = "x86_64"; image = "fedora19"; };
- fc19_i386 = mkRPM { arch = "i386" ; image = "fedora19"; };
- fc18_x86_64 = mkRPM { arch = "x86_64"; image = "fedora18"; };
- fc18_i386 = mkRPM { arch = "i386" ; image = "fedora18"; };
- fc17_x86_64 = mkRPM { arch = "x86_64"; image = "fedora17"; };
- fc17_i386 = mkRPM { arch = "i386" ; image = "fedora17"; };
- fc16_x86_64 = mkRPM { arch = "x86_64"; image = "fedora16"; };
- fc16_i386 = mkRPM { arch = "i386" ; image = "fedora16"; };
-
- fc18u_x86_64 = mkRPM { arch = "x86_64"; image = "fedora18u"; };
- fc18u_i386 = mkRPM { arch = "i386"; image = "fedora18u"; };
- fc19u_x86_64 = mkRPM { arch = "x86_64"; image = "fedora19u"; };
- fc19u_i386 = mkRPM { arch = "i386"; image = "fedora19u"; };
-
- #centos63_i386 = mkRPM { arch = "i386" ; image = "centos63"; };
- #centos63_x86_64 = mkRPM { arch = "x86_64" ; image = "centos63"; };
- centos64_i386 = mkRPM { arch = "i386" ; image = "centos64"; };
- centos64_x86_64 = mkRPM { arch = "x86_64" ; image = "centos64"; };
- centos65_i386 = mkRPM { arch = "i386" ; image = "centos65"; };
- centos65_x86_64 = mkRPM { arch = "x86_64" ; image = "centos65"; };
-
- rawhide_i386 = mkRPM { arch = "i386" ; image = "rawhide"; };
- rawhide_x86_64 = mkRPM { arch = "x86_64" ; image = "rawhide"; };
};
in jobs
9 years, 2 months