Permalink
Browse files

- fix testcase writing bugs

  • Loading branch information...
1 parent 39a6061 commit d5986ae653dc3364ff444789e4a4e5a0119dd926 @mlschroe mlschroe committed Jun 22, 2012
Showing with 35 additions and 5 deletions.
  1. +1 −1 .travis.yml
  2. +33 −3 ext/testcase.c
  3. +1 −1 tools/cudftest.c
View
@@ -1,5 +1,5 @@
language: C
before_script: sudo apt-get install cmake
-script: mkdir build && cd build && cmake -DDEBIAN=1 .. && make && make test
+script: mkdir build && cd build && cmake -DDEBIAN=1 -DMULTI_SEMANTICS=1 .. && make && make test
View
@@ -108,6 +108,15 @@ static struct poolflags2str {
{ 0, 0, 0 }
};
+static struct disttype2str {
+ Id type;
+ const char *str;
+} disttype2str[] = {
+ { DISTTYPE_RPM, "rpm" },
+ { DISTTYPE_DEB, "deb" },
+ { DISTTYPE_ARCH, "arch" },
+ { 0, 0 },
+};
typedef struct strqueue {
char **str;
@@ -1475,7 +1484,7 @@ testcase_write(Solver *solv, char *dir, int resultflags, const char *testcasenam
}
/* hmm, this is not optimal... we currently search for the lowest score */
lowscore = 0;
- arch = ARCH_NOARCH;
+ arch = pool->solvables[SYSTEMSOLVABLE].arch;
for (i = 0; i < pool->lastarch; i++)
{
if (pool->id2arch[i] == 1 && !lowscore)
@@ -1486,7 +1495,11 @@ testcase_write(Solver *solv, char *dir, int resultflags, const char *testcasenam
lowscore = pool->id2arch[i];
}
}
- cmd = pool_tmpjoin(pool, "system ", pool_id2str(pool, arch), pool->disttype == DISTTYPE_DEB ? " deb" : " rpm");
+ cmd = pool_tmpjoin(pool, "system ", pool->lastarch ? pool_id2str(pool, arch) : "unset", 0);
+ for (i = 0; disttype2str[i].str != 0; i++)
+ if (pool->disttype == disttype2str[i].type)
+ break;
+ pool_tmpappend(pool, cmd, " ", disttype2str[i].str ? disttype2str[i].str : "unknown");
if (pool->installed)
cmd = pool_tmpappend(pool, cmd, " ", testcase_repoid2str(pool, pool->installed->repoid));
strqueue_push(&sq, cmd);
@@ -1832,8 +1845,25 @@ testcase_read(Pool *pool, FILE *fp, char *testcase, Queue *job, char **resultp,
}
else if (!strcmp(pieces[0], "system") && npieces >= 3)
{
+ int i;
prepared = 0;
- pool_setarch(pool, pieces[1]);
+ if (strcmp(pieces[1], "unset") != 0)
+ pool_setarch(pool, pieces[1]);
+ else
+ pool_setarch(pool, 0);
+ for (i = 0; disttype2str[i].str != 0; i++)
+ if (!strcmp(disttype2str[i].str, pieces[2]))
+ break;
+ if (!disttype2str[i].str)
+ pool_debug(pool, SOLV_ERROR, "testcase_read: system: unknown disttype '%s'\n", pieces[2]);
+ else if (pool->disttype != disttype2str[i].type)
+ {
+#ifdef MULTI_SEMANTICS
+ pool_setdisttype(pool, disttype2str[i].type);
+#else
+ pool_debug(pool, SOLV_ERROR, "testcase_read: system: cannot change disttype to '%s'\n", pieces[2]);
+#endif
+ }
if (npieces > 3)
{
Repo *repo = testcase_str2repo(pool, pieces[3]);
View
@@ -100,7 +100,7 @@ main(int argc, char **argv)
solver_set_flag(solv, SOLVER_FLAG_ALLOW_UNINSTALL, 1);
/* solver_set_flag(solv, SOLVER_FLAG_IGNORE_RECOMMENDED, 1); */
- queue_push2(&job, SOLVER_VERIFY, SOLVER_SOLVABLE_ALL);
+ queue_push2(&job, SOLVER_VERIFY | SOLVER_SOLVABLE_ALL, 0);
if (solver_solve(solv, &job) != 0)
{
int problem;

0 comments on commit d5986ae

Please sign in to comment.