Code coverage tests

This page documents the degree to which the PARI/GP source code is tested by our public test suite, distributed with the source distribution in directory src/test/. This is measured by the gcov utility; we then process gcov output using the lcov frond-end.

We test a few variants depending on Configure flags on the pari.math.u-bordeaux.fr machine (x86_64 architecture), and agregate them in the final report:

The target is to exceed 90% coverage for all mathematical modules (given that branches depending on DEBUGLEVEL or DEBUGMEM are not covered). This script is run to produce the results below.

LCOV - code coverage report
Current view: top level - mt - mt.c (source / functions) Hit Total Coverage
Test: PARI/GP v2.12.0 lcov report (development 23222-06b1652be) Lines: 34 35 97.1 %
Date: 2018-11-15 05:40:53 Functions: 11 11 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* $Id$
       2             : 
       3             : Copyright (C) 2013  The PARI group.
       4             : 
       5             : This file is part of the PARI/GP package.
       6             : 
       7             : PARI/GP is free software; you can redistribute it and/or modify it under the
       8             : terms of the GNU General Public License as published by the Free Software
       9             : Foundation. It is distributed in the hope that it will be useful, but WITHOUT
      10             : ANY WARRANTY WHATSOEVER.
      11             : 
      12             : Check the License for details. You should have received a copy of it, along
      13             : with the package; see the file 'COPYING'. If not, write to the Free Software
      14             : Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
      15             : #include "pari.h"
      16             : #include "paripriv.h"
      17             : #include "mt.h"
      18             : 
      19             : static GEN
      20      816795 : mtsingle_queue_get(struct mt_state *mt, long *workid, long *pending)
      21             : {
      22      816795 :   GEN done = mt->pending;
      23      816795 :   if (workid) *workid = mt->workid;
      24      816795 :   mt->pending = NULL; *pending = 0;
      25      816795 :   return done;
      26             : }
      27             : 
      28             : static void
      29      816809 : mtsingle_queue_submit(struct mt_state *mt, long workid, GEN work)
      30             : {
      31      816809 :   mt->pending = work? closure_callgenvec(mt->worker, work): NULL;
      32      816793 :   mt->workid = workid;
      33      816793 : }
      34             : 
      35             : static void
      36       79297 : mtsingle_queue_end(void) {  }
      37             : 
      38             : void
      39       79295 : mtsingle_queue_start(struct pari_mt *pt, GEN worker)
      40             : {
      41       79295 :   pt->get = mtsingle_queue_get;
      42       79295 :   pt->submit = mtsingle_queue_submit;
      43       79295 :   pt->end = mtsingle_queue_end;
      44       79295 :   pt->mt.worker = worker;
      45       79295 :   pt->mt.pending = NULL;
      46       79295 : }
      47             : 
      48             : void
      49       91164 : mt_queue_end(struct pari_mt *pt) { pt->end(); }
      50             : 
      51             : void
      52     1073994 : mt_queue_submit(struct pari_mt *pt, long workid, GEN work)
      53     1073994 : { pt->submit(&pt->mt, workid, work); }
      54             : 
      55             : GEN
      56     1073978 : mt_queue_get(struct pari_mt *pt, long *workid, long *pending)
      57     1073978 : { return pt->get(&pt->mt, workid, pending); }
      58             : 
      59             : void
      60          85 : mt_queue_start(struct pari_mt *pt, GEN worker)
      61          85 : { return mt_queue_start_lim(pt, worker, 0); }
      62             : 
      63             : void
      64     1369285 : mtstate_save(struct pari_mtstate *mt)
      65             : {
      66     1369285 :   mt->pending_threads = mt_is_parallel();
      67     1369284 : }
      68             : 
      69             : void
      70       43545 : mtstate_restore(struct pari_mtstate *mt)
      71             : {
      72       43545 :   if (!mt->pending_threads && mt_is_parallel())
      73           4 :     mt_queue_reset();
      74       43545 : }
      75             : 
      76             : void
      77         291 : mtstate_reset(void)
      78             : {
      79         291 :   if (mt_is_parallel())
      80           0 :     mt_queue_reset();
      81         291 : }

Generated by: LCOV version 1.13