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 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.10.0 lcov report (development 21348-d75f58f) Lines: 34 35 97.1 %
Date: 2017-11-20 06:21:05 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      805145 : mtsingle_queue_get(struct mt_state *mt, long *workid, long *pending)
      21             : {
      22      805145 :   GEN done = mt->pending;
      23      805145 :   if (workid) *workid = mt->workid;
      24      805145 :   mt->pending = NULL; *pending = 0;
      25      805145 :   return done;
      26             : }
      27             : 
      28             : static void
      29      805153 : mtsingle_queue_submit(struct mt_state *mt, long workid, GEN work)
      30             : {
      31      805153 :   mt->pending = work? closure_callgenvec(mt->worker, work): NULL;
      32      805145 :   mt->workid = workid;
      33      805145 : }
      34             : 
      35             : static void
      36       77593 : mtsingle_queue_end(void) {  }
      37             : 
      38             : void
      39       77601 : mtsingle_queue_start(struct pari_mt *pt, GEN worker)
      40             : {
      41       77601 :   pt->get = mtsingle_queue_get;
      42       77601 :   pt->submit = mtsingle_queue_submit;
      43       77601 :   pt->end = mtsingle_queue_end;
      44       77601 :   pt->mt.worker = worker;
      45       77601 :   pt->mt.pending = NULL;
      46       77601 : }
      47             : 
      48             : void
      49       89379 : mt_queue_end(struct pari_mt *pt) { pt->end(); }
      50             : 
      51             : void
      52     1030079 : mt_queue_submit(struct pari_mt *pt, long workid, GEN work)
      53     1030079 : { pt->submit(&pt->mt, workid, work); }
      54             : 
      55             : GEN
      56     1030071 : mt_queue_get(struct pari_mt *pt, long *workid, long *pending)
      57     1030071 : { return pt->get(&pt->mt, workid, pending); }
      58             : 
      59             : void
      60         193 : mt_queue_start(struct pari_mt *pt, GEN worker)
      61         193 : { return mt_queue_start_lim(pt, worker, 0); }
      62             : 
      63             : void
      64     1356503 : mtstate_save(long *pending)
      65             : {
      66     1356503 :   *pending = mt_is_parallel();
      67     1356503 : }
      68             : 
      69             : void
      70       41933 : mtstate_restore(long *pending)
      71             : {
      72       41933 :   if (!*pending && mt_is_parallel())
      73           4 :     mt_queue_reset();
      74       41933 : }
      75             : 
      76             : void
      77         263 : mtstate_reset(void)
      78             : {
      79         263 :   if (mt_is_parallel())
      80           0 :     mt_queue_reset();
      81         263 : }

Generated by: LCOV version 1.11