rust-random/getrandom

Code test coverage should be measured and reported in CI

Ouverte

#288 ouverte le 9 oct. 2022

 (4 commentaires) (0 réaction) (0 personne assignée)Rust (255 forks)github user discovery
help wantedtesting

Métriques du dépôt

Stars
 (573 étoiles)
Métriques de merge PR
 (Merge moyen 32j 14h) (3 PRs mergées en 30 j)

Description

There is a lot of runtime feature detection and other conditional logic in this crate. AFAICT, when tests are run, it is arbitrary which implementation gets picked. For example, for Linux, AFAICT only the getrandom syscall implementation is tested, and the file I/O fallback is not tested. Publishing the code test coverage report would make it clear which code isn't being tested on which platforms.

There is a lot of code that is copy-modified-pasted. This is understandable because some targets have slightly different APIs. My hope is that when code test coverage measurement is published, we'll see clearly which duplicated coding patterns we should factor out to increase the code coverage further to minimize the amount of uncovered code for difficult-to-test (lacking test runners) platforms.

Also I expect having code test coverage will facilitate more exhaustive testing, such as writing tests that exercsise both the getrandom syscall branch and the File I/O, e.g. by using ptrace or equivalent, similar to what BoringSSL does.

Guide contributeur