@@ -119,6 +119,9 @@ module testdrive
119
119
public :: junitxml_run_selected
120
120
public :: junitxml_close_file
121
121
122
+ ! > Logical for activation JUnit.xml
123
+ logical :: ljunit = .false.
124
+
122
125
! > Unit number for JUnit.xml.
123
126
integer :: unit_junitxml
124
127
@@ -330,12 +333,12 @@ subroutine junitxml_open_file(name)
330
333
open (newunit= unit_junitxml, file= namexml, form= ' formatted' , access= ' sequential' , status= ' replace' )
331
334
332
335
if (unit_junitxml /= - 1 ) then
333
- write (unit_junitxml,' (a)' ) ' <?xml version="1.0" encoding="UTF-8"?>'
334
- write (unit_junitxml,' (a)' ) &
336
+ write (unit_junitxml,' (a/,a)' ) ' <?xml version="1.0" encoding="UTF-8"?>' , &
335
337
& ' <testsuites' // &
336
338
& ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' // &
337
339
& ' xsi:noNamespaceSchemaLocation="JUnit.xsd"' // &
338
340
& ' >'
341
+ ljunit = .true.
339
342
else
340
343
write (error_unit, ' (a)' ) " # Error: Could not open " // namexml// " for writing! Program stops."
341
344
error stop 1
@@ -348,6 +351,8 @@ subroutine junitxml_close_file()
348
351
349
352
write (unit_junitxml,' (a)' ) ' </testsuites>'
350
353
close (unit_junitxml)
354
+
355
+ ljunit = .false.
351
356
352
357
end subroutine junitxml_close_file
353
358
@@ -607,7 +612,11 @@ recursive subroutine run_unittest(test, unit, stat)
607
612
if (.not. test_skipped(error)) then
608
613
if (allocated (error) .neqv. test% should_fail) stat = stat + 1
609
614
end if
610
- call make_output(message, test, error, junitxml_output)
615
+ if (ljunit) then
616
+ call make_output(message, test, error, junitxml_output)
617
+ else
618
+ call make_output(message, test, error)
619
+ endif
611
620
! $omp critical(testdrive_testsuite)
612
621
write (unit, ' (a)' ) message
613
622
if (allocated (junitxml_output)) write (unit_junitxml,' (a)' ) junitxml_output
0 commit comments