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

Skip to content
Prev Previous commit
Next Next commit
Reworking install script to run some actions only on the first JOB (1…
…1g - fastest):

- testing of code uninstall process
- checking code style validity
  • Loading branch information
jgebal committed Jul 29, 2018
commit 69d504f3121703c534228e7670f7f47eb65094a8
96 changes: 41 additions & 55 deletions .travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,65 @@

cd source
set -ev

#install core of utplsql
"$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
set feedback off
set verify off

alter session set plsql_warnings = 'ENABLE:ALL', 'DISABLE:(5004,5018,6000,6001,6003,6009,6010,7206)';
alter session set plsql_optimize_level=0;
@install_headless.sql $UT3_OWNER $UT3_OWNER_PASSWORD
SQL

#uninstall core of utplsql
"$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
set feedback off
set verify off

@uninstall_all.sql $UT3_OWNER
declare
v_leftover_objects_count integer;
begin
select sum(cnt)
into v_leftover_objects_count
from (select count(1) cnt from dba_objects where owner = '$UT3_OWNER'
union all
select count(1) cnt from dba_synonyms where table_owner = '$UT3_OWNER'
);
if v_leftover_objects_count > 0 then
raise_application_error(-20000, 'Not all objects were successfully uninstalled - leftover objects count='||v_leftover_objects_count);
end if;
end;
/
if [ "$TRAVIS_JOB_ID" == "1" ]; then

#check code-style for errors
time "$SQLCLI" $UT3_OWNER/$UT3_OWNER_PASSWORD@//$CONNECTION_STR @../development/utplsql_style_check.sql

#test install/uninstall process
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
set feedback off
set verify off

@uninstall_all.sql $UT3_OWNER
declare
v_leftover_objects_count integer;
begin
select sum(cnt)
into v_leftover_objects_count
from (select count(1) cnt from dba_objects where owner = '$UT3_OWNER'
union all
select count(1) cnt from dba_synonyms where table_owner = '$UT3_OWNER'
);
if v_leftover_objects_count > 0 then
raise_application_error(-20000, 'Not all objects were successfully uninstalled - leftover objects count='||v_leftover_objects_count);
end if;
end;
/
SQL

#reinstall core of utplsql
"$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
set feedback off
set verify off
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
set feedback off
set verify off

alter session set plsql_warnings = 'ENABLE:ALL', 'DISABLE:(5004,5018,6000,6001,6003,6009,6010,7206)';
alter session set plsql_optimize_level=0;
@install.sql $UT3_OWNER
alter session set plsql_optimize_level=0;
@install.sql $UT3_OWNER
SQL

fi

#additional privileges to run scripted tests
"$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
set feedback on
--needed for Mystats script to work
grant select any dictionary to $UT3_OWNER;
--Needed for testing a coverage outside ut3_owner.
grant create any procedure, drop any procedure, execute any procedure to $UT3_OWNER;

conn $UT3_OWNER/$UT3_OWNER_PASSWORD@//$CONNECTION_STR
@../development/utplsql_style_check.sql
SQL

#Create additional users
"$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
#Create user that will own the tests
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
set feedback off
@create_utplsql_owner.sql $UT3_TESTER $UT3_TESTER_PASSWORD $UT3_TABLESPACE

Expand All @@ -71,29 +75,11 @@ grant create job to $UT3_TESTER;
exit
SQL

#additional privileges to run tests
"$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
set feedback on
--needed for Mystats script to work
grant select any dictionary to $UT3_OWNER;
--Needed for testing a coverage outside ut3_owner.
grant create any procedure, drop any procedure, execute any procedure to $UT3_OWNER;

exit
SQL

#Create additional users
"$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
#Create additional UT3$USER# to test for special characters
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
set feedback off
@create_utplsql_owner.sql $UT3_USER $UT3_USER_PASSWORD $UT3_TABLESPACE

exit
SQL

#Grant UT3 framework to UT3$USER#
"$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
set feedback off
--Grant UT3 framework to UT3$USER#
@create_user_grants.sql $UT3_OWNER $UT3_USER

exit
SQL