[augeas-devel] augeas: master - * tests/test-xpath.c (run_one_test): allow results in
David Lutterkort
lutter at fedoraproject.org
Fri Feb 6 23:29:37 UTC 2009
Gitweb: http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=64f8eb53982f3d97a7876b26f9f623a74c849fb3
Commit: 64f8eb53982f3d97a7876b26f9f623a74c849fb3
Parent: cb9cca973bce12e2c04ac24849c3dc9ea5832aa6
Author: David Lutterkort <lutter at redhat.com>
AuthorDate: Fri Feb 6 15:27:20 2009 -0800
Committer: David Lutterkort <lutter at redhat.com>
CommitterDate: Fri Feb 6 15:28:09 2009 -0800
* tests/test-xpath.c (run_one_test): allow results in
arbitrary order. Files on Fedora and Debian are enumerated
in different order, leading to spurious test failures
---
tests/test-xpath.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/tests/test-xpath.c b/tests/test-xpath.c
index 25ce47d..391f9f8 100644
--- a/tests/test-xpath.c
+++ b/tests/test-xpath.c
@@ -134,6 +134,17 @@ static void print_pv(const char *path, const char *value) {
printf(" %s\n", path);
}
+static int has_match(const char *path, char **matches, int nmatches) {
+ int found = 0;
+ for (int i=0; i < nmatches; i++) {
+ if (matches[i] != NULL && STREQ(path, matches[i])) {
+ found = 1;
+ break;
+ }
+ }
+ return found;
+}
+
static int run_one_test(struct augeas *aug, struct test *t) {
int nexp = 0, nact;
char **matches;
@@ -147,11 +158,10 @@ static int run_one_test(struct augeas *aug, struct test *t) {
result = -1;
} else {
struct entry *e;
- int i;
const char *val;
- for (e = t->entries, i = 0; e != NULL; e = e->next, i++) {
- if (!STREQ(e->path, matches[i]))
+ for (e = t->entries; e != NULL; e = e->next) {
+ if (! has_match(e->path, matches, nact))
result = -1;
if (! streqv(e->value, "...")) {
aug_get(aug, e->path, &val);
More information about the augeas-devel
mailing list