Author: kkaempf
Date: Tue May 27 15:38:05 2008
New Revision: 10241
URL: http://svn.opensuse.org/viewcvs/zypp?rev=10241&view=rev
Log:
ful test coverage for initial example
Modified:
trunk/sat-solver/tools/tests/updateinfo/testdata.yaml
trunk/sat-solver/tools/tests/updateinfo/testing.rb
Modified: trunk/sat-solver/tools/tests/updateinfo/testdata.yaml
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/tools/tests/updateinfo/testdata.yaml?rev=10241&r1=10240&r2=10241&view=diff
==============================================================================
--- trunk/sat-solver/tools/tests/updateinfo/testdata.yaml (original)
+++ trunk/sat-solver/tools/tests/updateinfo/testdata.yaml Tue May 27 15:38:05 2008
@@ -1,21 +1,38 @@
fedora-imlib:
0:
+# <update from="rel-eng@fedoraproject.org" status="stable" type="security" version="1.4">
name: patch:FEDORA-2007-4594
evr: 1.4
arch: noarch
vendor: rel-eng@fedoraproject.org
# - not parsed - "patch:status": stable
+
"solvable:patchcategory": security
"solvable:summary": imlib-1.9.15-6.fc8
-# <release>Fedora 8</release>
-# <issued date="2007-12-28 16:42:30"/>
-# <references>
-# <reference href="https://bugzilla.redhat.com/show_bug.cgi?id=426091" id="426091" title="CVE-2007-3568 imlib: infinite loop DoS using crafted BMP image" type="bugzilla"/>
-# </references>
-# <description>This update includes a fix for a denial-of-service issue (CVE-2007-3568) whereby an attacker who could get an imlib-using user to view a specially-crafted BMP image could cause the user's CPU to go into an infinite loop.</description>
-# <pkglist>
-# <collection short="F8">
-# <name>Fedora 8</name>
-# <package arch="ppc64" name="imlib-debuginfo" release="6.fc8" src="http://download.fedoraproject.org/pub/fedora/linux/updates/8/ppc64/imlib-debuginfo-1.9.15-6.fc8.ppc64.rpm" version="1.9.15">
-# <filename>imlib-debuginfo-1.9.15-6.fc8.ppc64.rpm</filename>
-# True
+
+# - not parsed - <release>Fedora 8</release>
+
+ "solvable:buildtime": 2007-12-28 16:42:30
+
+# <reference href="https://bugzilla.redhat.com/show_bug.cgi?id=426091" id="426091" title="" type="bugzilla"/>
+ "update:reference:href":
+ 0: https://bugzilla.redhat.com/show_bug.cgi?id=426091
+ "update:reference:id":
+ 0: 426091
+ "update:reference:title":
+ 0: "CVE-2007-3568 imlib: infinite loop DoS using crafted BMP image"
+ "update:reference:type":
+ 0: bugzilla
+ "solvable:description": This update includes a fix for a denial-of-service issue (CVE-2007-3568) whereby an attacker who could get an imlib-using user to view a specially-crafted BMP image could cause the user's CPU to go into an infinite loop.
+
+# http://download.fedoraproject.org/pub/fedora/linux/updates/8/ppc64/imlib-deb..." version="1.9.15">
+ "update:collection:name":
+ 0: imlib-debuginfo
+ "update:collection:evr":
+ 0: 1.9.15-6.fc8
+ "update:collection:arch":
+ 0: ppc64
+ "update:collection:filename":
+ 0: imlib-debuginfo-1.9.15-6.fc8.ppc64.rpm
+ "update:reboot": True
Modified: trunk/sat-solver/tools/tests/updateinfo/testing.rb
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/tools/tests/updateinfo/testing.rb?rev=10241&r1=10240&r2=10241&view=diff
==============================================================================
--- trunk/sat-solver/tools/tests/updateinfo/testing.rb (original)
+++ trunk/sat-solver/tools/tests/updateinfo/testing.rb Tue May 27 15:38:05 2008
@@ -24,33 +24,37 @@
class ContentTest < Test::Unit::TestCase
def setup
-
- @srcpath = Pathname.new SRCPATH
- assert @srcpath.directory?
- @binpath = Pathname.new BINPATH
- assert @binpath.directory?
-
- $:.unshift( @binpath + "bindings/ruby" )
- require 'satsolver'
-
- @tag = TAG
- @tool = @binpath + "tools/updateinfoxml2solv"
- assert @tool.executable?
-
- @outpath = @binpath + "tools/tests/updateinfo"
- assert @outpath.directory?
-
- yamlpath = @srcpath + DATA
-
@logf = File.open("/tmp/output", "w")
@logf.puts "Testing started at #{Time.now}\n--"
- @logf.puts "@binpath #{@binpath}"
- @logf.puts "@tag #{@tag}"
- @logf.puts "@tool #{@tool}"
- @logf.puts "@outpath #{@outpath}"
- @logf.puts "yamlpath #{yamlpath}"
-
- @testdata = YAML.load( File.open( yamlpath ) )
+ begin
+ @srcpath = Pathname.new SRCPATH
+ assert @srcpath.directory?
+ @binpath = Pathname.new BINPATH
+ assert @binpath.directory?
+
+ $:.unshift( @binpath + "bindings/ruby" )
+ require 'satsolver'
+
+ @tag = TAG
+ @tool = @binpath + "tools/updateinfoxml2solv"
+ assert @tool.executable?
+
+ @outpath = @binpath + "tools/tests/updateinfo"
+ assert @outpath.directory?
+
+ yamlpath = @srcpath + DATA
+
+ @logf.puts "@binpath #{@binpath}"
+ @logf.puts "@tag #{@tag}"
+ @logf.puts "@tool #{@tool}"
+ @logf.puts "@outpath #{@outpath}"
+ @logf.puts "yamlpath #{yamlpath}"
+
+ @testdata = YAML.load( File.open( yamlpath ) )
+ rescue Exception => e
+ @logf.puts "**ERR #{e}"
+ raise e
+ end
end
def teardown
@logf.puts "--\nTesting ended at #{Time.now}" if @logf
@@ -104,7 +108,7 @@
end
case v
- when String, Float
+ when String, Float, TrueClass, FalseClass
assert_equal v.to_s, p.to_s
when Hash
if (p.class == Satsolver::Dependency)
@@ -150,8 +154,15 @@
p.each { |dep|
raise "Not a dependency: #{v}" unless expected.include?( dep )
}
+ elsif (p.class == Array)
+ expected = []
+ v.each { |k,v| expected << v.to_s }
+ assert_equal p.size, expected.size
+ p.each { |prop|
+ raise "Not expected in property array: #{v}" unless expected.include?( prop )
+ }
else
- raise "Don't know what to do with Hash for property/attribute #{k}"
+ raise "Don't know what to do with Hash for property/attribute #{k} of class #{p.class}"
end
else
raise "Can't handle value class #{v.class} of YAML key #{k}"
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org