Author: mlschroe Date: Wed Oct 24 11:59:42 2007 New Revision: 7618 URL: http://svn.opensuse.org/viewcvs/zypp?rev=7618&view=rev Log: - zero first element in idarray just in case - make runtest compare with solution2 and solution3 - do not add same language solvables multiple times, fixes one test case Modified: trunk/sat-solver/src/source.c trunk/sat-solver/src/source_solv.c trunk/sat-solver/testsuite/README.FAILS trunk/sat-solver/testsuite/deptestomatic.c trunk/sat-solver/testsuite/runtest.rb Modified: trunk/sat-solver/src/source.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/source.c?rev=7618&r1=7617&r2=7618&view=diff ============================================================================== --- trunk/sat-solver/src/source.c (original) +++ trunk/sat-solver/src/source.c Wed Oct 24 11:59:42 2007 @@ -40,7 +40,7 @@ /* * add Id to source - * olddeps = offset into idarraydata + * olddeps = old array to extend * */ @@ -54,22 +54,23 @@ idarray = source->idarraydata; idarraysize = source->idarraysize; - if (!idarray) /* check idarray size */ + if (!idarray) /* alloc idarray if not done yet */ { idarray = (Id *)xmalloc((1 + IDARRAY_BLOCK) * sizeof(Id)); + idarray[0] = 0; idarraysize = 1; source->lastoff = 0; } - if (!olddeps) /* no deps yet */ + if (!olddeps) /* no deps yet */ { olddeps = idarraysize; if ((idarraysize & IDARRAY_BLOCK) == 0) idarray = (Id *)xrealloc(idarray, (idarraysize + 1 + IDARRAY_BLOCK) * sizeof(Id)); } - else if (olddeps == source->lastoff) /* append at end */ + else if (olddeps == source->lastoff) /* extend at end */ idarraysize--; - else /* check space */ + else /* can't extend, copy old */ { i = olddeps; olddeps = idarraysize; @@ -83,12 +84,12 @@ idarray = (Id *)xrealloc(idarray, (idarraysize + 1 + IDARRAY_BLOCK) * sizeof(Id)); } - idarray[idarraysize++] = id; /* insert Id into array */ + idarray[idarraysize++] = id; /* insert Id into array */ if ((idarraysize & IDARRAY_BLOCK) == 0) /* realloc if at block boundary */ idarray = (Id *)xrealloc(idarray, (idarraysize + 1 + IDARRAY_BLOCK) * sizeof(Id)); - idarray[idarraysize++] = ID_NULL; /* ensure NULL termination */ + idarray[idarraysize++] = 0; /* ensure NULL termination */ source->idarraydata = idarray; source->idarraysize = idarraysize; @@ -183,6 +184,7 @@ { source->idarraysize = 1; source->idarraydata = (Id *)xmalloc(((1 + num + IDARRAY_BLOCK) & ~IDARRAY_BLOCK) * sizeof(Id)); + source->idarraydata[0] = 0; source->lastoff = 1; return 1; } Modified: trunk/sat-solver/src/source_solv.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/source_solv.c?rev=7618&r1=7617&r2=7618&view=diff ============================================================================== --- trunk/sat-solver/src/source_solv.c (original) +++ trunk/sat-solver/src/source_solv.c Wed Oct 24 11:59:42 2007 @@ -480,10 +480,11 @@ } if (size_idarray) { - size_idarray++; /* first entry is not used */ + size_idarray++; /* first entry is always zero */ source->idarraydata = (Id *)xmalloc(sizeof(Id) * size_idarray); source->idarraysize = size_idarray; - idarraydatap = source->idarraydata + 1; + idarraydatap = source->idarraydata; + *idarraydatap++ = 0; idarraydataend = source->idarraydata + size_idarray; } else Modified: trunk/sat-solver/testsuite/README.FAILS URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/testsuite/README.FAILS?rev=7618&r1=7617&r2=7618&view=diff ============================================================================== --- trunk/sat-solver/testsuite/README.FAILS (original) +++ trunk/sat-solver/testsuite/README.FAILS Wed Oct 24 11:59:42 2007 @@ -27,10 +27,6 @@ ./data.libzypp/bugzilla-tests/bug310618-test.xml sat-solver used to not like it, now it's just different -./data.libzypp/bugzilla-tests/bug328081-test.xml - bundle-lang-common-ko is pretty much unneeded - caused by inconsistent locale()/language mapping - # MISSINGS ./data.libzypp/bugzilla-tests/bug308252-test.xml ./data.libzypp/bugzilla-tests/bug239199-test.xml Modified: trunk/sat-solver/testsuite/deptestomatic.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/testsuite/deptestomatic.c?rev=7618&r1=7617&r2=7618&view=diff ============================================================================== --- trunk/sat-solver/testsuite/deptestomatic.c (original) +++ trunk/sat-solver/testsuite/deptestomatic.c Wed Oct 24 11:59:42 2007 @@ -506,13 +506,16 @@ static void insertLocale( Parsedata *pd, const char *name) { + Pool *pool = pd->pool; + Solvable *s; + Id id; + char locale[MAXNAMELEN]; + int i; + if (!pd->locales) { - pd->locales = pool_addsource_empty(pd->pool); - pool_freeidhashes(pd->pool); - pd->locales->name = strdup( "locales" ); - pd->locales->start = pd->pool->nsolvables; - + pd->locales = pool_addsource_empty(pool); + pd->locales->name = strdup("locales"); pd->nchannels++; pd->channels = (struct _channelmap *)realloc( pd->channels, pd->nchannels * sizeof( struct _channelmap ) ); @@ -521,35 +524,27 @@ cmap->source = pd->locales; } - char locale[MAXNAMELEN]; strcpy(locale, "language:"); strncat(locale, name, MAXNAMELEN); + id = str2id(pool, locale, 1); - Solvable s; - memset(&s, 0, sizeof(Solvable)); - s.source = pd->locales; - s.name = str2id(pd->pool, locale, 1); - s.arch = ARCH_NOARCH; - s.evr = ID_EMPTY; - - source_reserve_ids(pd->locales, 0, 2); - - s.provides = source_addid_dep(pd->locales, s.provides, str2id(pd->pool, locale, 1), 0); - -#if 0 - strcpy(locale, "Locale("); - strncat(locale, name, MAXNAMELEN); - strncat(locale, ")", MAXNAMELEN); - s.provides = source_addid_dep(pd->locales, s.provides, str2id(pd->pool, locale, 1), 0); -#endif - - pd->pool->solvables = realloc(pd->pool->solvables, (pd->pool->nsolvables + 1) * sizeof(Solvable)); - memcpy(pd->pool->solvables + pd->pool->nsolvables, &s, sizeof(Solvable)); + /* check if we already have that one */ + for (i = pd->locales->start; i < pd->locales->start + pd->locales->nsolvables; i++) + if (pool->solvables[i].name == id) + return; + + pool->solvables = realloc(pool->solvables, (pool->nsolvables + 1) * sizeof(Solvable)); + s = pool->solvables + pool->nsolvables++; pd->locales->nsolvables++; - pd->pool->nsolvables++; + memset(s, 0, sizeof(Solvable)); + s->source = pd->locales; + s->name = id; + s->arch = ARCH_NOARCH; + s->evr = ID_EMPTY; + s->provides = source_addid_dep(pd->locales, s->provides, id, 0); queuepush( &(pd->trials), SOLVER_INSTALL_SOLVABLE_PROVIDES ); - queuepush( &(pd->trials), s.name ); + queuepush( &(pd->trials), id ); } /*----------------------------------------------------------------*/ Modified: trunk/sat-solver/testsuite/runtest.rb URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/testsuite/runtest.rb?rev=7618&r1=7617&r2=7618&view=diff ============================================================================== --- trunk/sat-solver/testsuite/runtest.rb (original) +++ trunk/sat-solver/testsuite/runtest.rb Wed Oct 24 11:59:42 2007 @@ -136,6 +136,13 @@ if ( $fails.member?( rname ) ) return CompareResult::KnownFailure end + + case sname + when /\.solution[23]$/ + # we print error with solution1 + return CompareResult::UnexpectedFailure + end + STDERR.puts "#{rname} failed" system( "./diffres #{sname} #{rname}") #STDERR.puts "Solution:" @@ -170,9 +177,18 @@ rname = File.join( dir, "#{basename}.result" ) result = Solution.compare( sname, rname ) if result == CompareResult::Incomplete - sname = File.join( dir, "#{basename}.solution1" ) + sname = File.join( dir, "#{basename}.solution3" ) result = Solution.compare( sname, rname ) - # TODO: try solution2.. + case result + when CompareResult::UnexpectedFailure, CompareResult::KnownFailure, CompareResult::Incomplete + sname = File.join( dir, "#{basename}.solution2" ) + result = Solution.compare( sname, rname ) + end + case result + when CompareResult::UnexpectedFailure, CompareResult::KnownFailure, CompareResult::Incomplete + sname = File.join( dir, "#{basename}.solution1" ) + result = Solution.compare( sname, rname ) + end end if result == CompareResult::Incomplete puts "#{test} is incomplete" -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org