Skip to content

tests: Fix LCOV_OPTS to be in the correct position - #28771

Merged
fanquake merged 1 commit into
bitcoin:masterfrom
achow101:lcov-opts
Nov 16, 2023
Merged

fanquake merged 1 commit into
bitcoin:masterfrom
achow101:lcov-opts

Conversation

@achow101

@achow101 achow101 commented Nov 1, 2023

Copy link
Copy Markdown
Member

lcov's -a option takes an argument. With LCOV_OPTS immediately after -a, the first additional argument becomes the argument to -a which is incorrect.

Also add LCOV_OPTS to more lcov calls.

`lcov`'s `-a` option takes an argument. With `LCOV_OPTS` immediately
after `-a`, the first additional argument becomes the argument to `-a`
which is incorrect.

Also add `LCOV_OPTS` to more `lcov` calls.
@DrahtBot

DrahtBot commented Nov 1, 2023 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK fanquake

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@DrahtBot DrahtBot added the Tests label Nov 1, 2023
@maflcko

maflcko commented Nov 2, 2023

Copy link
Copy Markdown
Member

Can you clarify whether this has any visible effect on the generated html? I presume only when branch coverage is enabled?

@achow101

Copy link
Copy Markdown
Member Author

Can you clarify whether this has any visible effect on the generated html? I presume only when branch coverage is enabled?

It shouldn't, other than actually working. The man page for lcov says:

   -a tracefile_pattern
   --add-tracefile tracefile_pattern
          Add contents of all files matching glob pattern trcefile_pattern.

          Specify several tracefiles using the -a switch to combine the coverage data contained in
          these files by adding up execution counts for matching test and filename combinations.

          The  result  of  the  add operation will be written to stdout or the tracefile specified
          with -o.

          Only one of  -z, -c, -a, -e, -r, -l, --diff or --summary may be specified at a time.

There clearly is an argument to the -a option. Anything that goes into LCOV_OPTS is not necessarily going to be the right argument, and the branch coverage opts certainly are not. I think it's obvious that what we currently have is just wrong.

@maflcko

maflcko commented Nov 14, 2023

Copy link
Copy Markdown
Member

I agree that it is wrong. I mostly wonder why it was working fine previously, when it shouldn't.

@fanquake fanquake left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 88e09ac

I mostly wonder why it was working fine previously, when it shouldn't.

It looks like when LCOV_OPTS is set, during branch coverage, and we end up with something like lcov -a --rc lcov_branch_coverage=1 baseline_filtered.info, lcov just reads pass the extra arguments, and still uses the file, i.e:

touch some_file
lcov -a --rc lcov_branch_coverage=1 some_file
Combining tracefiles.
.. found 1 files to aggregate.
Merging some_file..0 remaining
lcov: ERROR: trace file 'some_file' is empty
	(use "lcov --ignore-errors empty ..." to bypass this error)

@fanquake
fanquake merged commit c3735e5 into bitcoin:master Nov 16, 2023
@maflcko

maflcko commented Nov 16, 2023

Copy link
Copy Markdown
Member

Thanks for taking a look. The --rc seems wrong as well? Previously it was ignored, but now I wonder why it doesn't lead to errors, because, according to the manpage:

Only one of -z, -c, -a, -e, -r, -l and --diff may be specified at a time.

@fanquake

Copy link
Copy Markdown
Member

I think --rc is different case, not included in that list, so it is also still working here?

--rc keyword=value
Override a configuration directive.

Use this option to specify a keyword=value statement which overrides the corresponding configuration statement in the > lcovrc configuration file. You can specify this option more than once to override multiple configuration statements. See > lcovrc(5) for a list of available keywords and their meaning.

@bitcoin bitcoin locked and limited conversation to collaborators Nov 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants