Skip to content

Commit

Permalink
Improved test of xml output, and added test.xml to the target clean.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Rilee authored and Michael Rilee committed Aug 7, 2014
1 parent a5fcbc2 commit 097ccf8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
4 changes: 2 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ clean: local-top1-clean local-top1-cleanExamples
local-top1-clean: local-top1-cleanExamples
$(MAKE) -C $(SOURCE_DIR) clean
$(MAKE) -C $(TESTS_DIR) clean
\rm -f include/configuration.mk
\rm -f include/configuration.mk test.xml

local-top1-cleanExamples:
\rm -f Examples/Simple/tests.xml
Expand All @@ -188,7 +188,7 @@ local-top1-distclean: local-top1-cleanExamples
$(MAKE) -C $(SOURCE_DIR) distclean
$(MAKE) -C $(TESTS_DIR) distclean
$(MAKE) -C $(DOC_DIR) distclean
\rm -f include/configuration.mk
\rm -f include/configuration.mk test.xml

tests: all
ifeq ($(USEMPI),YES)
Expand Down
28 changes: 19 additions & 9 deletions tests/Test_XmlPrinter.F90
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
!-------------------------------------------------------------------------------
! NASA/GSFC, Software Integration & Visualization Office, Code 610.3
! NASA/GSFC, Computational & Information Sciences & Technology, Code 606.
!-------------------------------------------------------------------------------
! MODULE: Test_XmlPrinter
!
!> @brief
!! <BriefDescription>
!! Output test messages in junit.xsd-compatible XML.
!!
!! @author
!! Halvor Lund
!!
!! @date
!! 2014 July
!!
!! @note <A note here.>
!! <Or starting here...>
!! @note Set up a test failure and feed it to an XML-based printer so
!! that we can test its output. Use command line call (via "system")
!! to try to find "xmllint," and if available, use it to validate the
!! output against junit.xsd. Either way, check the output against a
!! hard-coded expected result (a regression test).
!
! REVISION HISTORY:
!
! 2014 July Initial commit.
! 2014 August 7. Added regression test and Intel support. MLR.
! 2014 July. Initial commit.
!
!-------------------------------------------------------------------------------
#include "reflection.h"
Expand Down Expand Up @@ -139,13 +143,19 @@ subroutine compareXMLFileToExpectation(xmlFile)
iExpectedLine = 0
do
read(xmlUnit,'(a)',iostat=iostat) xmlFileLine
if (iostat == iostat_end) exit
if (iostat == iostat_end) then
call assertTrue(iExpectedLine .ge. (size(expected)), &
&'Too few lines in XMLFile.')
exit
end if
call assertEqual(iostat, 0, 'Unexpected XMLFile error.')
iExpectedLine = iExpectedLine + 1
call assertTrue(iExpectedLine .lt. (size(expected) + 1), &
call assertTrue(iExpectedLine .le. size(expected), &
&'Too many lines in XMLFile.')
call assertEqual(expected(iExpectedLine),xmlFileLine, &
& 'XML output file error.')
if (iExpectedLine .le. size(expected)) then
call assertEqual(expected(iExpectedLine),xmlFileLine, &
& 'XML output file error.')
end if
end do
close(xmlUnit)

Expand Down

0 comments on commit 097ccf8

Please sign in to comment.