[poppler] unit test for GLib bindings

Carlos Garcia Campos carlosgc at gnome.org
Sun Mar 29 08:48:46 PDT 2009


Hi Kou, 

thanks for the detailed analysis :-) 

I've just tried it out and I got a crash while testing:

$ make check -s
Making check in goo
Making check in fofi
Making check in splash
Making check in poppler
Making check in utils
Making check in glib
Making check in .
Making check in reference
Making check in demo
Making check in test
Making check in lib
Making check in fixtures
Making check in pdf
....................!
CRASH!!!


Finished in 2.799551 seconds (total: 0.087569 seconds)

21 test(s), 139 assertion(s), 0 failure(s), 0 error(s), 0 pending(s), 0 omission(s), 0 notification(s)
95.2381% passed
FAIL: run-test.sh
===================
1 of 1 tests failed
===================
make[5]: *** [check-TESTS] Error 1
make[4]: *** [check-am] Error 2
make[3]: *** [check-recursive] Error 1
make[2]: *** [check-recursive] Error 1
make[1]: *** [check] Error 2
make: *** [check-recursive] Error 1

The cutter documentation says that cutter tries to get a backtrace for
crashes, but it seems it couldn't in this case. How can I know which
test produced the crash?

El lun, 23-03-2009 a las 23:43 +0900, Kouhei Sutou escribió:
> Hi,
> 
> In <1237736203.4174.8.camel at charmaleon>
>   "Re: [poppler] unit test for GLib bindings" on Sun, 22 Mar 2009 16:36:43 +0100,
>   Carlos Garcia Campos <carlosgc at gnome.org> wrote:
> 
> >>   http://github.com/kou/poppler-test/tree/master
> >> 
> >> It requires Cutter 1.0.6:
> >>   http://cutter.sourceforge.net/
> > 
> > GLib has its own test framework since 2.16. I don't know it, and I don't
> > know cutter either, what do you think about using the GLib test
> > framework instead? cutter depends on glib, are they compatible somehow?
> > I'm just asking, I don't have any problem with using cutter. 
> 
> It seems that gtester is more simpler than Cutter and Cutter
> provides more convenience features than gtester. I prefer to
> Cutter because I want to write tests more easily. :-)
> 
> Here are comparing tables between gtester and Cutter:
> 
> item           | gtester             | Cutter
> -----------------------------------------------------
>                       <basic>
> -----------------------------------------------------
> based on       | GLib                | GLib/GObject
> bundled        | o                   | x
> run model      | a process per       | a process for
>                | test case(*1)       | all tests(*2)
>                |                     |
> test program   | executable program  | shared library
> test runner    | optional            | external program
>                | (self-executable)   | ('cutter' command)
>                | ('gtester' command) |
>                |                     |
> users          | hundreds of         | 6 projects
>                | projects?(*3)       |
> -----------------------------------------------------
> (*1)
>   * Test process will continue even if a test program causes SEGV.
>   * Each test will have overhead to create a process.
> (*2)
>   * Test process will stop a test case causes SEGV.
>   * Each test doesn't have overhead to create a process.
> Continuity:
>   stop <-> continue
>    (*2)   (*1)
> Speed:
>   slow <-> first
>    (*1)   (*2)
> 
> (*3) http://www.google.com/codesearch?q=g_test_run+lang%3Ac
> -----------------------------------------------------
>                    <document>
> -----------------------------------------------------
> tutorial       | o(*4)               | o(*5)
> API reference  | o(*6)               | o(*7)
> -----------------------------------------------------
> (*4) http://mail.gnome.org/archives/gtk-devel-list/2007-December/msg00181.html
> (*5) http://cutter.sourceforge.net/reference/tutorial.html
> (*6) http://library.gnome.org/devel/glib/stable/glib-Testing.html
> (*7) http://cutter.sourceforge.net/reference/reference.html
> -----------------------------------------------------
>                    <interface>
> -----------------------------------------------------
> test           | required            | auto-detect
> registration   |                     |
> (*8)           |                     |
>                |                     |
> fixture(*9)    | o                   | o
> # of assertions| 15                  | 58
> text diff      | x                   | o(*10)
> image diff     | x                   | o(*11)
> backtrace      | x                   | o(*12)
>                |                     |
> well GLib      | x                   | o(*13)
> integrated     |                     |
> assertions     |                     |
>                |                     |
> data driven    | x                   | o(*15)
> test(*14)      |                     |
> -----------------------------------------------------
> (*8) http://c2.com/cgi/wiki?TestCollector
> (*9) http://en.wikipedia.org/wiki/Test_fixture
>      http://en.wikipedia.org/wiki/XUnit
> (*10) http://cutter.sourceforge.net/reference/features.html
>       <Result output with useful format for debugging> section
> (*11) http://cutter.sourceforge.net/reference/news.html
>       <1.0.5: 2008-10-15> section
>       http://github.com/kou/poppler-test/blob/4bb8d22914a988ae5da9ba5f46199bf521cfd2b6/glib/test/test-page.c#L287
> (*12) http://cutter.sourceforge.net/reference/cutter-cut-helper.html#cut-trace
> (*13) http://cutter.sourceforge.net/reference/cutter-gcut-assertions.html
>       e.g. GHashTable of String -> String will be inspected
>       like '{"key1" => "value1", "key2" => "value2"}' not
>       '#<GHashTable: 0xXXXXX>' when assertions is failed.
> (*14) QtTest's documentation:
>       http://doc.trolltech.com/solutions/4/qttestlib/tutorial2.html
> (*15) http://cutter.sourceforge.net/reference/cutter-cutter.html#cut-add-data
>       http://cutter.sourceforge.net/reference/cutter-gcut-data.html#gcut-add-datum
> >> The tests covers all functions in glib/test-poppler-glib.cc
> >> except nested layer case. Is there a sample nested layer
> >> PDF?
> > 
> > Yes, here is one:
> > 
> > http://people.freedesktop.org/~carlosgc/NestedLayers.pdf
> 
> Thanks!
> I've add a test for poppler_layers_iter_get_child() and
> poppler_layers_iter_get_title() and push it to github.
> 
> But the test PDF doesn't have iter's title. So,
> poppler_layers_iter_get_title() always returns NULL...
> 
> 
> Thanks,
> --
> kou
> 
-- 
Carlos Garcia Campos
   elkalmail at yahoo.es
   carlosgc at gnome.org
   http://carlosgc.linups.org
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada
 digitalmente
Url : http://lists.freedesktop.org/archives/poppler/attachments/20090329/f478b5ed/attachment.pgp 


More information about the poppler mailing list