-
Notifications
You must be signed in to change notification settings - Fork 189
12.2 Oracle Native Block Coverage #604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
287590b
68768f8
76bf869
1f4f5f0
90858eb
d77cf9a
4f83357
ac40332
5f74db9
9d7f16c
20541b5
ab7eb93
8dbb1a1
e0b220d
2560f5b
6fe32c5
8235848
78fdab5
3a19341
466e126
e968f76
0f1d789
faab0fe
35e5e13
1289e99
d3ce10c
c0ca9d3
f151a6e
28f7653
1f51049
9c87b06
d8b8e87
49b1b84
ab7eb24
36279fa
661ef74
57f7a4f
3a2ff00
e6c2be2
c9cb004
a862b95
57ee184
4561795
0556fbe
b91e51d
d19f941
e2e1437
a112e36
f0e2653
4458dff
2027421
924eb9b
a111c6d
2d6c7d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Split block and profiler Added conditional blocks for version less than 12.2 Split html reporter
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| create or replace package body ut_block_helper is | ||
| /* | ||
| utPLSQL - Version 3 | ||
| Copyright 2016 - 2017 utPLSQL Project | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"): | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| type t_proftab_row is record ( | ||
| line binary_integer, | ||
| calls number(38,0) | ||
| ); | ||
|
|
||
| type t_proftab_rows is table of t_proftab_row; | ||
|
|
||
| type t_block_row is record( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would transform the not-so-good Oracle results into:
I assume that there is no situation where we have more than 1 block spanning across more than one line.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’m afraid it might be possible for complex multi line
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even when simple if and bad beutifier we would have one block in single line.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That will skew the results. Block is not necessary span across mutliple lines, using start and end line will result in showing execution on multiple lines that are not part of block. |
||
| line binary_integer | ||
| ,blocks binary_integer | ||
| ,covered_blocks binary_integer); | ||
|
|
||
| type t_block_rows is table of t_block_row; | ||
|
|
||
| procedure coverage_start(a_run_comment varchar2,a_coverage_id out integer) is | ||
| begin | ||
| a_coverage_id := dbms_plsql_code_coverage.start_coverage(run_comment => a_run_comment); | ||
| end; | ||
|
|
||
| procedure coverage_stop is | ||
| begin | ||
| dbms_plsql_code_coverage.stop_coverage(); | ||
| end; | ||
|
|
||
| function block_results(a_object_owner varchar2, a_object_name varchar2) return t_block_rows is | ||
| c_raw_coverage sys_refcursor; | ||
| l_coverage_rows t_block_rows; | ||
| l_coverage_id integer := ut_coverage_helper.get_coverage_id; | ||
| begin | ||
| open c_raw_coverage for q'[select ccb.line | ||
| ,count(ccb.block) totalblocks | ||
| ,sum(ccb.covered) | ||
| from dbmspcc_units ccu | ||
| left outer join dbmspcc_blocks ccb | ||
| on ccu.run_id = ccb.run_id | ||
| and ccu.object_id = ccb.object_id | ||
| where ccu.run_id = :a_coverage_id | ||
| and ccu.owner = :a_object_owner | ||
| and ccu.name = :a_object_name | ||
| group by ccb.line | ||
| order by 1]' using l_coverage_id,a_object_owner,a_object_name; | ||
|
|
||
| fetch c_raw_coverage bulk collect into l_coverage_rows; | ||
| close c_raw_coverage; | ||
|
|
||
| return l_coverage_rows; | ||
| end; | ||
|
|
||
| function get_raw_coverage_data_block(a_object_owner varchar2, a_object_name varchar2) return ut_coverage_helper.t_unit_line_calls is | ||
| l_tmp_data t_block_rows; | ||
| l_results ut_coverage_helper.t_unit_line_calls; | ||
|
|
||
| begin | ||
| l_tmp_data := block_results(a_object_owner => a_object_owner, a_object_name => a_object_name); | ||
| for i in 1 .. l_tmp_data.count loop | ||
| l_results(l_tmp_data(i).line).blocks := l_tmp_data(i).blocks; | ||
| l_results(l_tmp_data(i).line).covered_blocks := l_tmp_data(i).covered_blocks; | ||
| l_results(l_tmp_data(i).line).partcovered := case | ||
| when (l_tmp_data(i).covered_blocks > 0) and | ||
| (l_tmp_data(i).blocks > l_tmp_data(i).covered_blocks) then | ||
| 1 | ||
| else | ||
| 0 | ||
| end; | ||
| end loop; | ||
| return l_results; | ||
| end; | ||
|
|
||
|
|
||
| end; | ||
| / | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| create or replace package ut_block_helper authid definer is | ||
| /* | ||
| utPLSQL - Version 3 | ||
| Copyright 2016 - 2017 utPLSQL Project | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"): | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| procedure coverage_start(a_run_comment in varchar2,a_coverage_id out integer); | ||
|
|
||
| procedure coverage_stop; | ||
|
|
||
| function get_raw_coverage_data_block(a_object_owner varchar2, a_object_name varchar2) return ut_coverage_helper.t_unit_line_calls; | ||
|
|
||
| end; | ||
| / |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe name it
ut_block_coverage_helper- easier to understand