From: Michael Schroeder Date: Fri, 20 Mar 2015 12:49:32 +0000 (+0100) Subject: support feature checks in testcases X-Git-Tag: 0.6.11~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86a9b39eb143facd89466457b600e3d3dffa47d5;p=thirdparty%2Flibsolv.git support feature checks in testcases --- diff --git a/ext/testcase.c b/ext/testcase.c index f0057e6c..c808c0e3 100644 --- a/ext/testcase.c +++ b/ext/testcase.c @@ -158,6 +158,15 @@ static struct selflags2str { { 0, 0 } }; +static const char *features[] = { +#ifdef ENABLE_LINKED_PACKAGES + "linked_packages", +#endif +#ifdef ENABLE_COMPLEX_DEPS + "complex_deps", +#endif + 0 +}; typedef struct strqueue { char **str; @@ -2221,6 +2230,7 @@ testcase_read(Pool *pool, FILE *fp, char *testcase, Queue *job, char **resultp, int prepared = 0; int closefp = !fp; int poolflagsreset = 0; + int missing_features = 0; if (!fp && !(fp = fopen(testcase, "r"))) { @@ -2511,6 +2521,23 @@ testcase_read(Pool *pool, FILE *fp, char *testcase, Queue *job, char **resultp, else pool_debug(pool, SOLV_ERROR, "disable: unknown package '%s'\n", pieces[2]); } + else if (!strcmp(pieces[0], "feature")) + { + int i, j; + for (i = 1; i < npieces; i++) + { + for (j = 0; features[j]; j++) + if (!strcmp(pieces[i], features[j])) + break; + if (!features[j]) + { + pool_debug(pool, SOLV_ERROR, "testcase_read: missing feature '%s'\n", pieces[i]); + missing_features++; + } + } + if (missing_features) + break; + } else { pool_debug(pool, SOLV_ERROR, "testcase_read: cannot parse command '%s'\n", pieces[0]); @@ -2531,6 +2558,13 @@ testcase_read(Pool *pool, FILE *fp, char *testcase, Queue *job, char **resultp, } if (closefp) fclose(fp); + if (missing_features) + { + solver_free(solv); + solv = 0; + if (resultflagsp) + *resultflagsp = 77; /* hack for testsolv */ + } return solv; } diff --git a/test/runtestcases b/test/runtestcases index 2edf7431..3d736630 100755 --- a/test/runtestcases +++ b/test/runtestcases @@ -3,15 +3,23 @@ cmd=$1 dir=$2 -if test -z "$dir"; then +if test -z "$cmd" -o -z "$dir"; then echo "Usage: runtestcases "; exit 1 fi ex=0 for tc in $(find $dir -name \*.t) ; do - if ! $cmd $tc > /dev/null ; then - echo "failed test: ${tc#$dir/}" + $cmd $tc >/dev/null + tex=$? + tcn="${tc#$dir/} .................................................." + tcn="${tcn:0:50}" + if test "$tex" -eq 0 ; then + echo "$tcn Passed" + elif test "$tex" -eq 77 ; then + echo "$tcn Skipped" + else + echo "$tcn***Failed" ex=1 fi done diff --git a/tools/testsolv.c b/tools/testsolv.c index 279b43bc..12829220 100644 --- a/tools/testsolv.c +++ b/tools/testsolv.c @@ -131,7 +131,7 @@ main(int argc, char **argv) if (!solv) { pool_free(pool); - exit(1); + exit(resultflags == 77 ? 77 : 1); } if (!multijob && !feof(fp))