Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Set up basic test infrastructure.

  • Loading branch information...
commit 40c1a50aecc9835a811cd1dfc5c4a0e639a19ef7 1 parent 6be8365
@andreww authored
View
21 wncml/test/Makefile
@@ -0,0 +1,21 @@
+include ../../arch.make
+
+INCFLAGS=`../../FoX-config --fcflags`
+
+NetCDF_FCFLAGS=-I/usr/include
+# Need both the fortran and C shared libs (in /usr/lib, so don't need -L)
+NetCDF_LIBS=-lnetcdff -lnetcdf
+
+# When we are hooked up to FoX!
+# .f90.exe:
+# $(FC) $(FFLAGS) $(INCFLAGS) $(LDFLAGS) $(FCFLAGS_free_f90) $(LINK_O_FLAG) $@ $< `../../FoX-config --libs --wncml`
+
+.f90.exe:
+ $(FC) $(FFLAGS) -I.. $(INCFLAGS) $(NetCDF_FCFLAGS) $(LDFLAGS) $(NetCDF_LIBS) $(FCFLAGS_free_f90) $(LINK_O_FLAG) $@ $< ../m_wncml_xml.o ../m_wncml_util.o `../../FoX-config --libs `
+
+
+check: clean
+ ./run_tests.sh
+
+clean:
+ rm -f *.$(OBJEXT) *.exe
View
18 wncml/test/run_tests.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+INCFLAGS=`../../FoX-config --fcflags`
+export INCFLAGS
+rm -f passed.score failed.score
+rm -f tests.out failed.out
+touch passed.score failed.score
+
+for t in test_ncml?*.sh
+do
+ ./$t
+done
+
+echo RESULT wncml/ Test Results:
+echo RESULT wncml/ Passed: `wc -l passed.score| cut -f 1 -d 'p'`
+echo RESULT wncml/ Failed: `wc -l failed.score| cut -f 1 -d 'f'`
+
+echo RESULT wncml/ See wncml/test/failed.out for details of failed tests.
View
65 wncml/test/test.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+# Core files off, because they are huge on a Mac
+ulimit -c 0
+
+# NB Note that we ensure all locally-produced files
+# have Unix line endings only by using 'tr', in
+# order to compare properly to our canonical versions.
+
+passed=no
+if ! make $1.exe; then
+ echo $1 >> failed.out
+ echo "------------" >> failed.out
+ echo Cannot compile $1 >> failed.out
+ echo "------------" >> failed.out
+else
+ ./$1.exe 2>&1 | tr -d '\15' > test.out
+ if test -f $1.xml
+ then
+ tr -d '\15' < test.xml | grep -v UUID > test.xml.tmp; mv test.xml.tmp test.xml
+ if test -f test.xml
+ then
+ if diff test.xml $1.xml > /dev/null; then
+ passed=yes
+ else
+ echo $1 >> failed.out
+ echo "------------" >> failed.out
+ diff -u test.xml $1.xml >> failed.out
+ echo "------------" >> failed.out
+ fi
+ else
+ echo $1 >> failed.out
+ echo " -----------"
+ echo "test.xml not produced"
+ echo " -----------"
+ fi
+ elif test -f $1.out
+ then
+ # Note below that we don't do a direct grep; we just check
+ # that the only DIFFerences are in one direction.
+ if diff test.out $1.out | grep "^>" > /dev/null; then
+ echo $1 >> failed.out
+ echo "------------" >> failed.out
+ diff -u test.out $1.out >> failed.out
+ echo "------------" >> failed.out
+ else
+ passed=yes
+ fi
+ else
+ echo $1 >> failed.out
+ echo "------------" >> failed.out
+ echo No test output found for $1
+ echo "------------" >> failed.out
+ fi
+fi
+
+if [ $passed = yes ]; then
+ echo 'PASSED: ' $1
+ echo 'PASSED: ' $1 >> tests.out
+ echo '1' >> passed.score
+else
+ echo 'FAILED: ' $1
+ echo 'FAILED: ' $1 >> tests.out
+ echo '1' >> failed.score
+fi
View
7 wncml/test/test_ncmlStartContainer.sh
@@ -0,0 +1,7 @@
+#!/bin/sh -e
+
+for t in ${0%.sh}_*.f90
+do
+ TEST=${t%.f90}
+ ./test.sh $TEST
+done
View
14 wncml/test/test_ncmlStartContainer_1.f90
@@ -0,0 +1,14 @@
+program test
+
+ use m_wncml_xml
+ use FoX_wxml
+
+ implicit none
+
+ type(xmlf_t) :: xf
+
+ call xml_OpenFile(filename='test.xml', xf=xf, unit=-1)
+ call ncmlStartContainer( xf, 'http://www.example.com/testfile.xml')
+ call xml_Close(xf)
+
+end program test
View
2  wncml/test/test_ncmlStartContainer_1.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ncml:netcdf location="http://www.example.com/testfile.xml" xmlns:ncml="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"/>
Please sign in to comment.
Something went wrong with that request. Please try again.