python311Packages.moto: 4.2.6 -> 4.2.10
[NixPkgs.git] / pkgs / build-support / setup-hooks / enable-coverage-instrumentation.sh
blob2b48fea4ff0bf616a0150654b35f82652d68343c
1 postPhases+=" cleanupBuildDir"
3 # Force GCC to build with coverage instrumentation. Also disable
4 # optimisation, since it may confuse things.
5 export NIX_CFLAGS_COMPILE="${NIX_CFLAGS_COMPILE:-} -O0 --coverage"
7 # Get rid of everything that isn't a gcno file or a C source file.
8 # Also strip the `.tmp_' prefix from gcno files. (The Linux kernel
9 # creates these.)
10 cleanupBuildDir() {
11 if ! [ -e $out/.build ]; then return; fi
13 find $out/.build/ -type f -a ! \
14 \( -name "*.c" -o -name "*.cc" -o -name "*.cpp" -o -name "*.h" -o -name "*.hh" -o -name "*.y" -o -name "*.l" -o -name "*.gcno" \) \
15 | xargs rm -f --
17 for i in $(find $out/.build/ -name ".tmp_*.gcno"); do
18 mv "$i" "$(echo $i | sed s/.tmp_//)"
19 done