Permalink
Browse files

[test] library/pg.t: handle plan for the 3 error cases

Some smokers run 43, some 40 tests.
Use no_plan and handle the earlier exits properly.
3 error cases: no libpg.so, service stopped, no nci thunks.
  • Loading branch information...
1 parent 614a298 commit 1f3b66fa452bd5b4233046f3c00babd8ce887710 @rurban rurban committed Jul 21, 2014
Showing with 20 additions and 10 deletions.
  1. +1 −0 ChangeLog
  2. +19 −10 t/library/pg.t
View
@@ -6,6 +6,7 @@
+ Updated documentation for StringHandle.readall and FileHandle.readall, which
reads just the rest of the buffer if tell > 0. [GH #1084]
- Tests
+ + Improve test plan for t/library/pg.t
- Community
2014-07-15 release 6.6.0
View
@@ -37,10 +37,11 @@ table, which should be created by your sysadmin.
if $I1 == 1 goto have_enough_nci
test.'skip_all'('Extra NCI thunks not available')
+ test.'finish'()
exit 0
have_enough_nci:
- test.'plan'(N_TESTS)
+ test.'plan'('no_plan')
push_eh no_pg
# TODO: fix when exception handling works again
@@ -51,24 +52,31 @@ table, which should be created by your sysadmin.
have_lib:
load_bytecode 'postgres.pir'
pop_eh
- test.'ok'(1, 'load_bytecode')
load_bytecode 'Pg.pir'
- test.'ok'(1, 'load_bytecode Pg')
.local pmc cl, con, res
cl = new 'Pg'
- test.'ok'(1, 'Pg class exists')
con = cl.'connectdb'('') # assume table = user is present
$I0 = isa con, ['Pg'; 'Conn']
- test.'ok'($I0, 'con isa Pg;Conn')
- $I0 = istrue con
+ $I1 = istrue con
- if $I0 goto have_connected
- test.'skip'( 39, 'no Pg connection; skipping remaining tests' )
- .return()
+ if $I1 goto have_connected
+ test.'plan'(5)
+ test.'ok'(1, 'load_bytecode postgres')
+ test.'ok'(1, 'load_bytecode Pg')
+ test.'ok'(1, 'Pg class exists')
+ test.'ok'($I0, 'con isa Pg;Conn')
+ test.'skip'(1, 'no Pg connection; skipping remaining tests')
+ test.'finish'()
+ exit 0
have_connected:
+ test.'ok'(1, 'load_bytecode postgres')
+ test.'ok'(1, 'load_bytecode Pg')
+ test.'ok'(1, 'Pg class exists')
+ test.'ok'($I0, 'con isa Pg;Conn')
+
test.'ok'($I0, 'con is true after connect')
$I0 = con.'status'()
$I1 = iseq $I0, CONNECTION_OK
@@ -242,7 +250,8 @@ no_pg:
.local string msg
.get_results(ex)
msg = ex
- test.'skip'(N_TESTS)
+ test.'plan'(1)
+ test.'skip'(1, 'loadlib pg failed')
test.'finish'()
.end

0 comments on commit 1f3b66f

Please sign in to comment.