@@ -8,21 +8,31 @@ Scrip invocation:
88 ut_run.sql user password database [ut_path|ut_paths] (-f=format [-o=output] [-s] ...)
99
1010Parameters:
11- user - username to connect as
12- password - password of the user
13- database - database to connect to
14- ut_path - a path(s) ot unit test(s) to be executed: user[.package[.procedure]]
15- ut_paths - a comma separated list of ut_path (with no spaces in between)
16- -f=format - a format to be used for reporting
17- -o=output - a file name to put the outputs into
18- -s - put output to screen can be used in combination with -o
11+ user - username to connect as
12+ password - password of the user
13+ database - database to connect to
14+ ut_path - a path(s) ot unit test(s) to be executed: user[.package[.procedure]]
15+ ut_paths - a comma separated list of ut_path (with no spaces in between)
16+ -f=format - reporter to be used for reporting
17+ -o=output - file name to save the output provided by the reporter.
18+ If defined, the output is not displayed on screen by default. This can be changed with the -s parameter.
19+ If not defined, then output will be displayed on screen, even if the parameter -s is not specified.
20+ If more than one -o parameter is specified for one -f parameter, the last one is taken into consideration.
21+ -s - Forces putting output to to screen for a given -f parameter.
1922
2023 Parameters -f, -o, -s are correlated. That is parameters -o and -s are defining outputs for -f.
21- Example:
22- ut_run hr hr xe hr -f=ut_documentation_reporter -o=run.log -s -f=ut_teamcity_reporter -o=teamcity.xml
23- Unit tests will be be invoked with two reporters:
24- - ut_documentation_reporter - this one will output to screen and into file "run.log"
25- - ut_teamcity_reporter - this one will output to file "teamcity.xml"
24+ Examples of invocation using sqlplus from command line:
25+
26+ sqlplus /nolog @ut_run hr hr xe hr -f=ut_documentation_reporter -o=run.log -s -f=ut_teamcity_reporter -o=teamcity.xml
27+
28+ Unit tests will be be invoked with two reporters:
29+ - ut_documentation_reporter - this one will output to screen and into file "run.log"
30+ - ut_teamcity_reporter - this one will output to file "teamcity.xml"
31+
32+ sqlplus /nolog @ut_run hr hr xe hr -f=ut_documentation_reporter
33+
34+ Unit tests will be be invoked with ut_documentation_reporter as a format and the results will be printed to screen
35+
2636 */
2737
2838whenever sqlerror exit failure
@@ -44,7 +54,7 @@ set verify off
4454set heading off
4555
4656set define off
47- spool make_input_params_optional .sql
57+ spool make_input_params_optional .sql .tmp
4858declare
4959 l_sql_columns varchar2 (4000 );
5060begin
5868spool off
5969set define &
6070
61- @@make_input_params_optional .sql
71+ @@make_input_params_optional .sql .tmp
6272
6373
6474-- prepare executor scripts
6575
6676set define off
67- spool set_run_params .sql
77+ spool set_run_params .sql .tmp
6878declare
6979 l_params varchar2 (4000 );
7080begin
@@ -78,10 +88,10 @@ spool off
7888set define &
7989
8090
81- @@set_run_params .sql
91+ @@set_run_params .sql .tmp
8292
8393
84- spool run_in_backgroung .sql
94+ spool run_in_backgroung .sql .tmp
8595declare
8696 l_output_type varchar2 (256 ) := ut_runner .get_streamed_output_type_name ();
8797 l_run_params ut_runner .t_run_params := ut_runner .get_run_params ();
94104 p( ' set trimspool on' );
95105 p( ' set pagesize 0' );
96106 p( ' set linesize 4000' );
97- p( ' spool run_background .log' );
107+ p( ' spool ut_run.dbms_output .log' );
98108 p( ' declare' );
99109 p( ' v_reporter ut_reporter;' );
100110 p( ' v_reporters_list ut_reporters_list := ut_reporters_list();' );
113123/
114124spool off
115125
116- spool gather_data_from_outputs .sql
126+ spool gather_data_from_outputs .sql .tmp
117127declare
118128 l_output_type varchar2 (256 ) := ut_runner .get_streamed_output_type_name ();
119129 l_run_params ut_runner .t_run_params := ut_runner .get_run_params ();
@@ -136,16 +146,24 @@ end;
136146/
137147
138148spool off
139-
149+ set termout off
140150set define #
141151-- try running on windows
142- $ start sqlplus # #1/##2@##3 @run_in_backgroung.sql
152+ $ start sqlplus # #1/##2@##3 @run_in_backgroung.sql.tmp
143153-- try running on linus/unix
144- ! sqlplus # #1/##2@##3 @run_in_backgroung.sql &
154+ ! sqlplus # #1/##2@##3 @run_in_backgroung.sql.tmp &
145155set define &
146-
156+ set termout on
147157-- make sure we fetch row by row to indicate the progress
148158set arraysize 1
149- @gather_data_from_outputs .sql
159+ @gather_data_from_outputs .sql .tmp
160+
161+ set termout off
162+ -- cleanup temporary sql files
163+ -- try running on windows
164+ $ del * .sql .tmp
165+ -- try running on linus/unix
166+ ! rm * .sql .tmp
167+ set termout on
150168
151169exit
0 commit comments