mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.6k stars 1.63k forks source link

Detailed coverage is broken with Vala #799

Open arteymix opened 8 years ago

arteymix commented 8 years ago

It seems like gcov cannot locate generated C sources correctly.

[1/1] Generating HTML coverage report.
FAILED: coverage-html 
'gcovr' '--html' '--html-details' '-r' '/home/guillaume/Projets/valum' '-o' '/home/guillaume/Projets/valum/build/meson-logs/coverage.html'
Traceback (most recent call last):
  File "/home/guillaume/.local/bin/gcovr", line 1970, in <module>
    print_html_report(covdata, options.html_details)
  File "/home/guillaume/.local/bin/gcovr", line 1473, in print_html_report
    INPUT = open(data['FILENAME'], 'r')
IOError: [Errno 2] No such file or directory: 'build/auth-test.c'
ninja: build stopped: subcommand failed.
3v1n0 commented 6 years ago

I'm getting the same here, just tried with https://github.com/GNOME/gnome-calculator but it fails randomly (like if the .c file isn't ready).

Also the generated files don't point to the actual .vala source, but to the .c code (while .c files includes #line directives properly).

$ meson _build/ -Db_coverage=true
The Meson build system
Version: 0.47.1
Source dir: /data/GNOME/gnome-calculator
Build dir: /data/GNOME/gnome-calculator/_build
Build type: native build
Project name: gnome-calculator
Project version: 3.30.0
Appending LDFLAGS from environment: '-L/opt/dev/GNOME/lib '
Native C compiler: cc (gcc 7.3.0 "cc (Ubuntu 7.3.0-16ubuntu3) 7.3.0")
Appending LDFLAGS from environment: '-L/opt/dev/GNOME/lib '
Native Vala compiler: valac (valac 0.40.0.93-2d81)
Build machine cpu family: x86_64
Build machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (0.29.1)
Native dependency gio-2.0 found: YES 2.57.3
Native dependency glib-2.0 found: YES 2.57.3
Native dependency gmodule-export-2.0 found: YES 2.57.3
Native dependency gobject-2.0 found: YES 2.57.3
Native dependency gtk+-3.0 found: YES 3.22.30
Native dependency gtksourceview-3.0 found: YES 3.24.1
Native dependency libsoup-2.4 found: YES 2.62.1
Native dependency libxml-2.0 found: YES 2.9.4
Library m found: YES
Library mpc found: YES
Library mpc found: YES
Library mpfr found: YES
Library mpfr found: YES
Library posix found: YES
Configuring config.h using configuration
Program meson_post_install.py found: YES (/data/GNOME/gnome-calculator/meson_post_install.py)
Native dependency glib-2.0 found: YES 2.57.3
Configuring org.gnome.Calculator.SearchProvider.service using configuration
Build targets in project: 16
Found ninja-1.8.2 at /usr/bin/ninja
$ ninja -C _build/ test
ninja: Entering directory `_build/'
[5/47] Compiling Vala source ../lib/mpfr-glue.vala ../lib/currency.vala...iables.vala ../lib/number.vala ../lib/serializer.vala ../lib/unit.vala.
../lib/number.vala:47.5-47.42: warning: Type `MPFR.Precision' can not be used for a GLib.Object property
    public static MPFR.Precision precision { get; set; default = 1000; }
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Compilation succeeded - 1 warning(s)
[46/47] Running all tests.
1/3 Equation test                           OK       0.26 s 
2/3 Number test                             OK       0.08 s 
3/3 Serializer test                         OK       0.01 s 

OK:         3
FAIL:       0
SKIP:       0
TIMEOUT:    0

Full log written to /data/GNOME/gnome-calculator/_build/meson-logs/testlog.txt
marco@unstable:/data/GNOME/gnome-calculator (jhbuild: /opt/dev/GNOME, wip/3v1n0/ci-tests):✓ $ ninja -C _build/ coverage-html
ninja: Entering directory `_build/'
[1/1] Generates HTML coverage report.
FAILED: meson-coverage-html 
/usr/bin/python3 /opt/dev/GNOME/bin/meson --internal coverage --html /data/GNOME/gnome-calculator /data/GNOME/gnome-calculator/subprojects /data/GNOME/gnome-calculator/_build /data/GNOME/gnome-calculator/_build/meson-logs
Capturing coverage data from /data/GNOME/gnome-calculator/_build
Found gcov version: 7.3.0
Scanning /data/GNOME/gnome-calculator/_build for .gcno files ...
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/tests/tests@@test-serializer@exe/tests/tests@@test-serializer@exe/test-serializer.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/tests/tests@@test-number@exe/tests/tests@@test-number@exe/test-number.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/tests/tests@@test-equation@exe/tests/tests@@test-equation@exe/test-equation.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/src/src@@gnome-calculator@exe/math-variable-popover.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/src/src@@gnome-calculator@exe/math-converter.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/src/src@@gnome-calculator@exe/math-preferences.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/src/src@@gnome-calculator@exe/math-window.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/src/src@@gnome-calculator@exe/math-buttons.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/src/src@@gnome-calculator@exe/math-display.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/src/src@@gnome-calculator@exe/math-history.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/src/src@@gnome-calculator@exe/math-function-popover.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/src/src@@gnome-calculator@exe/gnome-calculator.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/src/src@@gcalccmd@exe/src/src@@gcalccmd@exe/gcalccmd.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/equation-parser.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/mpfr-glue.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/math-function.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/equation.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/math-equation.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/financial.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/equation-lexer.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/number.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/serializer.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/function-manager.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/math-variables.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/unit.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/currency.c
geninfo: WARNING: some exclusion markers may be ignored
geninfo: WARNING: could not open /data/GNOME/gnome-calculator/_build/search-provider/search-provider@@gnome-calculator-search-provider@exe/search-provider/search-provider@@gnome-calculator-search-provider@exe/search-provider.c
geninfo: WARNING: some exclusion markers may be ignored
Found 28 graph files in /data/GNOME/gnome-calculator/_build
Processing tests/tests@@test-serializer@exe/meson-generated_test-serializer.c.gcno
Processing tests/tests@@test-number@exe/meson-generated_test-number.c.gcno
Processing tests/tests@@test-equation@exe/meson-generated_test-equation.c.gcno
Processing src/src@@gnome-calculator@exe/meson-generated_math-variable-popover.c.gcno
Processing src/src@@gnome-calculator@exe/meson-generated_math-converter.c.gcno
Processing src/src@@gnome-calculator@exe/meson-generated_math-preferences.c.gcno
Processing src/src@@gnome-calculator@exe/meson-generated_math-window.c.gcno
Processing src/src@@gnome-calculator@exe/meson-generated_math-buttons.c.gcno
Processing src/src@@gnome-calculator@exe/meson-generated_math-display.c.gcno
Processing src/src@@gnome-calculator@exe/meson-generated_math-history.c.gcno
Processing src/src@@gnome-calculator@exe/meson-generated_.._org.gnome.Calculator.c.gcno
Processing src/src@@gnome-calculator@exe/meson-generated_math-function-popover.c.gcno
Processing src/src@@gnome-calculator@exe/meson-generated_gnome-calculator.c.gcno
Processing src/src@@gcalccmd@exe/meson-generated_gcalccmd.c.gcno
Processing lib/lib@@calculator@sta/meson-generated_equation-parser.c.gcno
Processing lib/lib@@calculator@sta/meson-generated_mpfr-glue.c.gcno
Processing lib/lib@@calculator@sta/meson-generated_math-function.c.gcno
Processing lib/lib@@calculator@sta/meson-generated_equation.c.gcno
Processing lib/lib@@calculator@sta/meson-generated_math-equation.c.gcno
Processing lib/lib@@calculator@sta/meson-generated_financial.c.gcno
Processing lib/lib@@calculator@sta/meson-generated_equation-lexer.c.gcno
Processing lib/lib@@calculator@sta/meson-generated_number.c.gcno
Processing lib/lib@@calculator@sta/meson-generated_serializer.c.gcno
Processing lib/lib@@calculator@sta/meson-generated_function-manager.c.gcno
Processing lib/lib@@calculator@sta/meson-generated_math-variables.c.gcno
Processing lib/lib@@calculator@sta/meson-generated_unit.c.gcno
Processing lib/lib@@calculator@sta/meson-generated_currency.c.gcno
Processing search-provider/search-provider@@gnome-calculator-search-provider@exe/meson-generated_search-provider.c.gcno
Finished .info-file creation
Capturing coverage data from /data/GNOME/gnome-calculator/_build
Found gcov version: 7.3.0
Scanning /data/GNOME/gnome-calculator/_build for .gcda files ...
Found 12 data files in /data/GNOME/gnome-calculator/_build
Processing tests/tests@@test-serializer@exe/meson-generated_test-serializer.c.gcda
Cannot open source file tests/tests@@test-serializer@exe/test-serializer.c
Processing tests/tests@@test-number@exe/meson-generated_test-number.c.gcda
Cannot open source file tests/tests@@test-number@exe/test-number.c
Processing tests/tests@@test-equation@exe/meson-generated_test-equation.c.gcda
Cannot open source file tests/tests@@test-equation@exe/test-equation.c
Processing lib/lib@@calculator@sta/meson-generated_equation-parser.c.gcda
Cannot open source file lib/lib@@calculator@sta/equation-parser.c
Processing lib/lib@@calculator@sta/meson-generated_serializer.c.gcda
Cannot open source file lib/lib@@calculator@sta/serializer.c
Processing lib/lib@@calculator@sta/meson-generated_currency.c.gcda
Cannot open source file lib/lib@@calculator@sta/currency.c
Processing lib/lib@@calculator@sta/meson-generated_number.c.gcda
Cannot open source file lib/lib@@calculator@sta/number.c
Processing lib/lib@@calculator@sta/meson-generated_function-manager.c.gcda
Cannot open source file lib/lib@@calculator@sta/function-manager.c
Processing lib/lib@@calculator@sta/meson-generated_equation-lexer.c.gcda
Cannot open source file lib/lib@@calculator@sta/equation-lexer.c
Processing lib/lib@@calculator@sta/meson-generated_equation.c.gcda
Cannot open source file lib/lib@@calculator@sta/equation.c
Processing lib/lib@@calculator@sta/meson-generated_unit.c.gcda
Cannot open source file lib/lib@@calculator@sta/unit.c
Processing lib/lib@@calculator@sta/meson-generated_math-function.c.gcda
Cannot open source file lib/lib@@calculator@sta/math-function.c
Finished .info-file creation
Combining tracefiles.
Reading tracefile /data/GNOME/gnome-calculator/_build/meson-logs/coverage.info.initial
Reading tracefile /data/GNOME/gnome-calculator/_build/meson-logs/coverage.info.run
Writing data to /data/GNOME/gnome-calculator/_build/meson-logs/coverage.info.raw
Summary coverage rate:
  lines......: 48.9% (6230 of 12728 lines)
  functions..: 45.7% (717 of 1570 functions)
  branches...: no data found
Reading tracefile /data/GNOME/gnome-calculator/_build/meson-logs/coverage.info.raw
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/currency.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/equation-lexer.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/equation-parser.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/equation.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/financial.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/function-manager.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/currency.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/equation-lexer.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/equation-parser.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/equation.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/financial.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/function-manager.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/math-equation.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/math-function.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/math-variables.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/mpfr-glue.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/number.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/serializer.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/unit.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/math-equation.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/math-function.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/math-variables.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/mpfr-glue.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/number.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/serializer.c
Extracting /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/unit.c
Extracting /data/GNOME/gnome-calculator/_build/search-provider/search-provider@@gnome-calculator-search-provider@exe/search-provider.c
Extracting /data/GNOME/gnome-calculator/_build/search-provider/search-provider@@gnome-calculator-search-provider@exe/search-provider/search-provider@@gnome-calculator-search-provider@exe/search-provider.c
Extracting /data/GNOME/gnome-calculator/_build/src/org.gnome.Calculator.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gcalccmd@exe/gcalccmd.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gcalccmd@exe/src/src@@gcalccmd@exe/gcalccmd.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/gnome-calculator.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/math-buttons.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/math-converter.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/math-display.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/math-function-popover.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/math-history.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/math-preferences.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/math-variable-popover.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/math-window.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/src/src@@gnome-calculator@exe/gnome-calculator.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/src/src@@gnome-calculator@exe/math-buttons.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/src/src@@gnome-calculator@exe/math-converter.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/src/src@@gnome-calculator@exe/math-display.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/src/src@@gnome-calculator@exe/math-function-popover.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/src/src@@gnome-calculator@exe/math-history.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/src/src@@gnome-calculator@exe/math-preferences.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/src/src@@gnome-calculator@exe/math-variable-popover.c
Extracting /data/GNOME/gnome-calculator/_build/src/src@@gnome-calculator@exe/src/src@@gnome-calculator@exe/math-window.c
Extracting /data/GNOME/gnome-calculator/_build/tests/tests@@test-equation@exe/test-equation.c
Extracting /data/GNOME/gnome-calculator/_build/tests/tests@@test-equation@exe/tests/tests@@test-equation@exe/test-equation.c
Extracting /data/GNOME/gnome-calculator/_build/tests/tests@@test-number@exe/test-number.c
Extracting /data/GNOME/gnome-calculator/_build/tests/tests@@test-number@exe/tests/tests@@test-number@exe/test-number.c
Extracting /data/GNOME/gnome-calculator/_build/tests/tests@@test-serializer@exe/test-serializer.c
Extracting /data/GNOME/gnome-calculator/_build/tests/tests@@test-serializer@exe/tests/tests@@test-serializer@exe/test-serializer.c
Extracting /data/GNOME/gnome-calculator/lib/currency.vala
Extracting /data/GNOME/gnome-calculator/lib/equation-lexer.vala
Extracting /data/GNOME/gnome-calculator/lib/equation-parser.vala
Extracting /data/GNOME/gnome-calculator/lib/equation.vala
Extracting /data/GNOME/gnome-calculator/lib/financial.vala
Extracting /data/GNOME/gnome-calculator/lib/function-manager.vala
Extracting /data/GNOME/gnome-calculator/lib/math-equation.vala
Extracting /data/GNOME/gnome-calculator/lib/math-function.vala
Extracting /data/GNOME/gnome-calculator/lib/math-variables.vala
Extracting /data/GNOME/gnome-calculator/lib/mpfr-glue.vala
Extracting /data/GNOME/gnome-calculator/lib/number.vala
Extracting /data/GNOME/gnome-calculator/lib/serializer.vala
Extracting /data/GNOME/gnome-calculator/lib/unit.vala
Extracting /data/GNOME/gnome-calculator/search-provider/search-provider.vala
Extracting /data/GNOME/gnome-calculator/src/gcalccmd.vala
Extracting /data/GNOME/gnome-calculator/src/gnome-calculator.vala
Extracting /data/GNOME/gnome-calculator/src/math-buttons.vala
Extracting /data/GNOME/gnome-calculator/src/math-converter.vala
Extracting /data/GNOME/gnome-calculator/src/math-display.vala
Extracting /data/GNOME/gnome-calculator/src/math-function-popover.vala
Extracting /data/GNOME/gnome-calculator/src/math-history.vala
Extracting /data/GNOME/gnome-calculator/src/math-preferences.vala
Extracting /data/GNOME/gnome-calculator/src/math-variable-popover.vala
Extracting /data/GNOME/gnome-calculator/src/math-window.vala
Extracting /data/GNOME/gnome-calculator/tests/test-equation.vala
Extracting /data/GNOME/gnome-calculator/tests/test-number.vala
Extracting /data/GNOME/gnome-calculator/tests/test-serializer.vala
Extracting /data/GNOME/gnome-calculator/vapi/mpc.vapi
Extracted 83 files
Writing data to /data/GNOME/gnome-calculator/_build/meson-logs/coverage.info
Summary coverage rate:
  lines......: 48.9% (6167 of 12607 lines)
  functions..: 45.6% (716 of 1569 functions)
  branches...: no data found
Reading tracefile /data/GNOME/gnome-calculator/_build/meson-logs/coverage.info
Deleted 0 files
Writing data to /data/GNOME/gnome-calculator/_build/meson-logs/coverage.info
Summary coverage rate:
  lines......: 48.9% (6167 of 12607 lines)
  functions..: 45.6% (716 of 1569 functions)
  branches...: no data found
Reading data file /data/GNOME/gnome-calculator/_build/meson-logs/coverage.info
Found 83 entries.
Using user-specified filename prefix "/data/GNOME/gnome-calculator/_build"
Writing .css and .png files.
Generating output.
Processing file lib/lib@@calculator@sta/function-manager.c
Processing file lib/lib@@calculator@sta/number.c
Processing file lib/lib@@calculator@sta/math-function.c
Processing file lib/lib@@calculator@sta/equation-parser.c
Processing file lib/lib@@calculator@sta/math-variables.c
Processing file lib/lib@@calculator@sta/unit.c
Processing file lib/lib@@calculator@sta/equation.c
Processing file lib/lib@@calculator@sta/currency.c
Processing file lib/lib@@calculator@sta/mpfr-glue.c
Processing file lib/lib@@calculator@sta/equation-lexer.c
Processing file lib/lib@@calculator@sta/serializer.c
Processing file lib/lib@@calculator@sta/financial.c
Processing file lib/lib@@calculator@sta/math-equation.c
genhtml: ERROR: cannot read /data/GNOME/gnome-calculator/_build/lib/lib@@calculator@sta/lib/lib@@calculator@sta/math-function.c
Processing file lib/lib@@calculator@sta/lib/lib@@calculator@sta/math-function.c
Traceback (most recent call last):
  File "/opt/dev/GNOME/bin/meson", line 29, in <module>
    sys.exit(mesonmain.main())
  File "/opt/dev/GNOME/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 379, in main
    return run(sys.argv[1:], launcher)
  File "/opt/dev/GNOME/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 316, in run
    sys.exit(run_script_command(args[1:]))
  File "/opt/dev/GNOME/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 232, in run_script_command
    return cmdfunc(cmdargs)
  File "/opt/dev/GNOME/lib/python3.6/site-packages/mesonbuild/scripts/coverage.py", line 145, in run
    options.log_dir)
  File "/opt/dev/GNOME/lib/python3.6/site-packages/mesonbuild/scripts/coverage.py", line 98, in coverage
    covinfo])
  File "/usr/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['genhtml', '--prefix', '/data/GNOME/gnome-calculator/_build', '--output-directory', '/data/GNOME/gnome-calculator/_build/meson-logs/coveragereport', '--title', 'Code coverage', '--legend', '--show-details', '--branch-coverage', '/data/GNOME/gnome-calculator/_build/meson-logs/coverage.info']' returned non-zero exit status 2.
ninja: build stopped: subcommand failed.
lcallarec commented 5 years ago

Same issue for me. As shown in this example repo, ninja coverage-text can't bind generated c files with vala sources.

I'll be happy to dig into meson sources to fix this issue, any help will be appreciated to support me in that task...

mdegans commented 4 years ago

Same issue here.

 $ meson .. -Db_coverage=true
The Meson build system
Version: 0.55.0
Source dir: /home/anzu/Projects/columbia
Build dir: /home/anzu/Projects/columbia/builddir
Build type: native build
Project name: Columbia
Project version: 0.1.0
C compiler for the host machine: cc (gcc 7.5.0 "cc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0")
C linker for the host machine: cc ld.bfd 2.30
Vala compiler for the host machine: valac (valac 0.48.6)
Host machine cpu family: aarch64
Host machine cpu: aarch64
Library posix found: YES
Found pkg-config: /usr/bin/pkg-config (0.29.1)
Run-time dependency gstreamer-1.0 found: YES 1.14.5
Run-time dependency libosinfo-1.0 found: YES 1.1.0
Run-time dependency gio-unix-2.0 found: YES 2.56.4
Run-time dependency gio-2.0 found: YES 2.56.4
Configuring config.vala using configuration
Program g-ir-compiler found: YES
Build targets in project: 7

Found ninja-1.8.2 at /usr/bin/ninja
Traceback (most recent call last):
  File "/home/anzu/.local/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 131, in run
    return options.run_func(options)
  File "/home/anzu/.local/lib/python3.6/site-packages/mesonbuild/msetup.py", line 245, in run
    app.generate()
  File "/home/anzu/.local/lib/python3.6/site-packages/mesonbuild/msetup.py", line 159, in generate
    self._generate(env)
  File "/home/anzu/.local/lib/python3.6/site-packages/mesonbuild/msetup.py", line 215, in _generate
    intr.backend.generate()
  File "/home/anzu/.local/lib/python3.6/site-packages/mesonbuild/backend/ninjabackend.py", line 518, in generate
    self.generate_coverage_rules()
  File "/home/anzu/.local/lib/python3.6/site-packages/mesonbuild/backend/ninjabackend.py", line 991, in generate_coverage_rules
    self.generate_coverage_command(e, [])
  File "/home/anzu/.local/lib/python3.6/site-packages/mesonbuild/backend/ninjabackend.py", line 975, in generate_coverage_command
    for compiler in target.compilers.values():
AttributeError: 'CustomTarget' object has no attribute 'compilers'

If I comment out the custom target below, it configures, but no coverage is actually generated when i do ninja coverage.

g_ir_compiler = find_program('g-ir-compiler', required: false)
if g_ir_compiler.found()
# the meson docs are incorrect on this
# https://github.com/mesonbuild/meson/issues/2296#issuecomment-328882589
  custom_target('libcolumbia typelib',
    command: [
      g_ir_compiler,
      '--output', '@OUTPUT@',
      meson.current_build_dir() / libcolumbia_gir
    ],
    depends: libcolumbia,
    output: libcolumbia_typelib,
    install: true,
    install_dir: get_option('libdir') / 'girepository-1.0',
  )
else
  message('not building typelib language bindings')
endif

Before I upgraded, with meson 0.54.0 (i think), it was generating coverage, but only for one of the .c files generated by valac.

cxw42 commented 3 years ago

Also the generated files don't point to the actual .vala source, but to the .c code (while .c files includes #line directives properly).

If you run valac -g, you will get #line directives pointing into the vala source, for generated lines that directly map to .vala lines. The coverage data will be a mix of .vala and .c files, but it works reasonably well in my experience.