mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-26 22:52:34 +02:00

Code coverage can be requested with -Dllvm_cov and run with ninja llvm-cov-tests or llvm-cov-cli. BUG=b:187647884 BRANCH=None TEST=meson test; ninja llvm-cov-tests TEST=ran test_build.sh with coverage enabled TEST=jenkins ran test_build.sh with coverage disabled Change-Id: Id6c73bff46e7b88d425956a80def97082b201f56 Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69268 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
3.8 KiB
3.8 KiB
Compiling from Source with meson (recommended)
Dependencies:
- C compiler (GCC | Clang) *
- meson >=0.53.0 *
- ninja *
- pkg-config *
- cmocka **
- system-headers ***
- libpci ***
- libusb1 >=1.0.9 ***
- libftdi1 ***
- libjaylink ***
* Compile time dependency ** For unit-testing only *** Runtime / Programmer specific
Build Options:
- classic_cli=auto/enabled/disabled
- classic_cli_default_programmer=<programmer_name>:<programmer_params>
- classic_cli_print_wiki=auto/enabled/disabled
- tests=auto/enabled/disabled
- ich_descriptors_tool=auto/enabled/disabled
- use_internal_dmi=true/false
- programmer=...
Configure
meson builddir -D<your_options>
- builddir is the directory in which flashrom will be build
- for all available options see
meson_options.txt
Compile
ninja -C builddir
Install
ninja -C builddir install
Run unit tests
ninja -C builddir test
Run unit tests with code coverage
gcov
Due to a bug in lcov, the html file will only be correct if lcov is not installed and gcovr is installed. See https://github.com/linux-test-project/lcov/issues/168 https://github.com/mesonbuild/meson/issues/6747
meson setup buildcov -Db_coverage=true
ninja -C buildcov test
ninja -C buildcov coverage
llvm
https://clang.llvm.org/docs/SourceBasedCodeCoverage.html
env CC=clang meson setup buildclangcov -Dllvm_cov=enabled
ninja -C buildclangcov test
ninja -C buildclangcov llvm-cov-tests
System specific information
Ubuntu / Debian (Linux)
- linux-headers are version specific
apt-get install -y gcc meson ninja-build pkg-config libcmocka-dev \
linux-headers-generic libpci-dev libusb-1.0-0-dev libftdi1-dev \
libjaylink-dev
ArchLinux / Manjaro
- libjaylink is not available through the package manager
pacman -S --noconfirm gcc meson ninja pkg-config cmocka \
pciutils libusb libftdi
NixOS / Nixpkgs
nix-shell <flashrom_source>/util/shell.nix
or
nix-shell -p meson ninja pkg-config cmocka pciutils libusb1 libftdi1 libjaylink
OpenSUSE
zypper install -y gcc meson ninja pkg-config libcmocka-devel \
pciutils-devel libusb-1_0-devel libftdi1-devel \
libjaylink-devel
Alpine
apk add build-base meson ninja pkgconf cmocka-dev pciutils-dev libusb-dev libftdi1-dev libjaylink-dev linux-headers
Freebsd / DragonFly BSD
- Tests are not working yet and must be disabled with
-Dtests=disabled
- libjaylink is not available through the package manager
- libusb1 is part of the base system
pkg install pkgconf meson ninja cmocka libpci libftdi1
OpenBSD
- Tests are not working yet and must be disabled with
-Dtests=disabled
- libjaylink is not available through the package manager
pkg_add install meson ninja pkg-config cmocka pciutils libusb1 libftdi1
NetBSD
- Tests are not working yet and must be disabled with
-Dtests=disabled
- libjaylink is not available through the package manager
- note: https://www.cambus.net/installing-ca-certificates-on-netbsd/
pkgin install meson ninja pkg-config cmocka pciutils libusb1 libftdi1
OpenIndiana (Illumos, Solaris, SunOS)
- Tests are not working yet and must be disabled with
-Dtests=disabled
- libpci missing, pciutils is build without it
- libftdi1, libjaylink is not available through the package manager
- TODO: replace build-essential with the default compiler
pkg install build-essential meson ninja cmocka libusb-1
MacOS (Homebrew)
- Tests are not working yet and must be disabled with
-Dtests=disabled
- Internal, PCI programmer not supported
- libjaylink is not available through the package manager
brew install meson ninja pkg-config cmocka libusb libftdi