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 - language - init.c (source / functions) Hit Total Coverage
Test: PARI/GP v2.18.1 lcov report (development 30831-19b50a36d0) Lines: 1139 1487 76.6 %
Date: 2026-04-22 09:25:48 Functions: 132 162 81.5 %
Legend: Lines: hit not hit

Function Name Sort by function name Hit count Sort by hit count
bl_rotleft 66416275
bl_rotright 60846618
blockbalance 2849981604
blockdelete 1575696323
blockheight 11864033875
blockinsert 1728698794
cgetg_copy_avma 1061737288
cgetlist_avma 620
chk_gc_upto 0
clone_lock 371029662
clone_unlock 311705600
clone_unlock_deep 59318328
clonesearch 741720645
copy_bin 472768429
copy_bin_canon 24
dbg_fill_stack 0
dbg_gc_upto 0
dbg_stack 0
debug_stack 0
dflt_err_recover 0
dflt_pari_quit 0
dflt_sigint_fun 0
dochk_gc_upto 0
err_init 14032
err_init_msg 13897
err_recover 13069
errname 27109
export_add 59
export_del 24
export_get 1499
exportall 6
f_getheap 6734
fix_height 3082120780
fix_size 744782
gc_all_unsafe 27381600
gc_dec 6014371593
gc_slice_unsafe 330805625
gc_stack_update 1236970239
gclone 237443712
gclone_refc 0
gcloneref 37888
gcopy 4888166831
gcopy_av0 4036180044
gcopy_av0_canon 84
gcopy_avma 3380395288
gcopy_lg 742
gdisplay 3703
gerepile 0
getabstime 1897
getdebugvar 370054
getheap 84
getstack 7
gettime 3724
getwalltime 0
gp_context_restore 13144
gp_context_save 146212
gsizebyte 175
gsizeclone 237443464
gsizeclone_i 3475226543
gsizeword 2214450
gunclone 388589566
gunclone_deep 3279425372
icopy_avma_canon 12
init_universal_constants 1897
is_in_block 233978784
list_internal_copy 7026
listassign 7026
listcopy 730
listinit 0
msgtimer 0
name_numerr 0
new_chunk_resize 18
newblock 238286695
numerr_name 27109
obj_check 6033702
obj_checkbuild 1507424
obj_checkbuild_padicprec 539
obj_checkbuild_prec 568477
obj_checkbuild_realprec 399100
obj_free 187740
obj_init 2533409
obj_insert 2661640
obj_insert_shallow 173572
obj_reinit 42
os_signal 20807
pari_add_defaults_module 1897
pari_add_module 1887
pari_close 1887
pari_close_blocks 365408
pari_close_export 1887
pari_close_opts 1887
pari_daemon 76
pari_err 56841
pari_err2GEN 56829
pari_err2str 21873
pari_err_display 13090
pari_err_last 87497
pari_exit 0
pari_handle_SIGINT 0
pari_init 0
pari_init_blocks 371939
pari_init_defaults 1897
pari_init_errcatch 372391
pari_init_export 1897
pari_init_functions 1897
pari_init_opts 1897
pari_init_timer 1897
pari_mainstack_alloc 372396
pari_mainstack_free 372386
pari_mainstack_malloc 372396
pari_mainstack_mextend 494077
pari_mainstack_mfree 372386
pari_mainstack_mreset 494077
pari_mainstack_resize 445
pari_mainstack_setsize 494077
pari_mainstack_use 371946
pari_sig_init 3784
pari_sighandler 0
pari_sigint 0
pari_stackcheck_init 373841
pari_thread_alloc 370054
pari_thread_close 370835
pari_thread_free 370054
pari_thread_get_global 370054
pari_thread_init 371945
pari_thread_set_global 370029
pari_thread_start 370052
pari_thread_valloc 0
pari_version 7
pari_warn 942
paristack_alloc 1897
paristack_newrsize 452
paristack_resize 0
paristack_setsize 0
parivstack_reset 121681
parivstack_resize 0
pop_entree_block 390102
rndus 221965
setalldebug 1925
setdebug 127
setdebugvar 370031
shiftaddress 3099185727
shiftaddress_canon 76
taille0 4036545792
taille0_canon 84
timer 0
timer2 0
timer_aux 221965
timer_delay 111893
timer_get 1903
timer_printf 0
timer_start 358525
timer_vprintf 0
timetoi 0
traverseheap 84
traverseheap_r 13552
type_dim 7308
unexportall 6
vec_gunclone_deep 134762747
walltimer_delay 108169
walltimer_get 0
walltimer_start 253712

Generated by: LCOV version 1.16