[svn:parrot] r46140 - in trunk/t/pmc: . testlib

NotFound at svn.parrot.org NotFound at svn.parrot.org
Thu Apr 29 14:52:23 UTC 2010


Author: NotFound
Date: Thu Apr 29 14:52:22 2010
New Revision: 46140
URL: https://trac.parrot.org/parrot/changeset/46140

Log:
more improvement of packfile pmc tests

Modified:
   trunk/t/pmc/packfile.t
   trunk/t/pmc/packfileconstanttable.t
   trunk/t/pmc/packfiledirectory.t
   trunk/t/pmc/packfilefixupentry.t
   trunk/t/pmc/packfilefixuptable.t
   trunk/t/pmc/packfilerawsegment.t
   trunk/t/pmc/testlib/packfile_common.pir

Modified: trunk/t/pmc/packfile.t
==============================================================================
--- trunk/t/pmc/packfile.t	Thu Apr 29 14:04:16 2010	(r46139)
+++ trunk/t/pmc/packfile.t	Thu Apr 29 14:52:22 2010	(r46140)
@@ -39,18 +39,6 @@
 .end
 
 
-# Report no ok for loading packfile failures
-.sub report_load_error
-    .param pmc except
-    .param string desc
-    .local string msg, aux
-    msg = concat desc, ' - error loading packfile: '
-    aux = except['message']
-    msg = concat msg, aux
-    ok(0, msg)
-.end
-
-
 # Packfile constructor
 .sub 'test_new'
     .local pmc pf
@@ -188,6 +176,7 @@
     .return()
 load_error:
     .get_results($P0)
+    pop_eh
     report_load_error($P0, 'get_directory')
     .return()
 .end
@@ -204,6 +193,7 @@
     .tailcall _check_header(pf)
 load_error:
     .get_results($P0)
+    pop_eh
     report_load_error($P0, "Wordsize set")
     report_load_error($P0, "version_major set")
     report_load_error($P0, "bytecode_major set")
@@ -328,6 +318,7 @@
     .return()
 load_error:
     .get_results($P0)
+    pop_eh
     report_load_error($P0, 'pack produced same result twice')
     .return()
 .end
@@ -357,6 +348,7 @@
     .return()
 load_error:
     .get_results($P0)
+    pop_eh
     report_load_error($P0, "pack and get_string are synonyms")
     report_load_error($P0, "unpack and set_string are synonyms")
     .return()

Modified: trunk/t/pmc/packfileconstanttable.t
==============================================================================
--- trunk/t/pmc/packfileconstanttable.t	Thu Apr 29 14:04:16 2010	(r46139)
+++ trunk/t/pmc/packfileconstanttable.t	Thu Apr 29 14:52:22 2010	(r46140)
@@ -36,14 +36,21 @@
 .end
 
 
-
 # sanity check we have a PackfileConstantTable
 .sub 'test_sanity'
     .local pmc pbc, pftable
     .local string name
+    push_eh load_error
     pbc     = _pbc()
+    pop_eh
     pftable = _get_consttable(pbc)
     isa_ok(pftable, "PackfileConstantTable")
+    .return ()
+load_error:
+    .get_results($P0)
+    pop_eh
+    report_load_error($P0, "PackfileConstantTable")
+    .return()
 .end
 
 
@@ -51,10 +58,18 @@
 .sub 'test_elements'
     .local pmc pf, pftable
     .local int size
+    push_eh load_error
     pf      = _pbc()
+    pop_eh
     pftable = _get_consttable(pf)
     size    = elements pftable
     ok(size, "PackfileConstantTable.elements returns non-zero")
+    .return ()
+load_error:
+    .get_results($P0)
+    pop_eh
+    report_load_error($P0, "PackfileConstantTable.elements returns non-zero")
+    .return()
 .end
 
 
@@ -62,7 +77,9 @@
 .sub 'test_get'
     .local pmc pf, pftable
     .local int size, this, type
+    push_eh load_error
     pf      = _pbc()
+    pop_eh
     pftable = _get_consttable(pf)
     size    = elements pftable
     this    = 0
@@ -103,6 +120,11 @@
   bad:
     ok(0, 'Unknown constant type')
     .return()
+load_error:
+    .get_results($P0)
+    pop_eh
+    report_load_error($P0, 'PackfileConstantTable.get_*_int works')
+    .return()
 .end
 
 # Test setting constants into PackfileConstantTable

Modified: trunk/t/pmc/packfiledirectory.t
==============================================================================
--- trunk/t/pmc/packfiledirectory.t	Thu Apr 29 14:04:16 2010	(r46139)
+++ trunk/t/pmc/packfiledirectory.t	Thu Apr 29 14:52:22 2010	(r46140)
@@ -30,6 +30,7 @@
     'test_set_pmc_keyed_str'()
 .end
 
+
 # Test creation of fresh directory
 .sub 'test_create'
     .local pmc dir, seg
@@ -62,10 +63,18 @@
 # PackfileDirectory.elements
 .sub 'test_elements'
     .local pmc pf, pfdir
+    push_eh load_error
     pf    = _pbc()
+    pop_eh
     pfdir = pf.'get_directory'()
     $I0   = elements pfdir
     is($I0, 4, 'PackfileDirectory.elements')
+    .return()
+load_error:
+    .get_results($P0)
+    pop_eh
+    report_load_error($P0, 'PackfileDirectory.elements')
+    .return()
 .end
 
 
@@ -80,7 +89,9 @@
     expected["FIXUP"]    = 1
     expected["CONSTANT"] = 1
 
+    push_eh load_error
     pf    = _pbc()
+    pop_eh
     pfdir = pf.'get_directory'()
     $I0   = elements pfdir
     it    = iter pfdir
@@ -105,12 +116,20 @@
     goto loop
   done:
     .return ()
+load_error:
+    .get_results($P0)
+    pop_eh
+    report_load_error($P0, "can't run get_iter tests")
+    skip(11, "can't run get_iter tests")
+    .return()
 .end
 
 ## PackfileDirectory.set_pmc_keyed_str
 .sub 'test_set_pmc_keyed_str'
     .local pmc pf, pfdir, seg
+    push_eh load_error
     pf    = _pbc()
+    pop_eh
     pfdir = pf.'get_directory'()
     seg   = new [ 'PackfileRawSegment' ]
 
@@ -140,6 +159,13 @@
 
   done:
     .return()
+load_error:
+    .get_results($P0)
+    pop_eh
+    report_load_error($P0, "Segment with old name was added")
+    report_load_error($P0, "New segment added")
+    report_load_error($P0, "segment deleted")
+    .return()
 .end
 
 # Local Variables:

Modified: trunk/t/pmc/packfilefixupentry.t
==============================================================================
--- trunk/t/pmc/packfilefixupentry.t	Thu Apr 29 14:04:16 2010	(r46139)
+++ trunk/t/pmc/packfilefixupentry.t	Thu Apr 29 14:52:22 2010	(r46140)
@@ -35,9 +35,17 @@
 .sub 'test_sanity'
     .local pmc pf, pftable
     .local string name
+    push_eh load_error
     pf      = _pbc()
+    pop_eh
     pftable = _get_fixup_table(pf)
     isa_ok(pftable, 'PackfileFixupTable')
+    .return()
+load_error:
+    .get_results($P0)
+    pop_eh
+    report_load_error($P0, 'PackfileFixupTable')
+    .return()
 .end
 
 
@@ -45,10 +53,18 @@
 .sub 'test_sanity_entry'
     .local pmc pf, pftable, pfentry
     .local string name
+    push_eh load_error
     pf      = _pbc()
+    pop_eh
     pftable = _get_fixup_table(pf)
     pfentry = pftable[0]
     isa_ok(pfentry, 'PackfileFixupEntry')
+    .return()
+load_error:
+    .get_results($P0)
+    pop_eh
+    report_load_error($P0, 'PackfileFixupEntry')
+    .return()
 .end
 
 
@@ -57,7 +73,9 @@
     .local pmc pf, pftable, pfentry
     .local int size, this, data
     .local string name, label
+    push_eh load_error
     pf      = _pbc()
+    pop_eh
     pftable = _get_fixup_table(pf)
     size    = elements pftable
     this    = 0
@@ -79,6 +97,12 @@
     gt size, 0, done
   done:
     ok(1, "Got entries")
+    .return()
+load_error:
+    .get_results($P0)
+    pop_eh
+    report_load_error($P0, "Got entries")
+    .return()
 .end
 
 # Local Variables:

Modified: trunk/t/pmc/packfilefixuptable.t
==============================================================================
--- trunk/t/pmc/packfilefixuptable.t	Thu Apr 29 14:04:16 2010	(r46139)
+++ trunk/t/pmc/packfilefixuptable.t	Thu Apr 29 14:52:22 2010	(r46140)
@@ -28,12 +28,27 @@
     test_unpack()
 .end
 
+
+# Report no ok for loading packfile failures
+.sub report_load_error
+    .param pmc except
+    .param string desc
+    .local string msg, aux
+    msg = concat desc, ' - error loading packfile: '
+    aux = except['message']
+    msg = concat msg, aux
+    ok(0, msg)
+.end
+
+
 # Check unpackging FixupTable
 .sub 'test_unpack'
     .local pmc pf, pfdir, pftable, pfentry
     .local int size, this, data
     .local string name
+    push_eh load_error
     pf      = _pbc()
+    pop_eh
     pftable = _get_fixup_table(pf)
     isa_ok(pftable, 'PackfileFixupTable')
 
@@ -59,6 +74,13 @@
     gt size, 0, done
   done:
     ok(1, "All elements of Table are Entries")
+    .return()
+load_error:
+    .get_results($P0)
+    pop_eh
+    report_load_error($P0, "All elements of Table are Entries")
+    skip(2, "All elements of Table are Entries")
+    .return()
 .end
 
 # Local Variables:

Modified: trunk/t/pmc/packfilerawsegment.t
==============================================================================
--- trunk/t/pmc/packfilerawsegment.t	Thu Apr 29 14:04:16 2010	(r46139)
+++ trunk/t/pmc/packfilerawsegment.t	Thu Apr 29 14:52:22 2010	(r46140)
@@ -35,17 +35,27 @@
 # PackfileRawSegment.elements
 .sub 'test_elements'
     .local pmc pf, pfdir, pfseg
+    push_eh load_error
     pf    = _pbc()
+    pop_eh
     pfdir = pf.'get_directory'()
     pfseg = '_find_segment_by_prefix'(pf, 'BYTECODE')
     $I0   = elements pfseg
     ok($I0, 'PackfileRawSegment contains some data')
+    .return()
+load_error:
+    .get_results($P0)
+    pop_eh
+    report_load_error($P0, 'PackfileRawSegment contains some data')
+    .return()
 .end
 
 # PackfileRawSegment.get_integer_keyed_int
 .sub 'test_get_integer'
     .local pmc pf, pfdir, pfseg
+    push_eh load_error
     pf    = _pbc()
+    pop_eh
     pfdir = pf.'get_directory'()
     pfseg = '_find_segment_by_prefix'(pf, 'BYTECODE')
 
@@ -61,6 +71,12 @@
     $I1   = pfseg[4]
     $I0   = $I0 + $I1
     ok($I0, "PackfileRawSegment.get_integer_keyed_int returns some data")
+    .return()
+load_error:
+    .get_results($P0)
+    pop_eh
+    report_load_error($P0, "PackfileRawSegment.get_integer_keyed_int returns some data")
+    .return()
 .end
 
 # PackfileRawSegment.push_integer
@@ -79,7 +95,9 @@
 # PackfileRawSegment.type
 .sub 'test_type'
     .local pmc pf, pfdir, pfseg, hash, it
+    push_eh load_error
     pf    = _pbc()
+    pop_eh
     pfdir = pf.'get_directory'()
     hash  = new ['Hash']
     # annotations.pbc contains all available segments. -1 for directory and unknown.
@@ -105,7 +123,13 @@
     $P0.'type'(.PF_DEBUG_SEG)
     $I0 = $P0.'type'()
     is($I0, .PF_DEBUG_SEG, "Type successfully changed")
-
+    .return()
+load_error:
+    .get_results($P0)
+    pop_eh
+    report_load_error($P0, "can't run test_type tests")
+    skip(2, "can't run test_type tests")
+    .return()
 .end
 
 

Modified: trunk/t/pmc/testlib/packfile_common.pir
==============================================================================
--- trunk/t/pmc/testlib/packfile_common.pir	Thu Apr 29 14:04:16 2010	(r46139)
+++ trunk/t/pmc/testlib/packfile_common.pir	Thu Apr 29 14:52:22 2010	(r46140)
@@ -70,6 +70,17 @@
 .end
 
 
+# Report no ok for loading packfile failures
+.sub report_load_error
+    .param pmc except
+    .param string desc
+    .local string msg, aux
+    msg = concat desc, ' - error loading packfile: '
+    aux = except['message']
+    msg = concat msg, aux
+    ok(0, msg)
+.end
+
 
 # Local Variables:
 #   mode: pir


More information about the parrot-commits mailing list