master - test: Avoid hardcoding path to bash (not all systems have /bin/bash).
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c3b06ff55de528...
Commit: c3b06ff55de5288a2ac4e351176c00404bc5a0fc
Parent: a9fc137fd1de88d8713be53989e4a41ff9c9bac8
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon Jun 10 11:28:47 2013 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Mon Jun 10 15:24:55 2013 +0200
test: Avoid hardcoding path to bash (not all systems have /bin/bash).
---
test/lib/aux.sh | 2 +-
test/lib/check.sh | 2 +-
test/lib/test.sh | 2 +-
test/lib/utils.sh | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index b92f428..dc8a823 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Copyright (C) 2011-2012 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
diff --git a/test/lib/check.sh b/test/lib/check.sh
index 157434b..6cb33ac 100644
--- a/test/lib/check.sh
+++ b/test/lib/check.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Copyright (C) 2010-2012 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
diff --git a/test/lib/test.sh b/test/lib/test.sh
index 9a56a0f..7e0df73 100644
--- a/test/lib/test.sh
+++ b/test/lib/test.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Copyright (C) 2011-2012 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
diff --git a/test/lib/utils.sh b/test/lib/utils.sh
index ab5abc1..47e89bf 100644
--- a/test/lib/utils.sh
+++ b/test/lib/utils.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Copyright (C) 2011-2012 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
9 years, 9 months
master - initscripts: add pidfile reference in chkconfig header for clvmd and cmirrord
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a9fc137fd1de88...
Commit: a9fc137fd1de88d8713be53989e4a41ff9c9bac8
Parent: b24aad1622a540ab71bc9e9425bdecfc17f443c9
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Jun 7 14:07:56 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Jun 7 14:07:56 2013 +0200
initscripts: add pidfile reference in chkconfig header for clvmd and cmirrord
When the init scripts are run from within systemd, the systemd
needs to know the pidfile for it to work correctly when the
daemon itself is killed. Otherwise, systemd keeps these services
in "active" and "exited state" at the same time
(it assumes RemainAfterExit=yes without the pidfile reference in
chkconfig header).
See also https://bugzilla.redhat.com/show_bug.cgi?id=971819#c5.
---
configure | 7 +++++--
configure.in | 2 ++
scripts/clvmd_init_red_hat.in | 1 +
scripts/cmirrord_init_red_hat.in | 1 +
4 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index b167274..e8ef786 100755
--- a/configure
+++ b/configure
@@ -606,6 +606,8 @@ kernelvsn
missingkernel
kerneldir
interface
+CMIRRORD_PIDFILE
+CLVMD_PIDFILE
LVMETAD_PIDFILE
DMEVENTD_PIDFILE
WRITE_INSTALL
@@ -1588,8 +1590,7 @@ Optional Packages:
[[TYPE=internal]]
--with-mirrors=TYPE mirror support: internal/shared/none
[[TYPE=internal]]
- --with-raid=TYPE raid support: internal/shared/none
- [[TYPE=internal]]
+ --with-raid=TYPE raid support: internal/shared/none [[TYPE=internal]]
--with-replicators=TYPE replicator support: internal/shared/none
[[TYPE=none]]
--with-thin=TYPE thin provisioning support: internal/shared/none
@@ -10787,6 +10788,8 @@ LVM_LIBAPI=`echo "$VER" | $AWK -F '[()]' '{print $2}'`
+
+
################################################################################
ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/lvm2/Makefile daemons/dmeventd/plugins/raid/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile daemons/dmeventd/plugins/thin/Makefile daemons/lvmetad/Makefile doc/Makefile doc/example.conf include/.symlinks include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/replicator/Makefile lib/misc/lvm-version.h lib/raid/Makefile lib/snapshot/Makefile lib/thin/Makefile libdaemon/Makefile libdaemon/client/Makefile libdaemon/server/Makefile libdm/Makefile libdm/libdevmapper.pc liblvm/Makefile liblvm/liblvm2app.pc man/Makefile po/Makefile python/Makefile python/setup.py scripts/blkdeactivate.sh scripts/blk_availability_init_red_hat scripts/bl
k_availability_systemd_red_hat.service scripts/clvmd_init_red_hat scripts/cmirrord_init_red_hat scripts/lvm2_lvmetad_init_red_hat scripts/lvm2_lvmetad_systemd_red_hat.socket scripts/lvm2_lvmetad_systemd_red_hat.service scripts/lvm2_monitoring_init_red_hat scripts/dm_event_systemd_red_hat.socket scripts/dm_event_systemd_red_hat.service scripts/lvm2_monitoring_systemd_red_hat.service scripts/lvm2_tmpfiles_red_hat.conf scripts/Makefile test/Makefile test/api/Makefile test/unit/Makefile tools/Makefile udev/Makefile unit-tests/datastruct/Makefile unit-tests/regex/Makefile unit-tests/mm/Makefile"
diff --git a/configure.in b/configure.in
index b4dfc19..b286358 100644
--- a/configure.in
+++ b/configure.in
@@ -1599,6 +1599,8 @@ AC_SUBST(CUNIT_CFLAGS)
AC_SUBST(WRITE_INSTALL)
AC_SUBST(DMEVENTD_PIDFILE)
AC_SUBST(LVMETAD_PIDFILE)
+AC_SUBST(CLVMD_PIDFILE)
+AC_SUBST(CMIRRORD_PIDFILE)
AC_SUBST(interface)
AC_SUBST(kerneldir)
AC_SUBST(missingkernel)
diff --git a/scripts/clvmd_init_red_hat.in b/scripts/clvmd_init_red_hat.in
index 4170094..86dea4c 100644
--- a/scripts/clvmd_init_red_hat.in
+++ b/scripts/clvmd_init_red_hat.in
@@ -4,6 +4,7 @@
#
# chkconfig: - 24 76
# description: Cluster daemon for userland logical volume management tools.
+# pidfile: @CLVMD_PIDFILE@
#
# For Red-Hat-based distributions such as Fedora, RHEL, CentOS.
#
diff --git a/scripts/cmirrord_init_red_hat.in b/scripts/cmirrord_init_red_hat.in
index a715078..d4b7e37 100755
--- a/scripts/cmirrord_init_red_hat.in
+++ b/scripts/cmirrord_init_red_hat.in
@@ -2,6 +2,7 @@
#
# chkconfig: - 22 78
# description: Starts and stops cmirrord
+# pidfile: @CMIRRORD_PIDFILE@
#
# For Red-Hat-based distributions such as Fedora, RHEL, CentOS.
#
9 years, 9 months
master - tests: performance testing
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b24aad1622a540...
Commit: b24aad1622a540ab71bc9e9425bdecfc17f443c9
Parent: 215ab4c9cec497465a60b91ef53046665ed5e1d2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jun 6 12:14:53 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jun 6 12:14:53 2013 +0200
tests: performance testing
Tests speed of activation and deactivation of a lot of volumes.
Currently limited to 1000LVs
TODO: explore why lvmetad fails with higher number.
---
test/shell/vgchange-many.sh | 52 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/test/shell/vgchange-many.sh b/test/shell/vgchange-many.sh
new file mode 100644
index 0000000..491c8b1
--- /dev/null
+++ b/test/shell/vgchange-many.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# Check perfomance of activation and deactivation
+. lib/test
+
+# FIXME: lvmetad fails with i.e. 1500 device on memory failure...
+
+# Number of LVs to create
+DEVICES=1000
+
+aux prepare_pvs 1 400
+
+vgcreate -s 128K $vg $(cat DEVICES)
+
+vgcfgbackup -f data $vg
+
+# Generate a lot of devices (size of 1 extent)
+awk -v DEVICES=$DEVICES '/^\t\}/ { \
+ printf("\t}\n\tlogical_volumes {\n");\
+ cnt=0;
+ for (i = 0; i < DEVICES; i++) { \
+ printf("\t\tlvol%06d {\n", i);\
+ printf("\t\t\tid = \"%06d-1111-2222-3333-2222-1111-%06d\"\n", i, i); \
+ print "\t\t\tstatus = [\"READ\", \"WRITE\", \"VISIBLE\"]"; \
+ print "\t\t\tsegment_count = 1"; \
+ print "\t\t\tsegment1 {"; \
+ print "\t\t\t\tstart_extent = 0"; \
+ print "\t\t\t\textent_count = 1"; \
+ print "\t\t\t\ttype = \"striped\""; \
+ print "\t\t\t\tstripe_count = 1"; \
+ print "\t\t\t\tstripes = ["; \
+ print "\t\t\t\t\t\"pv0\", " cnt++; \
+ printf("\t\t\t\t]\n\t\t\t}\n\t\t}\n"); \
+ } \
+ }
+ {print}
+' data >data_new
+
+vgcfgrestore -f data_new $vg
+
+# Activate and deactivate all of them
+vgchange -ay $vg
+vgchange -an $vg
9 years, 9 months
master - tests: check for real mirror target type
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=215ab4c9cec497...
Commit: 215ab4c9cec497465a60b91ef53046665ed5e1d2
Parent: fce72434270cb1bdd14ff896cd1640bc51c93084
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jun 4 11:08:45 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jun 4 15:57:42 2013 +0200
tests: check for real mirror target type
Use new available attr instead of guessing...
---
test/lib/check.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/lib/check.sh b/test/lib/check.sh
index 48e3073..157434b 100644
--- a/test/lib/check.sh
+++ b/test/lib/check.sh
@@ -118,7 +118,7 @@ mirror() {
mirror_nonredundant() {
local lv=$1/$2
local attr=$(get lv_field $lv attr)
- (echo "$attr" | grep "^m........$" >/dev/null) || {
+ (echo "$attr" | grep "^......m..$" >/dev/null) || {
if (echo "$attr" | grep "^o........$" >/dev/null) &&
lvs -a | fgrep "[${2}_mimage" >/dev/null; then
echo "TEST WARNING: $lv is a snapshot origin and looks like a mirror,"
9 years, 9 months
master - tests: fix strings test
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fce72434270cb1...
Commit: fce72434270cb1bdd14ff896cd1640bc51c93084
Parent: c0f995050f04f075eda9025db514be08b13c9a6e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jun 4 11:07:18 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jun 4 15:57:42 2013 +0200
tests: fix strings test
For non udev path use DM_DEFAULT_NAME_MANGLING_MODE.
Skip this test when using real /dev dir, since udev is not able
to create such device name unless mangled...
---
test/shell/mdata-strings.sh | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/test/shell/mdata-strings.sh b/test/shell/mdata-strings.sh
index 95a630e..0102d4b 100644
--- a/test/shell/mdata-strings.sh
+++ b/test/shell/mdata-strings.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2008-2011 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2008-2013 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
@@ -13,10 +13,15 @@
. lib/test
+# For udev impossible to create
+test "$LVM_TEST_DEVDIR" = "/dev" && skip
+
aux prepare_devs 2
-aux lvmconf 'devices/global_filter = [ "a|.*dev/mapper/.*LVMTEST.*pv[0-9_]*$|", "r|.*|" ]'
+aux extend_filter_LVMTEST
+
+# Setup mangling to 'none' globaly for all libdm users
+export DM_DEFAULT_NAME_MANGLING_MODE=none
-# for udev impossible to create
pv_ugly="__\"!@#\$%^&*,()|@||'\\\"__pv1"
# 'set up temp files, loopback devices'
@@ -30,7 +35,8 @@ dm_table | grep -F "$pv_ugly"
created="$dev1"
# when used with real udev without fallback, it will fail here
pvcreate "$dev1" || created="$dev2"
-pvdisplay | should grep -F "$pv_ugly"
+pvdisplay 2>&1 | tee >err
+should grep -F "$pv_ugly" err
should check pv_field "$dev1" pv_name "$dev1"
vgcreate $vg "$created"
# 'no parse errors and VG really exists'
9 years, 9 months
master - tests: update test
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c0f995050f04f0...
Commit: c0f995050f04f075eda9025db514be08b13c9a6e
Parent: c8dda314666437852ffcd515e60433c66702a36e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jun 4 10:37:08 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jun 4 15:57:33 2013 +0200
tests: update test
Fix !test -> test !
---
test/shell/inconsistent-metadata.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/test/shell/inconsistent-metadata.sh b/test/shell/inconsistent-metadata.sh
index 9f4ffd2..4894861 100644
--- a/test/shell/inconsistent-metadata.sh
+++ b/test/shell/inconsistent-metadata.sh
@@ -43,7 +43,7 @@ not grep "Inconsistent metadata found for VG $vg" cmd.out
check
# only vgscan would have noticed metadata inconsistencies when lvmetad is active
-if !test -e LOCAL_LVMETAD; then
+if test ! -e LOCAL_LVMETAD; then
# vgdisplay fixes
init
vgdisplay $vg 2>&1 | tee cmd.out
@@ -77,4 +77,5 @@ aux backup_dev "$dev2"
vgcreate $vg "$dev1"
vgextend $vg "$dev2"
aux restore_dev "$dev2"
+vgscan $cache
should check compare_fields vgs $vg vg_mda_count pvs "$dev2" vg_mda_count
9 years, 9 months
master - tests: compilation updates
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c8dda314666437...
Commit: c8dda314666437852ffcd515e60433c66702a36e
Parent: 325ca748bb1abf1ff41cbd83f96b27ee020b4304
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 3 12:09:21 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jun 4 15:57:18 2013 +0200
tests: compilation updates
---
test/api/thin_percent.c | 2 +-
test/lib/harness.c | 25 +++++++++++++++----------
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/test/api/thin_percent.c b/test/api/thin_percent.c
index ae511df..0df896c 100644
--- a/test/api/thin_percent.c
+++ b/test/api/thin_percent.c
@@ -65,7 +65,7 @@ int main(int argc, char *argv[])
v = lvm_lv_get_property(lv, "snap_percent");
assert(v.is_valid);
- assert(v.value.integer == PERCENT_INVALID);
+ assert(v.value.integer == (uint64_t) PERCENT_INVALID);
v = lvm_lv_get_property(lv, "origin");
assert(v.is_valid);
diff --git a/test/lib/harness.c b/test/lib/harness.c
index ece36ec..2377116 100644
--- a/test/lib/harness.c
+++ b/test/lib/harness.c
@@ -41,7 +41,7 @@ struct stats {
static struct stats s;
static char *readbuf = NULL;
-static int readbuf_sz = 0, readbuf_used = 0;
+static size_t readbuf_sz = 0, readbuf_used = 0;
static int die = 0;
static int verbose = 0; /* >1 with timestamps */
@@ -57,11 +57,14 @@ struct subst {
static struct subst subst[2];
-#define PASSED 0
-#define SKIPPED 1
-#define FAILED 2
-#define WARNED 3
-#define KNOWNFAIL 4
+enum {
+ UNKNOWN,
+ PASSED,
+ SKIPPED,
+ FAILED,
+ WARNED,
+ KNOWNFAIL,
+};
static void handler( int sig ) {
signal( sig, SIG_DFL );
@@ -121,18 +124,18 @@ static int outline(FILE *out, char *buf, int start, int force) {
static void dump(void) {
int counter_last = -1, counter = 0;
- while ( counter < readbuf_used && counter != counter_last ) {
+ while ((counter < (int) readbuf_used) && (counter != counter_last)) {
counter_last = counter;
counter = outline( stdout, readbuf, counter, 1 );
}
}
static void trickle(FILE *out, int *last, int *counter) {
- if (*last > readbuf_used) {
+ if (*last > (int) readbuf_used) {
*last = -1;
*counter = 0;
}
- while ( *counter < readbuf_used && *counter != *last ) {
+ while ((*counter < (int) readbuf_used) && (*counter != *last)) {
*last = *counter;
*counter = outline( out, readbuf, *counter, 1 );
}
@@ -281,6 +284,8 @@ static void failed(int i, char *f, int st) {
}
static void run(int i, char *f) {
+ char flavour[512], script[512];
+
pid = fork();
if (pid < 0) {
perror("Fork failed.");
@@ -293,7 +298,6 @@ static void run(int i, char *f) {
close(fds[0]);
close(fds[1]);
}
- char flavour[512], script[512];
if (strchr(f, ':')) {
strcpy(flavour, f);
*strchr(flavour, ':') = 0;
@@ -426,6 +430,7 @@ int main(int argc, char **argv) {
case SKIPPED:
printf("skipped: %s\n", argv[i]);
break;
+ default: /* do nothing */ ;
}
}
printf("\n");
9 years, 9 months
master - tests: configurable LVM_TEST_RESULTS
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=325ca748bb1abf...
Commit: 325ca748bb1abf1ff41cbd83f96b27ee020b4304
Parent: 9b2be901ed55ff309da8e94879cacb560f21dc2b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 3 12:07:31 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jun 4 15:57:18 2013 +0200
tests: configurable LVM_TEST_RESULTS
Make LVM_TEST_RESULTS configurable
Cleanup results dir on 'make clean'
---
test/Makefile.in | 7 +++-
test/lib/harness.c | 85 +++++++++++++++++++++++++++++----------------------
2 files changed, 53 insertions(+), 39 deletions(-)
diff --git a/test/Makefile.in b/test/Makefile.in
index 1bd1dbd..b799f83 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2007-2013 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
@@ -24,6 +24,7 @@ abs_builddir = "@abs_builddir@"
abs_top_builddir = "@abs_top_builddir@"
abs_top_srcdir = "@abs_top_srcdir@"
+LVM_TEST_RESULTS ?= results
SUBDIRS = api unit
SOURCES = lib/not.c lib/harness.c
@@ -61,6 +62,7 @@ help:
@echo " LVM_TEST_LVMETAD Start lvmetad (1)."
@echo " LVM_TEST_NODEBUG Do not debug lvm commands."
@echo " LVM_TEST_PARALLEL May skip agresive wipe of LVMTEST resources."
+ @echo " LVM_TEST_RESULTS Where to create result files [results]."
@echo " LVM_VERIFY_UDEV Default verify state for lvm.conf."
@echo " S Skip given test (regex)."
@echo " T Run given test (regex)."
@@ -122,7 +124,7 @@ CMDS = lvm $(shell cat $(top_builddir)/tools/.commands)
ln -sf $(abs_top_srcdir)/test/$$f $$f; \
done; \
fi
- mkdir -p results
+ $(MKDIR_P) -m a=rwx $(LVM_TEST_RESULTS)
touch $@
.lib-dir-stamp:
@@ -138,6 +140,7 @@ CMDS = lvm $(shell cat $(top_builddir)/tools/.commands)
clean:
test "$(srcdir)" = . || $(RM) $(RUN_BASE)
+ $(RM) -r $(LVM_TEST_RESULTS)
CLEAN_TARGETS += .lib-dir-stamp .tests-stamp $(LIB) $(addprefix lib/,$(CMDS)) \
lib/clvmd lib/dmeventd lib/dmsetup lib/lvmetad lib/fsadm lib/vgimportclone
diff --git a/test/lib/harness.c b/test/lib/harness.c
index e98c7d6..ece36ec 100644
--- a/test/lib/harness.c
+++ b/test/lib/harness.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
+#include <limits.h>
static pid_t pid;
static int fds[2];
@@ -45,6 +46,7 @@ static int readbuf_sz = 0, readbuf_used = 0;
static int die = 0;
static int verbose = 0; /* >1 with timestamps */
static int interactive = 0; /* disable all redirections */
+static const char *results;
static FILE *outfile = NULL;
@@ -308,45 +310,48 @@ static void run(int i, char *f) {
int st, w;
time_t start = time(NULL);
char buf[128];
- snprintf(buf, 128, "%s ...", f);
- buf[127] = 0;
+ char outpath[PATH_MAX];
+ char *c = outpath + strlen(results) + 1;
+ snprintf(buf, sizeof(buf), "%s ...", f);
printf("Running %-60s ", buf);
fflush(stdout);
- char outpath[512];
- sprintf(outpath, "results/%s.txt", f);
- while (strchr(outpath + 8, '/'))
- *strchr(outpath + 8, '/') = '_';
- outfile = fopen(outpath, "w");
- while ((w = waitpid(pid, &st, WNOHANG)) == 0) {
+ snprintf(outpath, sizeof(outpath), "%s/%s.txt", results, f);
+ while ((c = strchr(c, '/')))
+ *c = '_';
+ if ((outfile = fopen(outpath, "w"))) {
+ while ((w = waitpid(pid, &st, WNOHANG)) == 0) {
+ drain();
+ usleep(20000);
+ }
+ if (w != pid) {
+ perror("waitpid");
+ exit(206);
+ }
drain();
- usleep(20000);
- }
- if (w != pid) {
- perror("waitpid");
- exit(206);
- }
- drain();
- if (WIFEXITED(st)) {
- if (WEXITSTATUS(st) == 0) {
- passed(i, f, start);
- } else if (WEXITSTATUS(st) == 200) {
- skipped(i, f);
- } else {
+ if (WIFEXITED(st)) {
+ if (WEXITSTATUS(st) == 0)
+ passed(i, f, start);
+ else if (WEXITSTATUS(st) == 200)
+ skipped(i, f);
+ else
+ failed(i, f, st);
+ } else
failed(i, f, st);
- }
- } else {
- failed(i, f, st);
+
+ clear();
+ fclose(outfile);
}
- clear();
- fclose(outfile);
}
}
int main(int argc, char **argv) {
+ char results_list[PATH_MAX];
+ const char *result;
const char *be_verbose = getenv("VERBOSE"),
*be_interactive = getenv("INTERACTIVE");
time_t start = time(NULL);
int i;
+ FILE *list;
if (argc >= MAX) {
fprintf(stderr, "Sorry, my head exploded. Please increase MAX.\n");
@@ -359,6 +364,10 @@ int main(int argc, char **argv) {
if (be_interactive)
interactive = atoi(be_interactive);
+ if (!(results = getenv("LVM_TEST_RESULTS")))
+ results = "results";
+ snprintf(results_list, sizeof(results_list), "%s/list", results);
+
if (socketpair(PF_UNIX, SOCK_STREAM, 0, fds)) {
perror("socketpair");
return 201;
@@ -389,18 +398,20 @@ int main(int argc, char **argv) {
s.npassed, s.nwarned, s.nfailed, s.nknownfail, s.nskipped);
/* dump a list to results */
- FILE *list = fopen("results/list", "w");
- for (i = 1; i < argc; ++ i) {
- const char *result = "unknown";
- switch (s.status[i]) {
- case PASSED: result = "passed"; break;
- case FAILED: result = "failed"; break;
- case SKIPPED: result = "skipped"; break;
- case WARNED: result = "warnings"; break;
+ if ((list = fopen(results_list, "w"))) {
+ for (i = 1; i < argc; ++ i) {
+ switch (s.status[i]) {
+ case PASSED: result = "passed"; break;
+ case FAILED: result = "failed"; break;
+ case SKIPPED: result = "skipped"; break;
+ case WARNED: result = "warnings"; break;
+ default: result = "unknown"; break;
+ }
+ fprintf(list, "%s %s\n", argv[i], result);
}
- fprintf(list, "%s %s\n", argv[i], result);
- }
- fclose(list);
+ fclose(list);
+ } else
+ perror("fopen result");
/* print out a summary */
if (s.nfailed || s.nskipped || s.nknownfail) {
9 years, 9 months
master - makefiles: cleanup update
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9b2be901ed55ff...
Commit: 9b2be901ed55ff309da8e94879cacb560f21dc2b
Parent: eb2c68590b766e25ada9d425ad0b6602cd724fcc
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 3 12:05:02 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jun 4 15:57:18 2013 +0200
makefiles: cleanup update
Cleanup also test dir.
Distclean unit tests.
---
Makefile.in | 3 +++
test/unit/Makefile.in | 12 +++++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 4d39577..ceb8964 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -38,6 +38,9 @@ endif
SUBDIRS += scripts
+ifeq ($(MAKECMDGOALS),clean)
+ SUBDIRS += test
+endif
# FIXME Should use intermediate Makefiles here!
ifeq ($(MAKECMDGOALS),distclean)
SUBDIRS = doc include man test scripts \
diff --git a/test/unit/Makefile.in b/test/unit/Makefile.in
index 740eb14..62a0077 100644
--- a/test/unit/Makefile.in
+++ b/test/unit/Makefile.in
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2011-2013 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
@@ -15,8 +15,14 @@ top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
VPATH = $(srcdir)
-ifeq ("@TESTING@", "yes")
-SOURCES = bitset_t.c matcher_t.c config_t.c string_t.c run.c
+UNITS = bitset_t.c matcher_t.c config_t.c string_t.c run.c
+
+ifeq ($(MAKECMDGOALS),distclean)
+SOURCES = $(UNITS)
+endif
+
+ifeq ("$(TESTING)", "yes")
+SOURCES = $(UNITS)
TARGETS = run
endif
9 years, 9 months
master - tests: bigger alignment
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=eb2c68590b766e...
Commit: eb2c68590b766e25ada9d425ad0b6602cd724fcc
Parent: 803b7af70660332ce001c55fb9bc9e8511985421
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Jun 2 23:57:53 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jun 3 08:42:34 2013 +0200
tests: bigger alignment
Test names got a bit longer...
---
test/lib/harness.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/lib/harness.c b/test/lib/harness.c
index e80efbf..e98c7d6 100644
--- a/test/lib/harness.c
+++ b/test/lib/harness.c
@@ -310,7 +310,7 @@ static void run(int i, char *f) {
char buf[128];
snprintf(buf, 128, "%s ...", f);
buf[127] = 0;
- printf("Running %-50s ", buf);
+ printf("Running %-60s ", buf);
fflush(stdout);
char outpath[512];
sprintf(outpath, "results/%s.txt", f);
9 years, 9 months