Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Allow for test runs over 4 hours #1243

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

Merged
merged 6 commits into from
Feb 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2 development/refresh_sources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ git clone --depth=1 --branch=${SELFTESTING_BRANCH:-main} https://github.com/utPL

rm -rf utPLSQL-cli/*
# download latest release version of utPLSQL-cli
curl -Lk -o utPLSQL-cli.zip https://github.com/utPLSQL/utPLSQL-cli/releases/download/v${UTPLSQL_CLI_VERSION}/utPLSQL-cli.zip
curl -Lk -o utPLSQL-cli.zip https://github.com/utPLSQL/utPLSQL-cli/releases/download/${UTPLSQL_CLI_VERSION}/utPLSQL-cli.zip
# unzip utPLSQL-cli and remove the zip file
unzip utPLSQL-cli.zip && chmod u+x utPLSQL-cli/bin/utplsql && rm utPLSQL-cli.zip

2 changes: 1 addition & 1 deletion 2 docs/userguide/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ The headless scripts accept three optional parameters that define:
The scripts need to be executed by `SYSDBA`, in order to grant access to `DBMS_LOCK` and `DBMS_CRYPTO` system packages.

!!! warning "Important"
- Grant on `DBMS_LOCK` is required only for installation on Oracle versions below 18c. For versions 18c and above, utPLSQL uses `DBMS_SESSION.SLEEP` so access to `DBMS_LOCK` package is no longer needed.<br>
- `DBMS_LOCK` is required for session synchronization between main session and session consuming realtime reports.<br>
- The user performing the installation must have the `ADMINISTER DATABASE TRIGGER` privilege. This is required for installation of trigger that is responsible for parsing annotations at at compile-time of a package.<br>
- When installed with DDL trigger, utPLSQL will not be registering unit tests for any of oracle-maintained schemas.<br>
- For Oracle 11g following users are excluded:<br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ begin
ut_event_manager.initialize();
ut_event_manager.add_listener(l_doc_reporter);
ut_event_manager.add_listener(l_tc_reporter);
ut_event_manager.trigger_event(ut_event_manager.gc_initialize, l_run);

l_suite := ut_suite(user, 'ut_exampletest',a_line_no=>1);
l_suite.description := 'Test Suite Name';
Expand Down
2 changes: 0 additions & 2 deletions 2 source/core/coverage/ut_coverage_reporter_base.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ create or replace type body ut_coverage_reporter_base is
ut_coverage_helper.cleanup_tmp_table();
(l_reporter as ut_output_reporter_base).before_calling_run(null);
l_reporter.after_calling_run( ut_run( a_coverage_options => a_coverage_options, a_client_character_set => a_client_character_set ) );
l_reporter.on_finalize(null);
for i in (select /*+ no_parallel */ x.text from table(l_reporter.get_lines(1, 1)) x ) loop
pipe row (i.text);
end loop;
Expand All @@ -106,7 +105,6 @@ create or replace type body ut_coverage_reporter_base is
ut_coverage_helper.cleanup_tmp_table();
(l_reporter as ut_output_reporter_base).before_calling_run(null);
l_reporter.after_calling_run( ut_run( a_coverage_options => a_coverage_options, a_client_character_set => a_client_character_set ) );
l_reporter.on_finalize(null);
open l_result for select /*+ no_parallel */ x.text from table(l_reporter.get_lines(1, 1)) x;
return l_result;
end;
Expand Down
96 changes: 88 additions & 8 deletions 96 source/core/output_buffers/ut_output_buffer_base.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,94 @@ create or replace type body ut_output_buffer_base is
self.self_type := coalesce(a_self_type,self.self_type);
self.output_id := coalesce(a_output_id, self.output_id, sys_guid());
self.start_date := coalesce(self.start_date, sysdate);
self.last_message_id := 0;
self.last_write_message_id := 0;
select /*+ no_parallel */ count(*) into l_exists from ut_output_buffer_info_tmp where output_id = self.output_id;
if ( l_exists > 0 ) then
update /*+ no_parallel */ ut_output_buffer_info_tmp set start_date = self.start_date where output_id = self.output_id;
else
insert /*+ no_parallel */ into ut_output_buffer_info_tmp(output_id, start_date) values (self.output_id, self.start_date);
end if;
commit;
dbms_lock.allocate_unique( self.output_id, self.lock_handle);
self.is_closed := 0;
end;

member function get_lines_cursor(a_initial_timeout natural := null, a_timeout_sec natural := null) return sys_refcursor is
member procedure lock_buffer(a_timeout_sec number := null) is
l_status integer;
begin
l_status := dbms_lock.request( self.lock_handle, dbms_lock.x_mode, 5, false );
if l_status != 0 then
raise_application_error(-20000, 'Cannot allocate lock for output buffer of reporter. lock request status = '||l_status||', lock handle = '||self.lock_handle||', self.output_id ='||self.output_id);
end if;
end;

member procedure close(self in out nocopy ut_output_buffer_base) is
l_status integer;
begin
l_status := dbms_lock.release( self.lock_handle );
if l_status != 0 then
raise_application_error(-20000, 'Cannot release lock for output buffer of reporter. Lock_handle = '||self.lock_handle||' status = '||l_status);
end if;
self.is_closed := 1;
end;


member procedure remove_buffer_info(self in ut_output_buffer_base) is
pragma autonomous_transaction;
begin
delete from ut_output_buffer_info_tmp a
where a.output_id = self.output_id;
commit;
end;

member function timeout_producer_not_started( a_producer_started boolean, a_already_waited_sec number, a_init_wait_sec number ) return boolean
is
l_result boolean := false;
begin
if not a_producer_started and a_already_waited_sec >= a_init_wait_sec then
if a_init_wait_sec > 0 then
self.remove_buffer_info();
raise_application_error(
ut_utils.gc_out_buffer_timeout,
'Timeout occurred while waiting for report data producer to start. Waited for: '||ut_utils.to_string( a_already_waited_sec )||' seconds.'
);
else
l_result := true;
end if;
end if;
return l_result;
end;

member function timeout_producer_not_finished(a_producer_finished boolean, a_already_waited_sec number, a_timeout_sec number) return boolean
is
l_result boolean := false;
begin
if not a_producer_finished and a_timeout_sec is not null and a_already_waited_sec >= a_timeout_sec then
if a_timeout_sec > 0 then
self.remove_buffer_info();
raise_application_error(
ut_utils.gc_out_buffer_timeout,
'Timeout occurred while waiting for more data from producer. Waited for: '||ut_utils.to_string( a_already_waited_sec )||' seconds.'
);
else
l_result := true;
end if;
end if;
return l_result;
end;

member function get_lock_status return integer is
l_result integer;
l_release_status integer;
begin
l_result := dbms_lock.request( self.lock_handle, dbms_lock.s_mode, 0, false );
if l_result = 0 then
l_release_status := dbms_lock.release( self.lock_handle );
end if;
return l_result;
end;

member function get_lines_cursor(a_initial_timeout number := null, a_timeout_sec number := null) return sys_refcursor is
l_lines sys_refcursor;
begin
open l_lines for
Expand All @@ -44,7 +120,7 @@ create or replace type body ut_output_buffer_base is
return l_lines;
end;

member procedure lines_to_dbms_output(self in ut_output_buffer_base, a_initial_timeout natural := null, a_timeout_sec natural := null) is
member procedure lines_to_dbms_output(self in ut_output_buffer_base, a_initial_timeout number := null, a_timeout_sec number := null) is
l_data sys_refcursor;
l_clob clob;
l_item_type varchar2(32767);
Expand All @@ -54,16 +130,20 @@ create or replace type body ut_output_buffer_base is
loop
fetch l_data into l_clob, l_item_type;
exit when l_data%notfound;
l_lines := ut_utils.clob_to_table(l_clob);
for i in 1 .. l_lines.count loop
dbms_output.put_line(l_lines(i));
end loop;
if dbms_lob.getlength(l_clob) > 32767 then
l_lines := ut_utils.clob_to_table(l_clob);
for i in 1 .. l_lines.count loop
dbms_output.put_line(l_lines(i));
end loop;
else
dbms_output.put_line(l_clob);
end if;
end loop;
close l_data;
end;

member procedure cleanup_buffer(self in ut_output_buffer_base, a_retention_time_sec natural := null) is
gc_buffer_retention_sec constant naturaln := coalesce(a_retention_time_sec, 60 * 60 * 24); -- 24 hours
gc_buffer_retention_sec constant naturaln := coalesce(a_retention_time_sec, 60 * 60 * 24 * 5); -- 5 days
l_retention_days number := gc_buffer_retention_sec / (60 * 60 * 24);
l_max_retention_date date := sysdate - l_retention_days;
pragma autonomous_transaction;
Expand Down
16 changes: 11 additions & 5 deletions 16 source/core/output_buffers/ut_output_buffer_base.tps
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,22 @@ create or replace type ut_output_buffer_base force authid definer as object(
output_id raw(32),
is_closed number(1,0),
start_date date,
last_message_id number(38,0),
last_write_message_id number(38,0),
lock_handle varchar2(30 byte),
self_type varchar2(250 byte),
member procedure init(self in out nocopy ut_output_buffer_base, a_output_id raw := null, a_self_type varchar2 := null),
member function get_lines_cursor(a_initial_timeout natural := null, a_timeout_sec natural := null) return sys_refcursor,
member procedure lines_to_dbms_output(self in ut_output_buffer_base, a_initial_timeout natural := null, a_timeout_sec natural := null),
member procedure lock_buffer(a_timeout_sec number := null),
member function timeout_producer_not_started( a_producer_started boolean, a_already_waited_sec number, a_init_wait_sec number ) return boolean,
member function timeout_producer_not_finished(a_producer_finished boolean, a_already_waited_sec number, a_timeout_sec number) return boolean,
member function get_lock_status return integer,
member function get_lines_cursor(a_initial_timeout number := null, a_timeout_sec number := null) return sys_refcursor,
member procedure lines_to_dbms_output(self in ut_output_buffer_base, a_initial_timeout number := null, a_timeout_sec number := null),
member procedure cleanup_buffer(self in ut_output_buffer_base, a_retention_time_sec natural := null),
not instantiable member procedure close(self in out nocopy ut_output_buffer_base),
member procedure remove_buffer_info(self in ut_output_buffer_base),
member procedure close(self in out nocopy ut_output_buffer_base),
not instantiable member procedure send_line(self in out nocopy ut_output_buffer_base, a_text varchar2, a_item_type varchar2 := null),
not instantiable member procedure send_lines(self in out nocopy ut_output_buffer_base, a_text_list ut_varchar2_rows, a_item_type varchar2 := null),
not instantiable member procedure send_clob(self in out nocopy ut_output_buffer_base, a_text clob, a_item_type varchar2 := null),
not instantiable member function get_lines(a_initial_timeout natural := null, a_timeout_sec natural := null) return ut_output_data_rows pipelined
not instantiable member function get_lines(a_initial_timeout number := null, a_timeout_sec number := null) return ut_output_data_rows pipelined
) not final not instantiable
/
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.