diff options
author | Michael Schroeder <mls@suse.de> | 2014-03-05 16:35:44 +0100 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2014-03-05 16:35:44 +0100 |
commit | 39d93f621a77e4553ffc80196d901d4aeccdfbe0 (patch) | |
tree | ab485c55f01ed40af7abaae4968229091f1425ee /ext | |
parent | 147d0ddffe2334f8bf98fff630eb378d20a367f6 (diff) | |
download | libsolv-39d93f621a77e4553ffc80196d901d4aeccdfbe0.tar.gz libsolv-39d93f621a77e4553ffc80196d901d4aeccdfbe0.tar.bz2 libsolv-39d93f621a77e4553ffc80196d901d4aeccdfbe0.zip |
testcase: support filtering in unneeded check, support setting of result flags without having a result
Diffstat (limited to 'ext')
-rw-r--r-- | ext/testcase.c | 56 |
1 files changed, 42 insertions, 14 deletions
diff --git a/ext/testcase.c b/ext/testcase.c index a1c8ee6..c8456e8 100644 --- a/ext/testcase.c +++ b/ext/testcase.c @@ -380,7 +380,21 @@ testcase_str2dep_complex(Pool *pool, const char **sp) { const char *s = *sp; Id id; - id = testcase_str2dep_simple(pool, &s); +#ifdef ENABLE_COMPLEX_DEPS + while (*s == ' ' || *s == '\t') + s++; + if (*s == '(') + { + s++; + id = testcase_str2dep_complex(pool, &s); + if (*s == ')') + s++; + while (*s == ' ' || *s == '\t') + s++; + } + else +#endif + id = testcase_str2dep_simple(pool, &s); if (*s == '|') { s++; @@ -1582,16 +1596,26 @@ testcase_solverresult(Solver *solv, int resultflags) if ((resultflags & TESTCASE_RESULT_UNNEEDED) != 0) { - Queue q; + Queue q, qf; queue_init(&q); + queue_init(&qf); solver_get_unneeded(solv, &q, 0); - for (i = 0; i < q.count; i++) + solver_get_unneeded(solv, &qf, 1); + for (i = j = 0; i < q.count; i++) { - s = pool_tmpjoin(pool, "unneeded ", testcase_solvid2str(pool, q.elements[i]), 0); + /* we rely on qf containing a subset of q in the same order */ + if (j < qf.count && q.elements[i] == qf.elements[j]) + { + s = pool_tmpjoin(pool, "unneeded_filtered ", testcase_solvid2str(pool, q.elements[i]), 0); + j++; + } + else + s = pool_tmpjoin(pool, "unneeded ", testcase_solvid2str(pool, q.elements[i]), 0); strqueue_push(&sq, s); } queue_free(&q); + queue_free(&qf); } strqueue_sort(&sq); @@ -2162,22 +2186,26 @@ testcase_read(Pool *pool, FILE *fp, char *testcase, Queue *job, char **resultp, for (i = 1; i < npieces; i++) testcase_setsolverflags(solv, pieces[i]); } - else if (!strcmp(pieces[0], "result") && npieces > 2) + else if (!strcmp(pieces[0], "result") && npieces > 1) { char *result = 0; int resultflags = str2resultflags(pool, pieces[1]); - const char *rdata = pool_tmpjoin(pool, testcasedir, pieces[2], 0); - if (!strcmp(pieces[2], "<inline>")) - result = read_inline_file(fp, &buf, &bufp, &bufl); - else + const char *rdata; + if (npieces > 2) { - FILE *rfp = fopen(rdata, "r"); - if (!rfp) - pool_debug(pool, SOLV_ERROR, "testcase_read: could not open '%s'\n", rdata); + rdata = pool_tmpjoin(pool, testcasedir, pieces[2], 0); + if (!strcmp(pieces[2], "<inline>")) + result = read_inline_file(fp, &buf, &bufp, &bufl); else { - result = read_file(rfp); - fclose(rfp); + FILE *rfp = fopen(rdata, "r"); + if (!rfp) + pool_debug(pool, SOLV_ERROR, "testcase_read: could not open '%s'\n", rdata); + else + { + result = read_file(rfp); + fclose(rfp); + } } } if (resultp) |