From: Michael Schroeder Date: Fri, 12 Nov 2021 15:52:23 +0000 (+0100) Subject: Support dumping of the transaction order in testcases X-Git-Tag: 0.7.21~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a5690d2a6fa8eab1765f0b18a18df744fe03ee2;p=thirdparty%2Flibsolv.git Support dumping of the transaction order in testcases --- diff --git a/ext/testcase.c b/ext/testcase.c index 7a9e7859..eead74b2 100644 --- a/ext/testcase.c +++ b/ext/testcase.c @@ -100,6 +100,7 @@ static struct resultflags2str { { TESTCASE_RESULT_CLEANDEPS, "cleandeps" }, { TESTCASE_RESULT_JOBS, "jobs" }, { TESTCASE_RESULT_USERINSTALLED, "userinstalled" }, + { TESTCASE_RESULT_ORDER, "order" }, { 0, 0 } }; @@ -1394,6 +1395,25 @@ testcase_solverresult(Solver *solv, int resultflags) } queue_free(&q); } + if ((resultflags & TESTCASE_RESULT_ORDER) != 0) + { + int i; + char buf[256]; + Id p; + Transaction *trans = solver_create_transaction(solv); + transaction_order(trans, 0); + for (i = 0; i < trans->steps.count; i++) + { + p = trans->steps.elements[i]; + if (pool->installed && pool->solvables[p].repo == pool->installed) + sprintf(buf, "%4d erase ", i + 1); + else + sprintf(buf, "%4d install ", i + 1); + s = pool_tmpjoin(pool, "order ", buf, testcase_solvid2str(pool, p)); + strqueue_push(&sq, s); + } + transaction_free(trans); + } if ((resultflags & TESTCASE_RESULT_ALTERNATIVES) != 0) { char *altprefix; diff --git a/ext/testcase.h b/ext/testcase.h index 5b2e573d..c69098dd 100644 --- a/ext/testcase.h +++ b/ext/testcase.h @@ -21,6 +21,7 @@ #define TESTCASE_RESULT_CLEANDEPS (1 << 9) #define TESTCASE_RESULT_JOBS (1 << 10) #define TESTCASE_RESULT_USERINSTALLED (1 << 11) +#define TESTCASE_RESULT_ORDER (1 << 12) /* reuse solver hack, testsolv use only */ #define TESTCASE_RESULT_REUSE_SOLVER (1 << 31)