Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 02af1cc

Browse files
committed
Merge branch 'develop' of github.com:utPLSQL/utPLSQL into feature/enable_throw_variable
2 parents 2427a3a + c5bc73e commit 02af1cc

7 files changed

Lines changed: 57 additions & 20 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ before_script:
9797

9898
script:
9999
- if [[ ! $TRAVIS_TAG ]]; then bash test/install_and_run_tests.sh; fi
100+
- if [[ ! $TRAVIS_TAG ]]; then bash .travis/validate_report_files.sh; fi
100101
- if [[ ! $TRAVIS_TAG ]] && [ "${TRAVIS_REPO_SLUG}" = "${UTPLSQL_REPO}" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then sonar-scanner; fi
101102
- if [[ ! $TRAVIS_TAG ]]; then bash .travis/coveralls_uploader.sh; fi
102103
- bash .travis/build_docs.sh

.travis/validate_report_files.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
echo "validate html"
4+
5+
HTML_FILENAME="coverage.html"
6+
#Exclude existing issue with OL nested in PRE
7+
EXCLUSION_REGEX=".*Element\s.?ol.?\snot\sallowed\sas\schild\sof\selement\s.?pre.*"
8+
HTML_VALIDATOR_URL="https://validator.w3.org/nu/"
9+
VALIDATOR_OUT="gnu"
10+
WARNING_REGEX="info warning:"
11+
ERROR_REGEX="error:"
12+
13+
VALIDATION_RESULTS=$(curl -H "Content-Type: text/html; charset=utf-8" --data-binary @$HTML_FILENAME "$HTML_VALIDATOR_URL?out=$VALIDATOR_OUT&filterpattern=$EXCLUSION_REGEX")
14+
15+
ERROR_COUNT=`echo "$VALIDATION_RESULTS" | grep -c "$ERROR_REGEX"`
16+
WARNING_COUNT=`echo "$VALIDATION_RESULTS" | grep -c "$WARNING_REGEX"`
17+
18+
echo "There are $ERROR_COUNT errors, $WARNING_COUNT warning in $HTML_FILENAME"
19+
20+
if [ $ERROR_COUNT -gt 0 ]; then
21+
echo "$VALIDATION_RESULTS" | grep "$ERROR_REGEX"
22+
exit 1
23+
else
24+
exit 0
25+
fi

docs/userguide/install.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ cd source
7070
sqlplus sys/sys_pass@db as sysdba @install_headless.sql utp3 my_verySecret_password utp3_tablespace
7171
```
7272

73-
The script needs to be executed by SYSDBA, in order to grant access to DBMS_LOCK system package.
73+
The script needs to be executed by `SYSDBA`, in order to grant access to `DBMS_LOCK` and `DBMS_CRYPTO` system packages.
7474

7575

7676
# Recommended Schema
@@ -88,7 +88,7 @@ If the installation and utPLSQL owner user is one and the same, the user must ha
8888
- CREATE SYNONYM
8989
- ALTER SESSION
9090

91-
In addition the user must be granted the execute privilege on `DBMS_LOCK` package.
91+
In addition the user must be granted the execute privilege on `DBMS_LOCK` and `DBMS_CRYPTO` packages.
9292

9393
utPLSQL is using [DBMS_PROFILER tables](https://docs.oracle.com/cd/E18283_01/appdev.112/e16760/d_profil.htm#i999476) for code coverage. The tables required by DBMS_PROFILER will be created in the installation schema unless they already exist.
9494
The uninstall process will **not** drop profiler tables, as they can potentially be shared and reused for profiling PLSQL code.

source/core/ut_utils.pkb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -437,28 +437,29 @@ procedure append_to_clob(a_src_clob in out nocopy clob, a_clob_table t_clob_tab,
437437
procedure save_dbms_output_to_cache is
438438
l_status number;
439439
l_line varchar2(32767);
440-
l_line_no integer := 1;
440+
l_offset integer := 0;
441441
l_lines ut_varchar2_rows := ut_varchar2_rows();
442442
c_lines_limit constant integer := 100;
443443
pragma autonomous_transaction;
444444

445-
procedure flush_lines is
445+
procedure flush_lines(a_lines ut_varchar2_rows, a_offset integer) is
446446
begin
447447
insert into ut_dbms_output_cache (seq_no,text)
448-
select rownum, column_value
449-
from table(l_lines);
450-
l_lines.delete;
448+
select rownum+a_offset, column_value
449+
from table(a_lines);
451450
end;
452451
begin
453452
loop
454453
dbms_output.get_line(line => l_line, status => l_status);
455454
exit when l_status = 1;
456455
l_lines := l_lines multiset union all ut_utils.convert_collection(ut_utils.clob_to_table(l_line||chr(7),4000));
457456
if l_lines.count > c_lines_limit then
458-
flush_lines();
457+
flush_lines(l_lines, l_offset);
458+
l_offset := l_offset + l_lines.count;
459+
l_lines.delete;
459460
end if;
460461
end loop;
461-
flush_lines();
462+
flush_lines(l_lines, l_offset);
462463
commit;
463464
end;
464465

source/core/ut_utils.pks

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ create or replace package ut_utils authid definer is
2121
*
2222
*/
2323

24-
gc_version constant varchar2(50) := 'v3.1.2.1939-develop';
24+
gc_version constant varchar2(50) := 'v3.1.2.1964-develop';
2525

2626
/* Constants: Event names */
2727
subtype t_event_name is varchar2(30);

source/reporters/ut_coverage_report_html_helper.pkb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ function get_details_file_content(a_object_id varchar2, a_unit ut_object_name, a
241241
'<span class="' ||line_hits_css_class(executions_per_line(a_coverage.executions
242242
,a_coverage.uncovered_lines + a_coverage.covered_lines)) || '">' ||
243243
executions_per_line(a_coverage.executions, a_coverage.uncovered_lines + a_coverage.covered_lines)
244-
|| '</span></span> hits/line)</h2>' || '<a name="' || l_id || '"></a>' || '<div><b>' ||
244+
|| '</span></span> hits/line)</h2>' || '<a id="a_' || l_id || '"></a>' || '<div><b>' ||
245245
a_coverage.objects.count || '</b> files in total. </div><div>' || '<b>' ||
246246
(a_coverage.uncovered_lines + a_coverage.covered_lines)
247247
|| '</b> relevant lines. ' || '<span class="green"><b>' || a_coverage.covered_lines ||
@@ -306,9 +306,9 @@ function get_details_file_content(a_object_id varchar2, a_unit ut_object_name, a
306306
--TODO - build main file containing total run data and per schema data
307307
l_file_part := '<!DOCTYPE html><html xmlns=''http://www.w3.org/1999/xhtml''><head>' || '<title>' || l_title ||
308308
'</title>' || '<meta http-equiv="content-type" content="text/html; charset=utf-8" />' ||
309-
'<script src=''' || a_assets_path || 'application.js'' type=''text/javascript''></script>' ||
309+
'<script src=''' || a_assets_path || 'application.js''></script>' ||
310310
'<link href=''' || a_assets_path ||
311-
'application.css'' media=''screen, projection, print'' rel=''stylesheet'' type=''text/css''>' ||
311+
'application.css'' media=''screen, print'' rel=''stylesheet'' type=''text/css''/>' ||
312312
'<link rel="shortcut icon" type="image/png" href="' || a_assets_path || 'favicon_' ||
313313
coverage_css_class(l_coverage_pct) || '.png" />' || '<link rel="icon" type="image/png" href="' ||
314314
a_assets_path || 'favicon_' || coverage_css_class(l_coverage_pct) || '.png" />' || '</head>' ||
@@ -339,7 +339,7 @@ function get_details_file_content(a_object_id varchar2, a_unit ut_object_name, a
339339
l_unit := a_coverage_data.objects.next(l_unit);
340340
end loop;
341341

342-
l_file_part := '</div></div></body></html>';
342+
l_file_part := '</div></div></div></body></html>';
343343

344344
ut_utils.append_to_clob(l_result, l_file_part);
345345
return l_result;

test/api/test_ut_runner.pkb

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,25 +180,35 @@ end;';
180180
procedure run_keep_dbms_output_buffer is
181181
l_expected dbmsoutput_linesarray;
182182
l_actual dbmsoutput_linesarray;
183-
l_lines number := 100;
183+
l_results ut3.ut_varchar2_list;
184+
l_lines number := 10000;
184185
begin
185186
--Arrange
186187
create_test_spec();
187188
create_test_body(0);
189+
188190
l_expected := dbmsoutput_linesarray(
189191
'A text placed into DBMS_OUTPUT',
190192
'Another line',
191193
lpad('A very long line',10000,'a')
192194
);
193-
dbms_output.put_line(l_expected(1));
194-
dbms_output.put_line(l_expected(2));
195-
dbms_output.put_line(l_expected(3));
195+
for i in 1 .. 300 loop
196+
l_expected.extend;
197+
l_expected(l_expected.last) := 'line '||i;
198+
end loop;
199+
200+
for i in 1 .. l_expected.count loop
201+
dbms_output.put_line(l_expected(i));
202+
end loop;
203+
196204
--Act
197-
ut3.ut.run('test_cache');
205+
select *
206+
bulk collect into l_results
207+
from table(ut3.ut.run('test_cache'));
198208

199209
--Assert
200210
dbms_output.get_lines(lines => l_actual, numlines => l_lines);
201-
for i in 1 .. l_expected.count loop
211+
for i in 1 .. l_lines loop
202212
ut.expect(l_actual(i)).to_equal(l_expected(i));
203213
end loop;
204214
drop_test_package();

0 commit comments

Comments
 (0)