diff options
Diffstat (limited to 'ext/testcase.c')
-rw-r--r-- | ext/testcase.c | 57 |
1 files changed, 51 insertions, 6 deletions
diff --git a/ext/testcase.c b/ext/testcase.c index 1f19be1..aa72a8d 100644 --- a/ext/testcase.c +++ b/ext/testcase.c @@ -86,6 +86,7 @@ static struct resultflags2str { { TESTCASE_RESULT_GENID, "genid" }, { TESTCASE_RESULT_REASON, "reason" }, { TESTCASE_RESULT_CLEANDEPS, "cleandeps" }, + { TESTCASE_RESULT_JOBS, "jobs" }, { 0, 0 } }; @@ -169,6 +170,10 @@ static struct selflags2str { { SELECTION_NOCASE, "nocase" }, { SELECTION_SOURCE_ONLY, "sourceonly" }, { SELECTION_WITH_SOURCE, "withsource" }, + { SELECTION_SKIP_KIND, "skipkind" }, + { SELECTION_MATCH_DEPSTR, "depstr" }, + { SELECTION_WITH_DISABLED, "withdisabled" }, + { SELECTION_WITH_BADARCH, "withbadarch" }, { 0, 0 } }; @@ -1123,12 +1128,13 @@ testcase_str2job(Pool *pool, const char *str, Id *whatp) } static int -addselectionjob(Pool *pool, char **pieces, int npieces, Queue *jobqueue) +addselectionjob(Pool *pool, char **pieces, int npieces, Queue *jobqueue, int keyname) { Id job; int i, r; int selflags; Queue sel; + char *sp; for (i = 0; job2str[i].str; i++) if (!strcmp(pieces[0], job2str[i].str)) @@ -1149,9 +1155,18 @@ addselectionjob(Pool *pool, char **pieces, int npieces, Queue *jobqueue) } if (npieces < 4) return pool_error(pool, -1, "selstr2job: no selection flags"); - selflags = str2selflags(pool, pieces[3]); + selflags = str2selflags(pool, pieces[npieces - 1]); + /* re-join pieces */ + for (sp = pieces[2]; sp < pieces[npieces - 2]; sp++) + if (*sp == 0) + *sp = ' '; queue_init(&sel); - r = selection_make(pool, &sel, pieces[2], selflags); + if (keyname > 0) + r = selection_make_matchdeps(pool, &sel, pieces[2], selflags, keyname, 0); + else if (keyname < 0) + r = selection_make_matchdepid(pool, &sel, testcase_str2dep(pool, pieces[2]), selflags, -keyname, 0); + else + r = selection_make(pool, &sel, pieces[2], selflags); for (i = 0; i < sel.count; i += 2) queue_push2(jobqueue, job | sel.elements[i], sel.elements[i + 1]); queue_free(&sel); @@ -1366,12 +1381,13 @@ testcase_add_testtags(Repo *repo, FILE *fp, int flags) if (*line != '=' || !line[1] || !line[2] || !line[3] || line[4] != ':') continue; tag = line[1] << 16 | line[2] << 8 | line[3]; + /* tags that do not need a solvable */ switch(tag) - { + { case 'V' << 16 | 'e' << 8 | 'r': tagsversion = atoi(line + 6); addselfprovides = tagsversion < 3 || strstr(line + 6, "addselfprovides") != 0; - break; + continue; case 'P' << 16 | 'k' << 8 | 'g': if (s) { @@ -1390,7 +1406,15 @@ testcase_add_testtags(Repo *repo, FILE *fp, int flags) sp[2][-1] = '-'; s->evr = makeevr(pool, sp[1]); s->arch = pool_str2id(pool, sp[3], 1); + continue; + default: break; + } + if (!s) + continue; + /* tags that need a solvable */ + switch(tag) + { case 'S' << 16 | 'u' << 8 | 'm': repodata_set_str(data, s - pool->solvables, SOLVABLE_SUMMARY, line + 6); break; @@ -2120,6 +2144,15 @@ testcase_solverresult(Solver *solv, int resultflags) } queue_free(&q); } + if ((resultflags & TESTCASE_RESULT_JOBS) != 0) + { + for (i = 0; i < solv->job.count; i += 2) + { + s = (char *)testcase_job2str(pool, solv->job.elements[i], solv->job.elements[i + 1]); + s = pool_tmpjoin(pool, "job ", s, 0); + strqueue_push(&sq, s); + } + } strqueue_sort(&sq); result = strqueue_join(&sq); strqueue_free(&sq); @@ -2702,7 +2735,19 @@ testcase_read(Pool *pool, FILE *fp, const char *testcase, Queue *job, char **res } if (npieces >= 3 && !strcmp(pieces[2], "selection")) { - addselectionjob(pool, pieces + 1, npieces - 1, job); + addselectionjob(pool, pieces + 1, npieces - 1, job, 0); + continue; + } + if (npieces >= 4 && !strcmp(pieces[2], "selection_matchdeps")) + { + pieces[2] = pieces[1]; + addselectionjob(pool, pieces + 2, npieces - 2, job, pool_str2id(pool, pieces[3], 1)); + continue; + } + if (npieces >= 4 && !strcmp(pieces[2], "selection_matchdepid")) + { + pieces[2] = pieces[1]; + addselectionjob(pool, pieces + 2, npieces - 2, job, -pool_str2id(pool, pieces[3], 1)); continue; } /* rejoin */ |