coverage.proto 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. // Copyright 2021 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.devtools.resultstore.v2;
  16. option go_package = "google.golang.org/genproto/googleapis/devtools/resultstore/v2;resultstore";
  17. option java_multiple_files = true;
  18. option java_outer_classname = "CoverageProto";
  19. option java_package = "com.google.devtools.resultstore.v2";
  20. // Describes line coverage for a file
  21. message LineCoverage {
  22. // Which source lines in the file represent the start of a statement that was
  23. // instrumented to detect whether it was executed by the test.
  24. //
  25. // This is a bitfield where i-th bit corresponds to the i-th line. Divide line
  26. // number by 8 to get index into byte array. Mod line number by 8 to get bit
  27. // number (0 = LSB, 7 = MSB).
  28. //
  29. // A 1 denotes the line was instrumented.
  30. // A 0 denotes the line was not instrumented.
  31. bytes instrumented_lines = 1;
  32. // Which of the instrumented source lines were executed by the test. Should
  33. // include lines that were not instrumented.
  34. //
  35. // This is a bitfield where i-th bit corresponds to the i-th line. Divide line
  36. // number by 8 to get index into byte array. Mod line number by 8 to get bit
  37. // number (0 = LSB, 7 = MSB).
  38. //
  39. // A 1 denotes the line was executed.
  40. // A 0 denotes the line was not executed.
  41. bytes executed_lines = 2;
  42. }
  43. // Describes branch coverage for a file
  44. message BranchCoverage {
  45. // The field branch_present denotes the lines containing at least one branch.
  46. //
  47. // This is a bitfield where i-th bit corresponds to the i-th line. Divide line
  48. // number by 8 to get index into byte array. Mod line number by 8 to get bit
  49. // number (0 = LSB, 7 = MSB).
  50. //
  51. // A 1 denotes the line contains at least one branch.
  52. // A 0 denotes the line contains no branches.
  53. bytes branch_present = 1;
  54. // Contains the number of branches present, only for the lines which have the
  55. // corresponding bit set in branch_present, in a relative order ignoring
  56. // lines which do not have any branches.
  57. repeated int32 branches_in_line = 2;
  58. // As each branch can have any one of the following three states: not
  59. // executed, executed but not taken, executed and taken.
  60. //
  61. // This is a bitfield where i-th bit corresponds to the i-th branch. Divide
  62. // branch number by 8 to get index into byte array. Mod branch number by 8 to
  63. // get bit number (0 = LSB, 7 = MSB).
  64. //
  65. // i-th bit of the following two byte arrays are used to denote the above
  66. // mentioned states.
  67. //
  68. // not executed: i-th bit of executed == 0 && i-th bit of taken == 0
  69. // executed but not taken: i-th bit of executed == 1 && i-th bit of taken == 0
  70. // executed and taken: i-th bit of executed == 1 && i-th bit of taken == 1
  71. bytes executed = 3;
  72. // Described above.
  73. bytes taken = 4;
  74. }
  75. // Describes code coverage for a particular file under test.
  76. message FileCoverage {
  77. // Path of source file within the SourceContext of this Invocation.
  78. string path = 1;
  79. // Details of lines in a file for calculating line coverage.
  80. LineCoverage line_coverage = 2;
  81. // Details of branches in a file for calculating branch coverage.
  82. BranchCoverage branch_coverage = 3;
  83. }
  84. // Describes code coverage for a build or test Action. This is used to store
  85. // baseline coverage for build Actions and test coverage for test Actions.
  86. message ActionCoverage {
  87. // List of coverage info for all source files that the TestResult covers.
  88. repeated FileCoverage file_coverages = 2;
  89. }
  90. // Describes aggregate code coverage for a collection of build or test Actions.
  91. // A line or branch is covered if and only if it is covered in any of the build
  92. // or test actions.
  93. message AggregateCoverage {
  94. // Aggregated coverage info for all source files that the actions cover.
  95. repeated FileCoverage file_coverages = 1;
  96. }