From: <and...@us...> - 2008-08-06 17:36:36
|
Revision: 8608 http://plplot.svn.sourceforge.net/plplot/?rev=8608&view=rev Author: andrewross Date: 2008-08-06 17:36:43 +0000 (Wed, 06 Aug 2008) Log Message: ----------- Add new test for ctest which compares the postscript output from the different language bindings. For each binding the script lists which examples are missing compared to the C bindings, and which examples produce different results. The script requires tail and diff which are both tested for in plplot.cmake. The test will fail if any examples produce different results from the C equivalent. It will not fail just for missing examples. A complete summary of the results can be viewed in Testing/Temporary/LastTest.log in the build tree, or alternatively using ctest -V. Modified Paths: -------------- trunk/cmake/modules/plplot.cmake trunk/plplot_test/CMakeLists.txt Added Paths: ----------- trunk/plplot_test/test_diff.sh.in Modified: trunk/cmake/modules/plplot.cmake =================================================================== --- trunk/cmake/modules/plplot.cmake 2008-08-05 16:12:12 UTC (rev 8607) +++ trunk/cmake/modules/plplot.cmake 2008-08-06 17:36:43 UTC (rev 8608) @@ -73,6 +73,11 @@ ) endif(NOT SH_EXECUTABLE) +# Find diff and tail which are used to compare results from different +# bindings. +find_program(DIFF_EXECUTABLE diff) +find_program(TAIL_EXECUTABLE tail) + option(PREBUILD_DIST "Pre-build all components required for distribution" OFF) if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") set( Modified: trunk/plplot_test/CMakeLists.txt =================================================================== --- trunk/plplot_test/CMakeLists.txt 2008-08-05 16:12:12 UTC (rev 8607) +++ trunk/plplot_test/CMakeLists.txt 2008-08-06 17:36:43 UTC (rev 8608) @@ -199,6 +199,15 @@ endif(NOT TEST_DEVICE STREQUAL "pngcairo") endif(PLD_pngcairo) +if(DIFF_EXECUTABLE AND TAIL_EXECUTABLE) +configure_file(test_diff.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_diff.sh @ONLY) +set(SCRIPTS test_diff.sh) +add_test(examples_compare + ${SH_EXECUTABLE} -c "./test_diff.sh" +) +endif(DIFF_EXECUTABLE AND TAIL_EXECUTABLE) + + # Make a copy of lena.pgm to the test subdirectory of the build # tree so that example 20 will run from there. # Also need a copy of lena.img for the octave bindings Added: trunk/plplot_test/test_diff.sh.in =================================================================== --- trunk/plplot_test/test_diff.sh.in (rev 0) +++ trunk/plplot_test/test_diff.sh.in 2008-08-06 17:36:43 UTC (rev 8608) @@ -0,0 +1,100 @@ +#!@SH_EXECUTABLE@ +# Test suite to compare C examples with other language bindings +# +# Copyright (C) 2008 Andrew Ross +# +# This file is part of PLplot. +# +# PLplot is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Library Public License as published +# by the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# PLplot is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# along with PLplot; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# + +ret=0 + +# Compare C results with c++, f77, f95, java, octave, python, tcl, perl, +# ada and ocaml results +for lang in c++ f77 f95 java octave python tcl perl ada ocaml ; do + + # Check which suffix is used for this binding + case $lang in + c++) + suffix=cxx + ;; + f77) + suffix=f + ;; + f95) + suffix=f95 + ;; + java) + suffix=j + ;; + octave) + suffix=o + ;; + python) + suffix=p + ;; + tcl) + suffix=t + ;; + perl) + suffix=pdl + ;; + ada) + suffix=a + ;; + ocaml) + suffix=ocaml + ;; + esac + + missing="" + different="" + + # Assume that if example 1 is missing then the language is + # not implemented. + if [ -f x01${suffix}.psc ] ; then + + # Standard non-interactive examples + # Skip example 14 because it requires two output files + # Skip example 17 because it is interactive + for index in 01 02 03 04 05 06 07 08 09 10 11 12 13 15 16 18 19 20 \ + 21 22 23 24 25 26 27 28 29 30 ; do + if [ ! -f x${index}c.psc ] ; then + echo "C example ${index} is missing" + else + if [ ! -f x${index}${suffix}.psc ] ; then + missing="${missing} ${index}" + else + @TAIL_EXECUTABLE@ --lines=+9 x${index}c.psc > test1.psc + @TAIL_EXECUTABLE@ --lines=+9 x${index}${suffix}.psc > test2.psc + @DIFF_EXECUTABLE@ -q test1.psc test2.psc 2>&1 > /dev/null + if [ $? != 0 ] ; then + different="${different} ${index}" + fi + fi + fi + done + echo "${lang}" + echo " Missing examples : ${missing}" + echo " Differing examples : ${different}" + if [ "${different}" != "" ] ; then + ret=1 + fi + fi +done + +exit ${ret} + Property changes on: trunk/plplot_test/test_diff.sh.in ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |