summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2013-06-18 15:02:39 +0200
committerMichael Schroeder <mls@suse.de>2013-06-18 15:02:39 +0200
commit92536a707c84772076aac0ea522df8052ec5b390 (patch)
tree123ace874517338aa0f09d6866f8a4556379b91a /tools
parent2dc4a88c28e2e0413873db77725aa17ff5b5a121 (diff)
downloadlibsolv-92536a707c84772076aac0ea522df8052ec5b390.tar.gz
libsolv-92536a707c84772076aac0ea522df8052ec5b390.tar.bz2
libsolv-92536a707c84772076aac0ea522df8052ec5b390.zip
testsolv: add '-l <selection>' option to list packages instead of running the test
Diffstat (limited to 'tools')
-rw-r--r--tools/testsolv.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/tools/testsolv.c b/tools/testsolv.c
index 981fc1f..adcaeeb 100644
--- a/tools/testsolv.c
+++ b/tools/testsolv.c
@@ -5,6 +5,7 @@
#include "pool.h"
#include "repo.h"
#include "solver.h"
+#include "selection.h"
#include "solverdebug.h"
#include "testcase.h"
@@ -40,9 +41,10 @@ main(int argc, char **argv)
int multijob = 0;
int c;
int ex = 0;
+ const char *list = 0;
FILE *fp;
- while ((c = getopt(argc, argv, "vrh")) >= 0)
+ while ((c = getopt(argc, argv, "vrhl:")) >= 0)
{
switch (c)
{
@@ -55,6 +57,9 @@ main(int argc, char **argv)
case 'h':
usage(0);
break;
+ case 'l':
+ list = optarg;
+ break;
default:
usage(1);
break;
@@ -90,7 +95,24 @@ main(int argc, char **argv)
if (multijob)
printf("test %d:\n", multijob++);
- if (result || writeresult)
+ if (list)
+ {
+ queue_empty(&job);
+ selection_make(pool, &job, list, SELECTION_NAME|SELECTION_PROVIDES|SELECTION_FILELIST|SELECTION_CANON|SELECTION_DOTARCH|SELECTION_REL|SELECTION_GLOB|SELECTION_FLAT);
+ if (!job.elements)
+ printf("No match\n");
+ else
+ {
+ Queue q;
+ int i;
+ queue_init(&q);
+ selection_solvables(pool, &job, &q);
+ for (i = 0; i < q.count; i++)
+ printf(" - %s\n", testcase_solvid2str(pool, q.elements[i]));
+ queue_free(&q);
+ }
+ }
+ else if (result || writeresult)
{
char *myresult, *resultdiff;
solver_solve(solv, &job);