Opened 4 years ago

Last modified 22 months ago

#16791 new project

All modules in src/common should have 90-95%+ unit test coverage

Reported by: nickm Owned by:
Priority: High Milestone: Tor: unspecified
Component: Core Tor/Tor Version:
Severity: Normal Keywords: testing, tor-tests-coverage, tor-tests-unit
Cc: Actual Points:
Parent ID: Points: 6
Reviewer: Sponsor: SponsorS-can

Description

It's a dirty shame to have anything in src/common that isn't really deeply covered by our unit tests, since src/common is supposed to be full of stuff that's easy to test.

As of 2015-08-13, here's what's problematic (running "make check") on OSX, sorted by percentage of lines covered.

x/procmon.c.gcov 45 0 0.00
x/sandbox.c.gcov 9 0 0.00
x/compat_libevent.c.gcov 92 32 25.81
x/tortls.c.gcov 593 355 37.45
x/log.c.gcov 274 274 50.00
x/compat_threads.c.gcov 48 51 51.52
x/compat.c.gcov 360 426 54.20
x/torgzip.c.gcov 88 136 60.71
x/util.c.gcov 484 1263 72.30
x/compat_pthreads.c.gcov 22 72 76.60
x/workqueue.c.gcov 34 117 77.48
x/crypto.c.gcov 204 738 78.34
x/memarea.c.gcov 20 85 80.95
x/backtrace.c.gcov 9 42 82.35
x/crypto_ed25519.c.gcov 17 95 84.82
x/util_process.c.gcov 5 33 86.84
x/address.c.gcov 77 595 88.54
x/crypto_curve25519.c.gcov 8 74 90.24
x/crypto_s2k.c.gcov 14 152 91.57
x/util_format.c.gcov 11 183 94.33
x/crypto_format.c.gcov 5 95 95.00
x/container.c.gcov 15 390 96.30
x/crypto_pwbox.c.gcov 2 59 96.72
x/di_ops.c.gcov 1 37 97.37
x/aes.c.gcov 0 17 100.00

Child Tickets

TicketStatusOwnerSummaryComponent
#16794closednickmAll cryptography unit test coverage should be over 95%; all should have test vectorsCore Tor/Tor
#16796closedRaise coverage on containers, di_ops to 100%Core Tor/Tor
#16800closedRaise tortls unit test coverage as high as possibleCore Tor/Tor

Change History (14)

comment:1 Changed 4 years ago by nickm

Keywords: SponsorS testing added

comment:2 Changed 4 years ago by nickm

Another thing to investigate as we increase unit test coverage in these functions is: to what extent are the modules covered by their own tests? It's a bit scary to have 100% test coverage on electricity.c if all of those calls pass through the unit tests for waffleiron.c

comment:3 Changed 3 years ago by nickm

Keywords: 028-triage added

comment:4 Changed 3 years ago by nickm

Keywords: SponsorS removed
Sponsor: SponsorS

Bulk-replace SponsorS keyword with SponsorS sponsor field in Tor component.

comment:5 Changed 3 years ago by nickm

Points: large
Priority: normalmajor

comment:6 Changed 3 years ago by nickm

Severity: Normal

Update: here are the current coverage numbers for the unit tests ("make check") on common, sorted by percent coverage, on Linux.

cc/sandbox.c.gcov 413 47 10.22
cc/compat_threads.c.gcov 75 53 41.41
cc/compat.c.gcov 375 469 55.57
cc/log.c.gcov 211 346 62.12
cc/torgzip.c.gcov 73 138 65.40
cc/procmon.c.gcov 13 28 68.29
cc/compat_libevent.c.gcov 34 86 71.67
cc/util.c.gcov 404 1309 76.42
cc/workqueue.c.gcov 31 123 79.87
cc/backtrace.c.gcov 11 47 81.03
cc/compat_pthreads.c.gcov 19 88 82.24
cc/crypto.c.gcov 166 800 82.82
cc/memarea.c.gcov 16 91 85.05
cc/address.c.gcov 67 622 90.28
cc/crypto_ed25519.c.gcov 12 124 91.18
cc/util_process.c.gcov 2 38 95.00
cc/tortls.c.gcov 31 823 96.37
cc/crypto_curve25519.c.gcov 3 85 96.59
cc/crypto_pwbox.c.gcov 1 62 98.41
cc/crypto_s2k.c.gcov 1 131 99.24
cc/aes.c.gcov 0 20 100.00
cc/container.c.gcov 0 424 100.00
cc/crypto_format.c.gcov 0 91 100.00
cc/di_ops.c.gcov 0 52 100.00
cc/util_format.c.gcov 0 159 100.00
TOTAL 1958 6256 76.16

comment:7 Changed 3 years ago by nickm

Milestone: Tor: 0.2.8.x-finalTor: 0.2.9.x-final

It is impossible that we will fix all 226 currently open 028 tickets before 028 releases. Time to move some out. This is my second pass through the "new" and tickets, looking for things to move to 0.2.9.

comment:8 Changed 3 years ago by nickm

Sponsor: SponsorSSponsorS-can

comment:9 Changed 3 years ago by nickm

Keywords: tor-tests-coverage tor-tests-unit added

comment:10 Changed 3 years ago by isabela

Points: large6

comment:11 Changed 3 years ago by nickm

Milestone: Tor: 0.2.9.x-final
Parent ID: #17289

comment:12 Changed 3 years ago by nickm

Milestone: Tor: unspecified

comment:13 Changed 2 years ago by nickm

Parent ID: #17289

Unparenting.

comment:14 Changed 22 months ago by nickm

Keywords: 028-triage removed
Note: See TracTickets for help on using tickets.