master - cleanup: code update and typo fix
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=803b7af7066033...
Commit: 803b7af70660332ce001c55fb9bc9e8511985421
Parent: f05c5a97c35f4a01b20cb3b31003b53348ce81d9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 3 08:38:07 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jun 3 08:42:33 2013 +0200
cleanup: code update and typo fix
Use the same style of loop for all filter functions.
Fix type compsoite -> Composite.
---
lib/filters/filter-composite.c | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/lib/filters/filter-composite.c b/lib/filters/filter-composite.c
index 1229460..c2b103d 100644
--- a/lib/filters/filter-composite.c
+++ b/lib/filters/filter-composite.c
@@ -20,13 +20,11 @@
static int _and_p(struct dev_filter *f, struct device *dev)
{
- struct dev_filter **filters = (struct dev_filter **) f->private;
+ struct dev_filter **filters;
- while (*filters) {
+ for (filters = (struct dev_filter **) f->private; *filters; ++filters)
if (!(*filters)->passes_filter(*filters, dev))
- return 0;
- filters++;
- }
+ return_0;
log_debug_devs("Using %s", dev_name(dev));
@@ -35,15 +33,13 @@ static int _and_p(struct dev_filter *f, struct device *dev)
static void _composite_destroy(struct dev_filter *f)
{
- struct dev_filter **filters = (struct dev_filter **) f->private;
+ struct dev_filter **filters;
if (f->use_count)
log_error(INTERNAL_ERROR "Destroying composite filter while in use %u times.", f->use_count);
- while (*filters) {
+ for (filters = (struct dev_filter **) f->private; *filters; ++filters)
(*filters)->destroy(*filters);
- filters++;
- }
dm_free(f->private);
dm_free(f);
@@ -65,7 +61,7 @@ static void _wipe(struct dev_filter *f)
{
struct dev_filter **filters;
- for (filters = (struct dev_filter **) f->private; *filters; filters++)
+ for (filters = (struct dev_filter **) f->private; *filters; ++filters)
if ((*filters)->wipe)
(*filters)->wipe(*filters);
}
@@ -78,7 +74,7 @@ struct dev_filter *composite_filter_create(int n, struct dev_filter **filters)
return_NULL;
if (!(filters_copy = dm_malloc(sizeof(*filters) * (n + 1)))) {
- log_error("composite filters allocation failed");
+ log_error("Composite filters allocation failed.");
return NULL;
}
@@ -86,7 +82,7 @@ struct dev_filter *composite_filter_create(int n, struct dev_filter **filters)
filters_copy[n] = NULL;
if (!(cft = dm_zalloc(sizeof(*cft)))) {
- log_error("compsoite filters allocation failed");
+ log_error("Composite filters allocation failed.");
dm_free(filters_copy);
return NULL;
}
9 years, 10 months
master - filters: dump filter returns error code
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f05c5a97c35f4a...
Commit: f05c5a97c35f4a01b20cb3b31003b53348ce81d9
Parent: 4a657a13b1c6e4570c15c14fd8acb910b106f5cf
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Jun 2 23:27:34 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jun 3 08:42:25 2013 +0200
filters: dump filter returns error code
Add int return value from dump() function.
Report stack for error case.
Update composable filter.
---
WHATS_NEW | 1 +
lib/cache/lvmcache.c | 5 +++--
lib/commands/toolcontext.c | 5 +++--
lib/device/dev-cache.h | 2 +-
lib/filters/filter-composite.c | 17 +++++++++--------
5 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index cd2d8ed..fe42b81 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Report backtrace from dump filter error path.
Do not use persistent filter with lvmetad.
Composable persistent filter functionality for global filter.
Override system's global_filter settings for vgimportclone.
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 81b8de1..6f935db 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -708,8 +708,9 @@ int lvmcache_label_scan(struct cmd_context *cmd, int full_scan)
* device cache for the benefit of short-lived processes.
*/
if (full_scan == 2 && cmd->is_long_lived &&
- cmd->dump_filter && cmd->filter && cmd->filter->dump)
- cmd->filter->dump(cmd->filter, 0);
+ cmd->dump_filter && cmd->filter && cmd->filter->dump &&
+ !cmd->filter->dump(cmd->filter, 0))
+ stack;
r = 1;
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 00887ab..c409f2a 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -1652,8 +1652,9 @@ void destroy_toolcontext(struct cmd_context *cmd)
struct dm_config_tree *cft_cmdline;
FILE *new_stream;
- if (cmd->dump_filter && cmd->filter && cmd->filter->dump)
- cmd->filter->dump(cmd->filter, 1);
+ if (cmd->dump_filter && cmd->filter && cmd->filter->dump &&
+ !cmd->filter->dump(cmd->filter, 1))
+ stack;
archive_exit(cmd);
backup_exit(cmd);
diff --git a/lib/device/dev-cache.h b/lib/device/dev-cache.h
index b886098..0d342c5 100644
--- a/lib/device/dev-cache.h
+++ b/lib/device/dev-cache.h
@@ -26,7 +26,7 @@ struct dev_filter {
int (*passes_filter) (struct dev_filter * f, struct device * dev);
void (*destroy) (struct dev_filter * f);
void (*wipe) (struct dev_filter * f);
- void (*dump) (struct dev_filter * f, int merge_existing);
+ int (*dump) (struct dev_filter * f, int merge_existing);
void *private;
unsigned use_count;
};
diff --git a/lib/filters/filter-composite.c b/lib/filters/filter-composite.c
index bc37213..1229460 100644
--- a/lib/filters/filter-composite.c
+++ b/lib/filters/filter-composite.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2013 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -49,15 +49,16 @@ static void _composite_destroy(struct dev_filter *f)
dm_free(f);
}
-static void _dump(struct dev_filter *f, int merge_existing)
+static int _dump(struct dev_filter *f, int merge_existing)
{
- struct dev_filter **filters = (struct dev_filter **) f->private;
+ struct dev_filter **filters;
- while (*filters) {
- if ((*filters)->dump)
- (*filters)->dump(*filters, merge_existing);
- filters++;
- }
+ for (filters = (struct dev_filter **) f->private; *filters; ++filters)
+ if ((*filters)->dump &&
+ !(*filters)->dump(*filters, merge_existing))
+ return_0;
+
+ return 1;
}
static void _wipe(struct dev_filter *f)
9 years, 10 months
master - filters: compile fix
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4a657a13b1c6e4...
Commit: 4a657a13b1c6e4570c15c14fd8acb910b106f5cf
Parent: 5467a3b2b70a2550eb84423a20873ad7d520907b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Jun 2 23:16:41 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Jun 2 23:16:41 2013 +0200
filters: compile fix
Add missing cast in previous commit.
---
lib/filters/filter-composite.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/filters/filter-composite.c b/lib/filters/filter-composite.c
index e183c00..bc37213 100644
--- a/lib/filters/filter-composite.c
+++ b/lib/filters/filter-composite.c
@@ -64,7 +64,7 @@ static void _wipe(struct dev_filter *f)
{
struct dev_filter **filters;
- for (filters = f->private; *filters; filters++)
+ for (filters = (struct dev_filter **) f->private; *filters; filters++)
if ((*filters)->wipe)
(*filters)->wipe(*filters);
}
9 years, 10 months
master - filters: update composable filter
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5467a3b2b70a25...
Commit: 5467a3b2b70a2550eb84423a20873ad7d520907b
Parent: 20868482dd12ab2bc77ba57d6c159fb80ad56a94
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Jun 2 21:59:57 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Jun 2 22:46:06 2013 +0200
filters: update composable filter
Last commit made dump filter only partially composable.
Add remaining functionality and also support composable wipe,
which is needed, when i.e. vgscan needs to remove cache.
(in release fix)
---
WHATS_NEW | 2 +-
lib/cache/lvmcache.c | 5 +++--
lib/commands/toolcontext.c | 2 +-
lib/device/dev-cache.h | 2 +-
lib/filters/filter-composite.c | 14 ++++++++++++--
lib/filters/filter-persistent.c | 9 ++-------
lib/filters/filter-persistent.h | 1 -
7 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index ba88915..cd2d8ed 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,7 +1,7 @@
Version 2.02.99 -
===================================
Do not use persistent filter with lvmetad.
- Update persistent filter functinality for global filter.
+ Composable persistent filter functionality for global filter.
Override system's global_filter settings for vgimportclone.
Detect maximum usable size for snapshot for lvresize.
Creation of snapshot takes at most 100% origin coverage.
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 174c133..81b8de1 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -707,8 +707,9 @@ int lvmcache_label_scan(struct cmd_context *cmd, int full_scan)
* If we are a long-lived process, write out the updated persistent
* device cache for the benefit of short-lived processes.
*/
- if (full_scan == 2 && cmd->is_long_lived && cmd->dump_filter)
- persistent_filter_dump(cmd->filter, 0);
+ if (full_scan == 2 && cmd->is_long_lived &&
+ cmd->dump_filter && cmd->filter && cmd->filter->dump)
+ cmd->filter->dump(cmd->filter, 0);
r = 1;
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index af1aa63..00887ab 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -1653,7 +1653,7 @@ void destroy_toolcontext(struct cmd_context *cmd)
FILE *new_stream;
if (cmd->dump_filter && cmd->filter && cmd->filter->dump)
- cmd->filter->dump(cmd->filter);
+ cmd->filter->dump(cmd->filter, 1);
archive_exit(cmd);
backup_exit(cmd);
diff --git a/lib/device/dev-cache.h b/lib/device/dev-cache.h
index 4119d90..b886098 100644
--- a/lib/device/dev-cache.h
+++ b/lib/device/dev-cache.h
@@ -26,7 +26,7 @@ struct dev_filter {
int (*passes_filter) (struct dev_filter * f, struct device * dev);
void (*destroy) (struct dev_filter * f);
void (*wipe) (struct dev_filter * f);
- void (*dump) (struct dev_filter * f);
+ void (*dump) (struct dev_filter * f, int merge_existing);
void *private;
unsigned use_count;
};
diff --git a/lib/filters/filter-composite.c b/lib/filters/filter-composite.c
index 0d09c04..e183c00 100644
--- a/lib/filters/filter-composite.c
+++ b/lib/filters/filter-composite.c
@@ -49,17 +49,26 @@ static void _composite_destroy(struct dev_filter *f)
dm_free(f);
}
-static void _dump(struct dev_filter *f)
+static void _dump(struct dev_filter *f, int merge_existing)
{
struct dev_filter **filters = (struct dev_filter **) f->private;
while (*filters) {
if ((*filters)->dump)
- (*filters)->dump(*filters);
+ (*filters)->dump(*filters, merge_existing);
filters++;
}
}
+static void _wipe(struct dev_filter *f)
+{
+ struct dev_filter **filters;
+
+ for (filters = f->private; *filters; filters++)
+ if ((*filters)->wipe)
+ (*filters)->wipe(*filters);
+}
+
struct dev_filter *composite_filter_create(int n, struct dev_filter **filters)
{
struct dev_filter **filters_copy, *cft;
@@ -84,6 +93,7 @@ struct dev_filter *composite_filter_create(int n, struct dev_filter **filters)
cft->passes_filter = _and_p;
cft->destroy = _composite_destroy;
cft->dump = _dump;
+ cft->wipe = _wipe;
cft->use_count = 0;
cft->private = filters_copy;
diff --git a/lib/filters/filter-persistent.c b/lib/filters/filter-persistent.c
index 7288d9d..799e7d8 100644
--- a/lib/filters/filter-persistent.c
+++ b/lib/filters/filter-persistent.c
@@ -179,7 +179,7 @@ static void _write_array(struct pfilter *pf, FILE *fp, const char *path,
fprintf(fp, "\n\t]\n");
}
-int persistent_filter_dump(struct dev_filter *f, int merge_existing)
+static int _persistent_filter_dump(struct dev_filter *f, int merge_existing)
{
struct pfilter *pf;
char *tmp_file;
@@ -274,11 +274,6 @@ out:
return r;
}
-static void _dump(struct dev_filter *f)
-{
- persistent_filter_dump(f, 1);
-}
-
static int _lookup_p(struct dev_filter *f, struct device *dev)
{
struct pfilter *pf = (struct pfilter *) f->private;
@@ -372,7 +367,7 @@ struct dev_filter *persistent_filter_create(struct dev_filter *real,
f->use_count = 0;
f->private = pf;
f->wipe = _persistent_filter_wipe;
- f->dump = _dump;
+ f->dump = _persistent_filter_dump;
return f;
diff --git a/lib/filters/filter-persistent.h b/lib/filters/filter-persistent.h
index c2eee30..58fbc10 100644
--- a/lib/filters/filter-persistent.h
+++ b/lib/filters/filter-persistent.h
@@ -22,6 +22,5 @@ struct dev_filter *persistent_filter_create(struct dev_filter *f,
const char *file);
int persistent_filter_load(struct dev_filter *f, struct dm_config_tree **cft_out);
-int persistent_filter_dump(struct dev_filter *f, int merge_existing);
#endif
9 years, 10 months
master - tests: clear write to /tmp
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=20868482dd12ab...
Commit: 20868482dd12ab2bc77ba57d6c159fb80ad56a94
Parent: 8c6f3006e742b738545e7c8d89f0c12b7eb436ec
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Jun 2 00:27:00 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Jun 2 00:50:09 2013 +0200
tests: clear write to /tmp
---
test/shell/lvresize-rounding.sh | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/test/shell/lvresize-rounding.sh b/test/shell/lvresize-rounding.sh
index ad8d9c0..26dfb49 100644
--- a/test/shell/lvresize-rounding.sh
+++ b/test/shell/lvresize-rounding.sh
@@ -28,10 +28,6 @@ lvresize -l+64 -i3 -I64 $vg/$lv1
lvresize -l+64 -i3 -I128 $vg/$lv1
#lvcreate -l100%FREE -i3 -I64 --alloc anywhere $vg
-
-dmsetup table
-
-vgcfgbackup -f /tmp/vg $vg
vgremove -f $vg
# 15 extents
@@ -52,7 +48,6 @@ check vg_field $vg vg_free_count 2
lvreduce -f -l50%LV $vg/$lv1
vgremove -f $vg
-
vgcreate -s 4M $vg "$dev1" "$dev2" "$dev3"
# Expect to play with 15 extents
9 years, 10 months
master - tests: do not expose duplicate PVs in vgimportclone.sh
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8c6f3006e742b7...
Commit: 8c6f3006e742b738545e7c8d89f0c12b7eb436ec
Parent: 65a0650135bef9bae9ce3a168e9ab2a8d9b70673
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon May 27 14:48:45 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Jun 2 00:50:09 2013 +0200
tests: do not expose duplicate PVs in vgimportclone.sh
---
test/shell/vgimportclone.sh | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/test/shell/vgimportclone.sh b/test/shell/vgimportclone.sh
index 4b66f96..0c81585 100644
--- a/test/shell/vgimportclone.sh
+++ b/test/shell/vgimportclone.sh
@@ -21,8 +21,13 @@ dd if="$dev1" of="$dev2" bs=256K count=1
aux notify_lvmetad "$dev2"
# Verify pvs works on each device to give us vgname
+aux hide_dev $dev2
check pv_field "$dev1" vg_name $vg1
+aux unhide_dev $dev2
+
+aux hide_dev $dev1
check pv_field "$dev2" vg_name $vg1
+aux unhide_dev $dev1
# Import the cloned PV to a new VG
vgimportclone --basevgname $vg2 "$dev2"
9 years, 10 months
master - tests: collect all test results in files
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=65a0650135bef9...
Commit: 65a0650135bef9bae9ce3a168e9ab2a8d9b70673
Parent: 7c89cbf03a15fe30de520d50c214cd3878518e45
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon May 27 04:26:33 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Jun 2 00:50:09 2013 +0200
tests: collect all test results in files
Use files for later processing with suffix .txt
to avoid mime type confusion.
---
test/Makefile.in | 1 +
test/lib/harness.c | 53 ++++++++++++++++++++++++++++++++++++++-------------
2 files changed, 40 insertions(+), 14 deletions(-)
diff --git a/test/Makefile.in b/test/Makefile.in
index 938dc1d..1bd1dbd 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -122,6 +122,7 @@ CMDS = lvm $(shell cat $(top_builddir)/tools/.commands)
ln -sf $(abs_top_srcdir)/test/$$f $$f; \
done; \
fi
+ mkdir -p results
touch $@
.lib-dir-stamp:
diff --git a/test/lib/harness.c b/test/lib/harness.c
index d610bf8..e80efbf 100644
--- a/test/lib/harness.c
+++ b/test/lib/harness.c
@@ -46,6 +46,8 @@ static int die = 0;
static int verbose = 0; /* >1 with timestamps */
static int interactive = 0; /* disable all redirections */
+static FILE *outfile = NULL;
+
struct subst {
const char *key;
char *value;
@@ -65,7 +67,7 @@ static void handler( int sig ) {
die = sig;
}
-static int outline(char *buf, int start, int force) {
+static int outline(FILE *out, char *buf, int start, int force) {
char *from = buf + start;
char *next = strchr(buf + start, '\n');
@@ -100,11 +102,11 @@ static int outline(char *buf, int start, int force) {
}
}
}
- fwrite(a, 1, b - a, stdout);
+ fwrite(a, 1, b - a, out);
a = b;
if ( idx >= 0 ) {
- fprintf(stdout, "%s", subst[idx].key);
+ fprintf(out, "%s", subst[idx].key);
a += strlen(subst[idx].value);
}
} while (b < line + strlen(line));
@@ -119,20 +121,18 @@ static void dump(void) {
while ( counter < readbuf_used && counter != counter_last ) {
counter_last = counter;
- counter = outline( readbuf, counter, 1 );
+ counter = outline( stdout, readbuf, counter, 1 );
}
}
-static void trickle(void) {
- static int counter_last = -1, counter = 0;
-
- if (counter_last > readbuf_used) {
- counter_last = -1;
- counter = 0;
+static void trickle(FILE *out, int *last, int *counter) {
+ if (*last > readbuf_used) {
+ *last = -1;
+ *counter = 0;
}
- while ( counter < readbuf_used && counter != counter_last ) {
- counter_last = counter;
- counter = outline( readbuf, counter, 1 );
+ while ( *counter < readbuf_used && *counter != *last ) {
+ *last = *counter;
+ *counter = outline( out, readbuf, *counter, 1 );
}
}
@@ -203,6 +203,9 @@ static void drain(void) {
int stamp = 0;
int sz;
+ static int stdout_last = -1, stdout_counter = 0;
+ static int outfile_last = -1, outfile_counter = 0;
+
while ((sz = read(fds[1], buf, sizeof(buf) - 1)) > 0) {
buf[sz] = '\0';
bp = (verbose < 2) ? buf : _append_with_stamp(buf, stamp);
@@ -216,7 +219,9 @@ static void drain(void) {
readbuf[readbuf_used] = 0;
if (verbose)
- trickle();
+ trickle(stdout, &stdout_last, &stdout_counter);
+ if (outfile)
+ trickle(outfile, &outfile_last, &outfile_counter);
}
}
@@ -307,6 +312,11 @@ static void run(int i, char *f) {
buf[127] = 0;
printf("Running %-50s ", 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) {
drain();
usleep(20000);
@@ -328,6 +338,7 @@ static void run(int i, char *f) {
failed(i, f, st);
}
clear();
+ fclose(outfile);
}
}
@@ -377,6 +388,20 @@ int main(int argc, char **argv) {
duration(start),
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;
+ }
+ fprintf(list, "%s %s\n", argv[i], result);
+ }
+ fclose(list);
+
/* print out a summary */
if (s.nfailed || s.nskipped || s.nknownfail) {
for (i = 1; i < argc; ++ i) {
9 years, 10 months
master - tests: run all the test flavours in a single batch
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7c89cbf03a15fe...
Commit: 7c89cbf03a15fe30de520d50c214cd3878518e45
Parent: 53fbf2bea3e992f1c21f5f77eacc687ce01143f5
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon May 27 03:12:03 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Jun 2 00:50:09 2013 +0200
tests: run all the test flavours in a single batch
This means that a test failure in one flavour no longer prevents all the
subsequent flavours from running. We also get an aggregate summary at
the end of the entire batch, instead of summaries interspersed with
progress output. Do not fail when flavour overrides are empty
---
test/Makefile.in | 8 +++++++-
test/lib/harness.c | 11 ++++++++++-
test/lib/test.sh | 8 ++++++++
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/test/Makefile.in b/test/Makefile.in
index 5bbd1d6..938dc1d 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -66,7 +66,13 @@ help:
@echo " T Run given test (regex)."
@echo " VERBOSE Verbose output (1), timing (2)."
-check: check_local check_cluster check_lvmetad
+check: .tests-stamp
+ VERBOSE=$(VEROSE) \
+ cluster_LVM_TEST_LOCKING=3 \
+ lvmetad_LVM_TEST_LVMETAD=1 \
+ ./lib/harness $(patsubst %,normal:%,$(RUN_BASE)) \
+ $(patsubst %,cluster:%,$(RUN_BASE)) \
+ $(patsubst %,lvmetad:%,$(RUN_BASE))
check_cluster: .tests-stamp
@echo Testing with locking_type 3
diff --git a/test/lib/harness.c b/test/lib/harness.c
index 929bfc8..d610bf8 100644
--- a/test/lib/harness.c
+++ b/test/lib/harness.c
@@ -286,7 +286,16 @@ static void run(int i, char *f) {
close(fds[0]);
close(fds[1]);
}
- execlp("bash", "bash", f, NULL);
+ char flavour[512], script[512];
+ if (strchr(f, ':')) {
+ strcpy(flavour, f);
+ *strchr(flavour, ':') = 0;
+ setenv("LVM_TEST_FLAVOUR", flavour, 1);
+ strcpy(script, strchr(f, ':') + 1);
+ } else {
+ strcpy(script, f);
+ }
+ execlp("bash", "bash", script, NULL);
perror("execlp");
fflush(stderr);
_exit(202);
diff --git a/test/lib/test.sh b/test/lib/test.sh
index 3729749..9a56a0f 100644
--- a/test/lib/test.sh
+++ b/test/lib/test.sh
@@ -56,6 +56,14 @@ cd "$TESTDIR"
echo "$TESTNAME" >TESTNAME
+if test -n "$LVM_TEST_FLAVOUR"; then
+ touch flavour_overrides
+ env | grep ^$LVM_TEST_FLAVOUR | while read var; do
+ (echo -n "export "; echo $var | sed -e s,^${LVM_TEST_FLAVOUR}_,,) >> flavour_overrides
+ done
+ . flavour_overrides
+fi
+
# Setting up symlink from $i to $TESTDIR/lib
find "$abs_top_builddir/daemons/dmeventd/plugins/" -name '*.so' \
-exec ln -s -t lib "{}" +
9 years, 10 months
master - tests: make filter extension more robust
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=53fbf2bea3e992...
Commit: 53fbf2bea3e992f1c21f5f77eacc687ce01143f5
Parent: 28160cb04a0f7c89854eccb5ed8431b33ecc9d2a
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon May 27 02:03:00 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Jun 2 00:50:09 2013 +0200
tests: make filter extension more robust
---
test/lib/aux.sh | 12 ++++++++++++
test/shell/lvconvert-thin.sh | 2 +-
test/shell/lvcreate-large-raid.sh | 2 +-
test/shell/lvcreate-large-raid10.sh | 2 +-
test/shell/lvcreate-large.sh | 2 +-
test/shell/pvcreate-operation-md.sh | 4 +++-
test/shell/snapshots-usage.sh | 3 +--
test/shell/vgsplit-stacked.sh | 2 +-
8 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 0894a66..b92f428 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -448,6 +448,18 @@ prepare_vg() {
vgcreate -c n $vg $devs
}
+extend_filter() {
+ filter=$(grep ^devices/global_filter CONFIG_VALUES | tail -n 1)
+ for rx in "$@"; do
+ filter=$(echo $filter | sed -e "s:\[:[ \"$rx\", :")
+ done
+ lvmconf "$filter"
+}
+
+extend_filter_LVMTEST() {
+ extend_filter "a|$DM_DEV_DIR/LVMTEST|"
+}
+
hide_dev() {
filter=$(grep ^devices/global_filter CONFIG_VALUES | tail -n 1)
for dev in $@; do
diff --git a/test/shell/lvconvert-thin.sh b/test/shell/lvconvert-thin.sh
index 4634aa2..a84c1d1 100644
--- a/test/shell/lvconvert-thin.sh
+++ b/test/shell/lvconvert-thin.sh
@@ -29,7 +29,7 @@ aux prepare_pvs 4 64
# build one large PV
vgcreate $vg1 $(cut -d ' ' -f -3 DEVICES)
lvcreate -s -l 100%FREE -n $lv $vg1 --virtualsize 64T
-aux lvmconf 'devices/filter = [ "a/dev\/mapper\/.*$/", "a/dev\/LVMTEST/", "r/.*/" ]'
+aux extend_filter_LVMTEST
pvcreate "$DM_DEV_DIR/$vg1/$lv"
vgcreate $vg -s 64K $(cut -d ' ' -f 4 DEVICES) "$DM_DEV_DIR/$vg1/$lv"
diff --git a/test/shell/lvcreate-large-raid.sh b/test/shell/lvcreate-large-raid.sh
index b1cb274..c0b40db 100644
--- a/test/shell/lvcreate-large-raid.sh
+++ b/test/shell/lvcreate-large-raid.sh
@@ -27,7 +27,7 @@ lvcreate -s -l 20%FREE -n $lv5 $vg --virtualsize 256T
#FIXME this should be 1024T
#check lv_field $vg/$lv size "128.00m"
-aux lvmconf 'devices/filter = [ "a/dev\/mapper\/.*$/", "a/dev\/LVMTEST/", "r/.*/" ]'
+aux extend_filter_LVMTEST
pvcreate $DM_DEV_DIR/$vg/$lv[12345]
vgcreate $vg1 $DM_DEV_DIR/$vg/$lv[12345]
diff --git a/test/shell/lvcreate-large-raid10.sh b/test/shell/lvcreate-large-raid10.sh
index e4dadbd..50dd23a 100644
--- a/test/shell/lvcreate-large-raid10.sh
+++ b/test/shell/lvcreate-large-raid10.sh
@@ -24,7 +24,7 @@ lvcreate -s -l 20%FREE -n $lv3 $vg --virtualsize 256T
lvcreate -s -l 20%FREE -n $lv4 $vg --virtualsize 256T
lvcreate -s -l 20%FREE -n $lv5 $vg --virtualsize 256T
-aux lvmconf 'devices/filter = [ "a/dev\/mapper\/.*$/", "a/dev\/LVMTEST/", "r/.*/" ]'
+aux extend_filter_LVMTEST
pvcreate $DM_DEV_DIR/$vg/$lv[12345]
vgcreate $vg1 $DM_DEV_DIR/$vg/$lv[12345]
diff --git a/test/shell/lvcreate-large.sh b/test/shell/lvcreate-large.sh
index 09e323a..63b2b03 100644
--- a/test/shell/lvcreate-large.sh
+++ b/test/shell/lvcreate-large.sh
@@ -20,7 +20,7 @@ lvcreate -s -l 100%FREE -n $lv $vg --virtualsize 1024T
#FIXME this should be 1024T
#check lv_field $vg/$lv size "128.00m"
-aux lvmconf 'devices/filter = [ "a/dev\/mapper\/.*$/", "a/dev\/LVMTEST/", "r/.*/" ]'
+aux extend_filter_LVMTEST
pvcreate $DM_DEV_DIR/$vg/$lv
vgcreate $vg1 $DM_DEV_DIR/$vg/$lv
diff --git a/test/shell/pvcreate-operation-md.sh b/test/shell/pvcreate-operation-md.sh
index 9bdc4a1..5e2a28d 100644
--- a/test/shell/pvcreate-operation-md.sh
+++ b/test/shell/pvcreate-operation-md.sh
@@ -22,7 +22,9 @@ test -f /proc/mdstat && grep -q raid0 /proc/mdstat || \
modprobe raid0 || skip
aux lvmconf 'devices/md_component_detection = 1'
-aux lvmconf 'devices/filter = [ "a|/dev/md.*|", "a/dev\/mapper\/.*$/", "r/.*/" ]'
+aux extend_filter_LVMTEST
+aux extend_filter "a|/dev/md.*|"
+
aux prepare_devs 2
# Have MD use a non-standard name to avoid colliding with an existing MD device
diff --git a/test/shell/snapshots-usage.sh b/test/shell/snapshots-usage.sh
index ae08378..1507d2a 100644
--- a/test/shell/snapshots-usage.sh
+++ b/test/shell/snapshots-usage.sh
@@ -21,10 +21,9 @@ aux prepare_vg
lvcreate -s -l 100%FREE -n $lv $vg --virtualsize 15P
+aux extend_filter_LVMTEST
aux lvmconf "activation/snapshot_autoextend_percent = 20" \
"activation/snapshot_autoextend_threshold = 50"
-aux lvmconf 'devices/filter = [ "a|dev/mapper/.*$|", "a|dev/LVMTEST|", "r|.*|" ]'
-aux lvmconf 'devices/global_filter = [ "a|dev/mapper/.*$|", "a|dev/LVMTEST|", "r|.*|" ]'
# Check usability with smallest extent size
pvcreate --setphysicalvolumesize 4T $DM_DEV_DIR/$vg/$lv
diff --git a/test/shell/vgsplit-stacked.sh b/test/shell/vgsplit-stacked.sh
index 62a5304..3256191 100644
--- a/test/shell/vgsplit-stacked.sh
+++ b/test/shell/vgsplit-stacked.sh
@@ -11,7 +11,7 @@
. lib/test
-aux lvmconf 'devices/filter = [ "a/dev\/mirror/", "a/dev\/mapper\/.*$/", "a/dev\/LVMTEST/", "r/.*/" ]'
+aux extend_filter_LVMTEST
aux prepare_pvs 3
vgcreate $vg1 "$dev1" "$dev2"
9 years, 10 months
master - tests: set up global_filter instead of just filter
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=28160cb04a0f7c...
Commit: 28160cb04a0f7c89854eccb5ed8431b33ecc9d2a
Parent: e4cb88009ac05654ffdb011e3a11fd80bfbe283e
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon May 27 00:53:03 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Jun 2 00:50:09 2013 +0200
tests: set up global_filter instead of just filter
For testing setup global_filter.
---
test/lib/aux.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index d09e1b7..0894a66 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -475,7 +475,8 @@ lvmconf() {
cat > CONFIG_VALUES <<-EOF
devices/dir = "$DM_DEV_DIR"
devices/scan = "$DM_DEV_DIR"
-devices/filter = [ "a|$DM_DEV_DIR/mirror|", "a|$DM_DEV_DIR/mapper/.*pv[0-9_]*$|", "r|.*|" ]
+devices/filter = "a|.*|"
+devices/global_filter = [ "a|$DM_DEV_DIR/mirror|", "a|$DM_DEV_DIR/mapper/.*pv[0-9_]*$|", "r|.*|" ]
devices/cache_dir = "$TESTDIR/etc"
devices/sysfs_scan = 0
devices/default_data_alignment = 1
9 years, 10 months