Skip to content

Makefile: add COVERAGE_OPTIONS to build test

Context

The targets build-test and build-sandbox are missing the COVERAGE_OPTIONS flags. In the CI, the job build_x86_64 runs

make all build-test

with COVERAGE_OPTIONS set to --instrument-with bisect_ppx. Consequently, it first builds all with instrumentation, and then build-test without it. I think this means that all the dependencies shared between all and build-test are rebuilt without instrumentation when build-test is made.

To try to figure out whether this is the case, I used this script and_recount.sh. It runs a command and then checks how many files have been modified in the _build folder:

#!/bin/sh

set -e

most_recent_mtime=0
if [ -d _build ]; then
    most_recent=$(find _build/ -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" ")
    most_recent_mtime=$(( $(stat -c%Y "$most_recent") + 1 ))
fi

"$@"

find _build/ -newermt @$most_recent_mtime > .new_files
echo "$(wc -l .new_files | cut -d' ' -f1) new/updated files"

I've added the COVERAGE_OPTIONS flag to build-test and build-sandbox, and here are the resutls before and after:

Before:

$ COVERAGE_OPTIONS="--instrument-with bisect_ppx" ./and_recount.sh make all
make[1]: Entering directory '/home/arvid/dev/nomadic-labs/tezos/master'
Done: 20759/22108 (jobs: 7)n
make[1]: Leaving directory '/home/arvid/dev/nomadic-labs/tezos/master'
19394 new/updated files
$ COVERAGE_OPTIONS="--instrument-with bisect_ppx" ./and_recount.sh make build-test
6200 new/updated files

After:

$ COVERAGE_OPTIONS="--instrument-with bisect_ppx" ./and_recount.sh make all && COVERAGE_OPTIONS="--instrument-with bisect_ppx" ./and_recount.sh make build-test
make[1]: Entering directory '/home/arvid/dev/nomadic-labs/tezos/master'
make[1]: Leaving directory '/home/arvid/dev/nomadic-labs/tezos/master'
29718 new/updated files
1630 new/updated files   
(tezos) 

So I get the impression it's doing less work.

I've also tried timing the builds. In https://gitlab.com/nomadic-labs/arvid-tezos/-/jobs/1894483671 I loop make all build-test without the change, and in https://gitlab.com/nomadic-labs/arvid-tezos/-/jobs/1896599404 I do it with the change.

I did it in the CI because running it makes my computer unusable. Not sure how useful these measures are, since they are not running on the same actual runner. Anyhow, there seems to be a slight improvement in run time.

Manually testing the MR

See above.

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, the Development Version section of CHANGES.md for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by Arvid Jakobsson

Merge request reports