88 l_tcgOptionsStringLINUX
91 %LET l_macname=&sysmacroname;
93 %_sasunit_tempFileName(d_dir);
94 %_sasunit_tempFileName(d_examinee);
97 %IF %_sasunit_handleError(&l_macname, NoTestDB,
98 NOT %sysfunc(exist(target.tsu)) OR NOT %symexist(g_project),
99 %nrstr(test database cannot be accessed, call %initSASUnit before %runSASUnit))
103 %IF
"&i_recursive" NE
"1" %THEN %LET i_recursive=0;
106 %LET l_source = %_sasunit_abspath(&g_root, &i_source);
107 %_sasunit_dir(i_path=&l_source, i_recursive=&i_recursive, o_out=&d_dir)
108 %IF %_sasunit_handleError(&l_macname, NoSourceFiles,
109 %_sasunit_nobs(&d_dir) EQ 0,
110 Error in parameter i_source: no test scenarios found)
113 %DO i=1 %TO %_sasunit_nobs(&d_dir);
122 CALL symput (
'l_scnfile' !! left(put(_n_,8.)), trim(filename));
123 CALL symput (
'l_scnchanged' !! left(put(_n_,8.)), compress(put(changed,12.)));
124 CALL symput (
'l_nscn', compress(put(_n_,8.)));
128 %LET l_auto=&g_sasautos;
130 %DO %WHILE(
"&l_auto" ne
"");
131 %LET l_auto=%quote(&l_auto/);
132 %_sasunit_dir(i_path=&l_auto.*.sas, o_out=&d_dir)
134 set %IF &l_autonr>0 %THEN &d_examinee; &d_dir(in=indir);
135 if indir then auton=&l_autonr;
137 %LET l_autonr = %eval(&l_autonr+1);
139 %IF %symexist(g_sasautos&l_autonr) %THEN %LET l_auto=&&g_sasautos&l_autonr;
145 %LET l_scn = %_sasunit_stdPath(&g_root, &&l_scnfile&i);
148 %_sasunit_checkScenario(
149 i_scnfile = &&l_scnfile&i
150 ,i_changed = &&l_scnchanged&i
157 %IF &l_scnid = 0 %THEN %DO;
159 SELECT max(scn_id) INTO :l_scnid FROM target.scn;
160 %IF &l_scnid=. %THEN %LET l_scnid=0;
161 %LET l_scnid = %eval(&l_scnid+1);
162 INSERT INTO target.scn VALUES (
170 %ELSE %IF &l_dorun %THEN %DO;
172 DELETE FROM target.cas WHERE cas_scnid = &l_scnid;
173 DELETE FROM target.tst WHERE tst_scnid = &l_scnid;
177 %IF &l_dorun %THEN %DO;
178 %PUT ======== test scenario &l_scnid (&l_scn) will be run ========;
183 %PUT ======== test scenario &l_scnid (&l_scn) will not be run ==;
189 %IF &l_dorun %THEN %DO;
192 %_sasunit_getPgmDesc (i_pgmfile=&&l_scnfile&i, r_desc=l_scndesc)
194 UPDATE target.scn SET
195 scn_desc = "&l_scndesc"
196 ,scn_start = %sysfunc(datetime())
197 WHERE scn_id = &l_scnid
203 FILE "%sysfunc(pathname(work))/x.cmd";
204 PUT "&g_removedir ""%sysfunc(pathname(work))/sasuser""&g_endcommand";
205 PUT "&g_makedir ""%sysfunc(pathname(work))/sasuser""&g_endcommand";
206 %IF %length(&g_sasuser) %THEN %DO;
207 PUT "&g_copydir ""&g_sasuser"" ""%sysfunc(pathname(work))/sasuser""&g_endcommand";
210 %if &sysscp. = LINUX %then %do;
211 %_sasunit_xcmd(chmod u+x "%sysfunc(pathname(work))/x.cmd")
213 %_sasunit_xcmd("%sysfunc(pathname(work))/x.cmd")
214 %LET l_rc=_sasunit_delfile(%sysfunc(pathname(work))/x.cmd);
218 %LET l_parenthesis=(;
219 %IF "&g_autoexec" NE "" %THEN %DO;
220 %LET l_parms=&l_parms -autoexec ""&g_autoexec"";
222 %IF &sysscp. = LINUX %THEN %DO;
223 %IF "&g_sascfg" NE "" %THEN %DO;
224 options SET=SASCFGPATH "&g_sascfg.";
228 %IF "&g_sascfg" NE "" %THEN %DO;
229 %LET l_parms=&l_parms -config ""&g_sascfg"";
231 %ELSE %IF %length(%sysfunc(getoption(config))) NE 0 AND %index(%quote(%sysfunc(getoption(config))),%bquote(&l_parenthesis)) NE 1 %THEN %DO;
232 %LET l_parms=&l_parms -config ""%sysfunc(getoption(config))"";
236 %LET l_scnlogfullpath = &g_log/%substr(00&l_scnid.,%length(&l_scnid)).log;
238 %IF &g_testcoverage. EQ 1 %THEN %DO;
241 %LET l_tcgFilePath = &g_log/%substr(00&l_scnid.,%length(&l_scnid)).tcg;
242 %LET l_tcgOptionsString = -mcoverage -mcoverageloc = ""&l_tcgFilePath."";
243 %LET l_tcgOptionsStringLINUX = options mcoverage mcoverageloc='&l_tcgFilePath.';
248 _sCmdString LENGTH = $32000
251 "%sysfunc(pathname(work))/xx.cmd"
254 %IF &sysscp. = LINUX %THEN %DO;
259 !! "-sysin &&l_scnfile&i "
260 !! "-initstmt "" &l_tcgOptionsStringLINUX.; %nrstr(%%_sasunit_scenario%(io_target=)&g_target%nrstr(%);%%let g_scnid=)&l_scnid.;"" "
261 !! "-log &l_scnlogfullpath. "
262 !! "-print &g_testout/%substr(00&l_scnid.,%length(&l_scnid)).lst "
266 !! "-mcompilenote all "
267 !! "-sasautos &g_sasunit "
268 !! "-sasuser %sysfunc(pathname(work))/sasuser "
269 !! "-termstmt ""%nrstr(%%_sasunit_termScenario())"" "
274 """" !! &g_sasstart !! """"
277 !! "-sysin ""&&l_scnfile&i"" "
278 !! "-initstmt ""%nrstr(%%%_sasunit_scenario%(io_target=)&g_target%nrstr(%);%%%let g_scnid=)&l_scnid.;"" "
279 !! "-log ""&l_scnlogfullpath."" "
280 !! "-print ""&g_testout/%substr(00&l_scnid.,%length(&l_scnid)).lst"" "
285 !! "-mcompilenote all "
286 !! "-sasautos ""&g_sasunit"" "
287 !! "-sasuser ""%sysfunc(pathname(work))/sasuser"" "
288 !! "-termstmt ""%nrstr(%%%_sasunit_termScenario())"" "
289 !! "&l_tcgOptionsString. "
296 %IF &sysscp. = LINUX %THEN %DO;
297 %_sasunit_xcmd(chmod u+x "%sysfunc(pathname(work))/xx.cmd");
298 %_sasunit_xcmd(sed -i -e 's/\r
300 %_sasunit_xcmd("%sysfunc(pathname(work))/xx.cmd")
303 %LET l_rc=_sasunit_delfile(%sysfunc(pathname(work))/xx.cmd);
304 %LET l_sysrc = &sysrc;
308 FILE "%sysfunc(pathname(work))/x.cmd";
309 PUT "&g_removedir ""%sysfunc(pathname(work))/sasuser""&g_endcommand";
311 %if &sysscp. = LINUX %then %do;
312 %_sasunit_xcmd(chmod u+x "%sysfunc(pathname(work))/x.cmd")
315 %_sasunit_xcmd("%sysfunc(pathname(work))/x.cmd")
316 %LET l_rc=_sasunit_delfile(%sysfunc(pathname(work))/x.cmd);
320 %LET l_lstfile=&g_testout/%substr(00&l_scnid,%length(&l_scnid)).lst;
321 %IF %SYSFUNC(FILEEXIST("&l_lstfile")) %THEN %DO;
325 CALL symput ('l_filled','1');
329 %IF NOT &l_filled %THEN %DO;
330 %LET l_filled=%_sasunit_delfile(&l_lstfile);
336 i_logfile = &l_scnlogfullpath.
338 ,i_warning = &g_warning.
339 ,r_errors = l_error_count
340 ,r_warnings= l_warning_count
345 SELECT count(*) INTO :l_result0 FROM target.cas WHERE cas_scnid=&l_scnid AND cas_res=0;
346 SELECT count(*) INTO :l_result1 FROM target.cas WHERE cas_scnid=&l_scnid AND cas_res=1;
347 SELECT count(*) INTO :l_result2 FROM target.cas WHERE cas_scnid=&l_scnid AND cas_res=2;
349 %IF &l_result1 GT 0 OR &l_error_count. GT 0 %THEN %DO;
352 %ELSE %IF &l_result2 GT 0 %THEN %DO;
355 %ELSE %IF %EVAL(%SYSFUNC(sum(&l_result0., &l_result1., &l_result2.)) EQ 0) %THEN %DO;
358 %ELSE %IF &l_error_count. GT 0 %THEN %DO;
367 scn_end = %sysfunc(datetime())
369 ,scn_errorcount = &l_error_count.
370 ,scn_warningcount = &l_warning_count.
371 ,scn_res = &l_result.
383 %PUT =========================== Error! runSASUnit aborted! ==========================================;
387 %IF %EVAL("%UPCASE(&g_error_code.)" EQ "%UPCASE(NoSourceFiles)") %THEN %DO;
391 %LET l_scn = %_sasunit_stdPath(&g_root., &l_source.);
393 %LET l_nscncount = 0;
396 INTO :l_nscncount SEPARATED BY ''
398 WHERE Upcase(scn_path) = "%UPCASE(&l_scn.)";
401 %IF %EVAL(&l_nscncount. EQ 0) %THEN %DO;
403 %LET l_scndesc = %STR(Scenario not found - has to fail!);
406 SELECT max(scn_id) INTO :l_scnid FROM target.scn;
407 %IF &l_scnid=. %THEN %LET l_scnid=0;
408 %LET l_scnid = %eval(&l_scnid+1);
409 INSERT INTO target.scn
441 PROC DATASETS NOLIST NOWARN LIB=%scan(&d_dir,1,.);
442 DELETE %scan(&d_dir,2,.);
443 DELETE %scan(&d_examinee,2,.);