From e1659dc4ce74d3c47f465103951dafff8fc0cf9f Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Fri, 30 Nov 2018 12:40:43 +0900 Subject: Imported Upstream version 0.6.28 Change-Id: I7eea26ff3eb092805c915018606cc185fa47e21f Signed-off-by: DongHun Kwak --- tools/testsolv.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'tools') diff --git a/tools/testsolv.c b/tools/testsolv.c index d0328ae..d751246 100644 --- a/tools/testsolv.c +++ b/tools/testsolv.c @@ -68,7 +68,7 @@ main(int argc, char **argv) Pool *pool; Queue job; Queue solq; - Solver *solv; + Solver *solv, *reusesolv = 0; char *result = 0; int resultflags = 0; int debuglevel = 0; @@ -140,7 +140,12 @@ main(int argc, char **argv) pool_free(pool); exit(resultflags == 77 ? 77 : 1); } - + if (reusesolv) + { + solver_free(solv); + solv = reusesolv; + reusesolv = 0; + } if (!multijob && !feof(fp)) multijob = 1; @@ -179,8 +184,8 @@ main(int argc, char **argv) solver_solve(solv, &job); solv->solution_callback = 0; solv->solution_callback_data = 0; - if (!resultflags) - resultflags = TESTCASE_RESULT_TRANSACTION | TESTCASE_RESULT_PROBLEMS; + if ((resultflags & ~TESTCASE_RESULT_REUSE_SOLVER) == 0) + resultflags |= TESTCASE_RESULT_TRANSACTION | TESTCASE_RESULT_PROBLEMS; myresult = testcase_solverresult(solv, resultflags); if (rescallback && reportsolutiondata.result) { @@ -292,8 +297,13 @@ main(int argc, char **argv) } } queue_free(&job); - solver_free(solv); + if ((resultflags & TESTCASE_RESULT_REUSE_SOLVER) != 0 && !feof(fp)) + reusesolv = solv; + else + solver_free(solv); } + if (reusesolv) + solver_free(reusesolv); pool_free(pool); fclose(fp); } -- cgit v1.2.3