summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2018-11-30 12:40:57 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2018-11-30 12:40:57 +0900
commit593cf72349c7de430751446480779582c63902f5 (patch)
treeb153eb538266adc810bbdb82deede384f4192cb0 /examples
parentc948f862b552adbe2cdee24096357b887dfbb088 (diff)
downloadlibsolv-upstream/0.6.30.tar.gz
libsolv-upstream/0.6.30.tar.bz2
libsolv-upstream/0.6.30.zip
Imported Upstream version 0.6.30upstream/0.6.30
Change-Id: I534bdf20ed04de7ba12fa6f3eabbc9bc7164de6e Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/solv/solv.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/examples/solv/solv.c b/examples/solv/solv.c
index 615c83d..5ee4297 100644
--- a/examples/solv/solv.c
+++ b/examples/solv/solv.c
@@ -36,6 +36,7 @@
#include "solver.h"
#include "solverdebug.h"
#include "transaction.h"
+#include "testcase.h"
#ifdef SUSE
#include "repo_autopattern.h"
#endif
@@ -228,6 +229,7 @@ main(int argc, char **argv)
int keyname_depstr = 0;
int debuglevel = 0;
int answer, acnt = 0;
+ char *testcase = 0;
argc--;
argv++;
@@ -326,6 +328,12 @@ main(int argc, char **argv)
argc -= 2;
argv += 2;
}
+ else if (argc > 2 && !strcmp(argv[1], "--testcase"))
+ {
+ testcase = argv[2];
+ argc -= 2;
+ argv += 2;
+ }
else
break;
}
@@ -679,7 +687,15 @@ rerunsolver:
Id problem, solution;
int pcnt, scnt;
- if (!solver_solve(solv, &job))
+ pcnt = solver_solve(solv, &job);
+ if (testcase)
+ {
+ printf("Writing solver testcase:\n");
+ if (!testcase_write(solv, testcase, TESTCASE_RESULT_TRANSACTION | TESTCASE_RESULT_PROBLEMS, 0, 0))
+ printf("%s\n", pool_errstr(pool));
+ testcase = 0;
+ }
+ if (!pcnt)
break;
pcnt = solver_problem_count(solv);
printf("Found %d problems:\n", pcnt);