Skip to content

Commit

Permalink
testcase_read: error out if repos are added or the system is changed …
Browse files Browse the repository at this point in the history
…too late

We must not add new solvables after the considered map was created, the solver
was created, or jobs were added. We may not changed the system after jobs have
been added.

(Jobs may point inside the whatproviedes array, so we must not invalidate this
area.)
  • Loading branch information
mlschroe committed Dec 14, 2020
1 parent 926244b commit 0077ef2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ext/testcase.c
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,7 @@ testcase_read(Pool *pool, FILE *fp, const char *testcase, Queue *job, char **res
Id *genid = 0;
int ngenid = 0;
Queue autoinstq;
int oldjobsize = job ? job->count : 0;

if (resultp)
*resultp = 0;
Expand Down Expand Up @@ -2065,6 +2066,21 @@ testcase_read(Pool *pool, FILE *fp, const char *testcase, Queue *job, char **res
int prio, subprio;
const char *rdata;

if (pool->considered)
{
pool_error(pool, 0, "testcase_read: cannot add repos after packages were disabled");
continue;
}
if (solv)
{
pool_error(pool, 0, "testcase_read: cannot add repos after the solver was created");
continue;
}
if (job && job->count != oldjobsize)
{
pool_error(pool, 0, "testcase_read: cannot add repos after jobs have been created");
continue;
}
prepared = 0;
if (!poolflagsreset)
{
Expand Down Expand Up @@ -2125,6 +2141,11 @@ testcase_read(Pool *pool, FILE *fp, const char *testcase, Queue *job, char **res
int i;

/* must set the disttype before the arch */
if (job && job->count != oldjobsize)
{
pool_error(pool, 0, "testcase_read: cannot change the system after jobs have been created");
continue;
}
prepared = 0;
if (strcmp(pieces[2], "*") != 0)
{
Expand Down

0 comments on commit 0077ef2

Please sign in to comment.