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 23729-6349a644e) Lines: 40 41 97.6 %
Date: 2019-03-26 05:45:22 Functions: 12 12 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      836016 : mtsingle_queue_get(struct mt_state *mt, long *workid, long *pending)
      21             : {
      22      836016 :   GEN done = mt->pending;
      23      836016 :   if (workid) *workid = mt->workid;
      24      836016 :   mt->pending = NULL; *pending = 0;
      25      836016 :   return done;
      26             : }
      27             : 
      28             : static int single_is_thread = 0;
      29             : 
      30             : static void
      31      836019 : mtsingle_queue_submit(struct mt_state *mt, long workid, GEN work)
      32             : {
      33      836019 :   single_is_thread = 1;
      34      836019 :   mt->pending = work? closure_callgenvec(mt->worker, work): NULL;
      35      836019 :   single_is_thread = 0;
      36      836019 :   mt->workid = workid;
      37      836019 : }
      38             : 
      39             : static void
      40       82413 : mtsingle_queue_end(void) {  }
      41             : 
      42             : int
      43   166740963 : mtsingle_is_thread(void) { return single_is_thread; }
      44             : 
      45             : void
      46       82412 : mtsingle_queue_start(struct pari_mt *pt, GEN worker)
      47             : {
      48       82412 :   pt->get = mtsingle_queue_get;
      49       82412 :   pt->submit = mtsingle_queue_submit;
      50       82412 :   pt->end = mtsingle_queue_end;
      51       82412 :   pt->mt.worker = worker;
      52       82412 :   pt->mt.pending = NULL;
      53       82412 : }
      54             : 
      55             : void
      56       94961 : mt_queue_end(struct pari_mt *pt) { pt->end(); }
      57             : 
      58             : void
      59     1108761 : mt_queue_submit(struct pari_mt *pt, long workid, GEN work)
      60     1108761 : { pt->submit(&pt->mt, workid, work); }
      61             : 
      62             : GEN
      63     1108753 : mt_queue_get(struct pari_mt *pt, long *workid, long *pending)
      64     1108753 : { return pt->get(&pt->mt, workid, pending); }
      65             : 
      66             : void
      67          40 : mt_queue_start(struct pari_mt *pt, GEN worker)
      68          40 : { return mt_queue_start_lim(pt, worker, 0); }
      69             : 
      70             : void
      71     1372046 : mtstate_save(struct pari_mtstate *mt)
      72             : {
      73     1372046 :   mt->is_thread = single_is_thread;
      74     1372046 :   mt->pending_threads = mt_is_parallel();
      75     1372045 : }
      76             : 
      77             : void
      78       43822 : mtstate_restore(struct pari_mtstate *mt)
      79             : {
      80       43822 :   single_is_thread = mt->is_thread;
      81       43822 :   if (!mt->pending_threads && mt_is_parallel())
      82           4 :     mt_queue_reset();
      83       43822 : }
      84             : 
      85             : void
      86         298 : mtstate_reset(void)
      87             : {
      88         298 :   single_is_thread = 0;
      89         298 :   if (mt_is_parallel())
      90           0 :     mt_queue_reset();
      91         298 : }

Generated by: LCOV version 1.13