Skip to content

Cannot parse coverage.json as it contains warnings [BUG] #345

@Lana243

Description

@Lana243

Description
UTBot cannot parse coverage.json file as it contains warnings. The reason is that coverage.json is written by redirecting output from llvm-cov export command called from the shell.

To Reproduce
Steps to reproduce the behavior:

  1. Open the json-error project in VSCode
  2. Use plugin to generate tests for function sum_up_to from file lib/loops.c
  3. Run the generated test

Expected behavior
Coverage response is supposed to be generated and shown in project by color.

Actual behavior
Coverage response is not generated. In logs you can see the following error message:

2022-07-25 16:23:03.167 [utbot-YXZP      ]          JsonUtils.cpp:20     ERR| [json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - invalid literal; last read: 'w': warning: 1 functions have mismatched data

Also in logs you'll find the whole coverage.json printed.
If you find file coverage.json that was generated by llvm-cov export, you'll see the following:

warning: 1 functions have mismatched data
(actual json file)

Environment
Reproduced on release 2022.7.1

Additional context
This issue is caused by creating json by redirecting output stream of llvm-cov export to coverage.json. Even if the issue is not reproducible this approach of creating coverage.json file should be changed in order to avoid such issues in future!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions