Skip to content

Commit

Permalink
Support orderwithrequires dependencies in testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Sep 16, 2024
1 parent 283074a commit c295980
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions ext/repo_testcase.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,19 @@ writedeps(Repo *repo, FILE *fp, const char *tag, Id key, Solvable *s, Offset off
fprintf(fp, "-%s\n", tag);
}

static void
writedeps_q(Repo *repo, FILE *fp, const char *tag, Id key, Solvable *s, Queue *q)
{
Pool *pool = repo->pool;
int i;
if (!solvable_lookup_idarray(s, key, q) || !q->count)
return;
fprintf(fp, "+%s\n", tag);
for (i = 0; i < q->count; i++)
fprintf(fp, "%s\n", testcase_dep2str(pool, q->elements[i]));
fprintf(fp, "-%s\n", tag);
}

static void
writefilelist(Repo *repo, FILE *fp, const char *tag, Solvable *s)
{
Expand Down Expand Up @@ -459,22 +472,9 @@ testcase_write_testtags(Repo *repo, FILE *fp)
writedeps(repo, fp, "Sup:", SOLVABLE_SUPPLEMENTS, s, s->supplements);
writedeps(repo, fp, "Sug:", SOLVABLE_SUGGESTS, s, s->suggests);
writedeps(repo, fp, "Enh:", SOLVABLE_ENHANCES, s, s->enhances);
if (solvable_lookup_idarray(s, SOLVABLE_PREREQ_IGNOREINST, &q))
{
int i;
fprintf(fp, "+Ipr:\n");
for (i = 0; i < q.count; i++)
fprintf(fp, "%s\n", testcase_dep2str(pool, q.elements[i]));
fprintf(fp, "-Ipr:\n");
}
if (solvable_lookup_idarray(s, SOLVABLE_CONSTRAINS, &q))
{
int i;
fprintf(fp, "+Cns:\n");
for (i = 0; i < q.count; i++)
fprintf(fp, "%s\n", testcase_dep2str(pool, q.elements[i]));
fprintf(fp, "-Cns:\n");
}
writedeps_q(repo, fp, "Ipr:", SOLVABLE_PREREQ_IGNOREINST, s, &q);
writedeps_q(repo, fp, "Cns:", SOLVABLE_CONSTRAINS, s, &q);
writedeps_q(repo, fp, "Owr:", SOLVABLE_ORDERWITHREQUIRES, s, &q);
if (s->vendor)
fprintf(fp, "=Vnd: %s\n", pool_id2str(pool, s->vendor));
if (solvable_lookup_idarray(s, SOLVABLE_BUILDFLAVOR, &q))
Expand Down Expand Up @@ -721,6 +721,9 @@ testcase_add_testtags(Repo *repo, FILE *fp, int flags)
case 'C' << 16 | 'n' << 8 | 's':
repodata_add_idarray(data, s - pool->solvables, SOLVABLE_CONSTRAINS, testcase_str2dep(pool, line + 6));
break;
case 'O' << 16 | 'w' << 8 | 'r':
repodata_add_idarray(data, s - pool->solvables, SOLVABLE_ORDERWITHREQUIRES, testcase_str2dep(pool, line + 6));
break;
case 'F' << 16 | 'l' << 8 | 'v':
repodata_add_poolstr_array(data, s - pool->solvables, SOLVABLE_BUILDFLAVOR, line + 6);
break;
Expand Down

0 comments on commit c295980

Please sign in to comment.