Skip to content

Commit b4284ba

Browse files
committed
Addition of a logical for junit activation
1 parent ae5abbb commit b4284ba

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/testdrive.F90

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ module testdrive
119119
public :: junitxml_run_selected
120120
public :: junitxml_close_file
121121

122+
!> Logical for activation JUnit.xml
123+
logical :: ljunit = .false.
124+
122125
!> Unit number for JUnit.xml.
123126
integer :: unit_junitxml
124127

@@ -330,12 +333,12 @@ subroutine junitxml_open_file(name)
330333
open(newunit=unit_junitxml, file=namexml, form='formatted', access='sequential', status='replace')
331334

332335
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"?>', &
335337
& '<testsuites' // &
336338
& ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' // &
337339
& ' xsi:noNamespaceSchemaLocation="JUnit.xsd"' // &
338340
& '>'
341+
ljunit = .true.
339342
else
340343
write(error_unit, '(a)') "# Error: Could not open "//namexml//" for writing! Program stops."
341344
error stop 1
@@ -348,6 +351,8 @@ subroutine junitxml_close_file()
348351

349352
write(unit_junitxml,'(a)') '</testsuites>'
350353
close(unit_junitxml)
354+
355+
ljunit = .false.
351356

352357
end subroutine junitxml_close_file
353358

@@ -607,7 +612,11 @@ recursive subroutine run_unittest(test, unit, stat)
607612
if (.not.test_skipped(error)) then
608613
if (allocated(error) .neqv. test%should_fail) stat = stat + 1
609614
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
611620
!$omp critical(testdrive_testsuite)
612621
write(unit, '(a)') message
613622
if(allocated(junitxml_output)) write(unit_junitxml,'(a)') junitxml_output

0 commit comments

Comments
 (0)