From: Leopold Toetsch <[EMAIL PROTECTED]>
   Date: Sun, 24 Sep 2006 20:55:51 +0200

   Hi folks,

   I've started hacking postgres.pir and related stuff. Some remarkable notes:

   * there's a test now (or the beginnings of it):
     $ ./parrot t/library/pg.t
     (the old code didn't even load_bytecode)

     The test assumes, there's a user's default table.

It turns out that if libpq.so doesn't exist, pg.t makes t/harness give
up completely:

    [EMAIL PROTECTED]> perl t/harness t/library/pg.t
    t/library/pg....Couldn't load 'libpq': libpq.so: cannot open shared object 
file: No such file or directory
    current instr.: 'parrot;Pg;__postgres_init' pc 0 
(/usr/src/parrot/runtime/parrot/library/postgres.pir:4)
    [oops; continuation 0x81d5f94 of type 25 is trying to jump from runloop 8 
to runloop 1]
    FAILED--Further testing stopped: error loading libpg - loadlib failed
    [EMAIL PROTECTED]> 

I managed to get it to fail less hard (see patch):

    [EMAIL PROTECTED]> perl t/harness t/library/pg.t
    t/library/pg....Couldn't load 'libpq': libpq.so: cannot open shared object 
file: No such file or directory
    current instr.: 'parrot;Pg;__postgres_init' pc 0 
(/usr/src/parrot/runtime/parrot/library/postgres.pir:4)
    [oops; continuation 0x81d5e90 of type 25 is trying to jump from runloop 9 
to runloop 1]
    t/library/pg....ok 7/7parrot: src/inter_call.c:122: Parrot_init_arg_op: 
Assertion `(((sig_pmc)->obj.flags) & PObj_is_PMC_FLAG) && 
sig_pmc->vtable->base_type == enum_class_FixedIntegerArray' failed.
    t/library/pg....dubious
            Test returned status 0 (wstat 6, 0x6)
    Scalar found where operator expected at (eval 159) line 1, near "'int'  
$__val"
            (Missing operator before   $__val?)
            after all the subtests completed successfully
    Failed Test    Stat Wstat Total Fail  Failed  List of Failed
    
--------------------------------------------------------------------------------
    t/library/pg.t    0     6     7    0   0.00%  ??
    7 subtests skipped.
    Failed 1/1 test scripts, 0.00% okay. 0/7 subtests failed, 100.00% okay.
    [EMAIL PROTECTED]> 

But, as you can see, the continuation barrier gets in the way of the
error handling.

                                        -- Bob Rogers
                                           http://rgrjr.dyndns.org/

Index: t/library/pg.t
===================================================================
--- t/library/pg.t      (revision 14703)
+++ t/library/pg.t      (working copy)
@@ -23,12 +23,14 @@
     load_bytecode 'Test/Builder.pir'
     .local pmc test       
     test = new 'Test::Builder'
+    test.'plan'(N_TESTS)
     push_eh no_pg
     load_bytecode 'postgres.pir'
-    test.'plan'(N_TESTS)
     test.'ok'(1, 'load_bytecode')
     load_bytecode 'Pg.pir'
     test.'ok'(1, 'load_bytecode Pg')
+    clear_eh
+
     .local pmc cl, con, res
     cl = getclass 'Pg'
     test.'ok'(1, 'Pg class exists')
@@ -47,7 +49,7 @@
 no_pg: 
     .local pmc ex, msg
     .get_results(ex, msg)
-    test.'BAILOUT'(msg)
+    test.'skip'(N_TESTS)
     test.'finish'()
 .end
 

Reply via email to