From: <ai...@us...> - 2010-05-12 02:09:54
|
Revision: 10991 http://plplot.svn.sourceforge.net/plplot/?rev=10991&view=rev Author: airwin Date: 2010-05-12 02:09:41 +0000 (Wed, 12 May 2010) Log Message: ----------- Use cmp -i if available on Linux (the -i option may not be available on other POSIX-compliant systems) to compare PostScript files in the configured plplot_test/test_diff.sh(.in) script. This gives a factor of ~1.6 speedup on the test_diff_psc target when all PostScript prerequisites are already built. Modified Paths: -------------- trunk/cmake/modules/plplot.cmake trunk/examples/CMakeLists.txt trunk/examples/plplot_configure.cmake_installed_examples.in trunk/plplot_test/CMakeLists.txt trunk/plplot_test/test_diff.sh.in Modified: trunk/cmake/modules/plplot.cmake =================================================================== --- trunk/cmake/modules/plplot.cmake 2010-05-11 17:17:11 UTC (rev 10990) +++ trunk/cmake/modules/plplot.cmake 2010-05-12 02:09:41 UTC (rev 10991) @@ -140,12 +140,21 @@ ) endif(NOT SH_EXECUTABLE) -# Find diff, tail and tee which are used to compare results from different +# Find diff and tail which are used to compare results from different # bindings. find_program(DIFF_EXECUTABLE diff) find_program(TAIL_EXECUTABLE tail) +# On Linux find cmp which is faster than diff. N.B. other Unix systems may +# have a POSIX-compliant cmp but without the GNU extension available on +# Linux of the -i option which we use to skip the datestamp on PostScript +# files. +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + find_program(CMP_EXECUTABLE cmp) + if(CMP_EXECUTABLE) + set(HAVE_CMP_I ON) + endif(CMP_EXECUTABLE) +endif(CMAKE_SYSTEM_NAME STREQUAL "Linux") - option(PREBUILD_DIST "Pre-build all components required for distribution" OFF) if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") set( Modified: trunk/examples/CMakeLists.txt =================================================================== --- trunk/examples/CMakeLists.txt 2010-05-11 17:17:11 UTC (rev 10990) +++ trunk/examples/CMakeLists.txt 2010-05-12 02:09:41 UTC (rev 10991) @@ -139,9 +139,11 @@ set(PSTEX_COMMENT "#") endif(NOT PLD_pstex) - if(NOT DIFF_EXECUTABLE OR NOT TAIL_EXECUTABLE) + if(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) + set(COMPARE_COMMENT) + else(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) set(COMPARE_COMMENT "#") - endif(NOT DIFF_EXECUTABLE OR NOT TAIL_EXECUTABLE) + endif(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) if(NOT PLD_cgm) set(CGM_COMMENT "#") @@ -480,7 +482,7 @@ endif(ENABLE_${language}) endforeach(language_info ${language_info_LIST}) - if(DIFF_EXECUTABLE AND TAIL_EXECUTABLE) + if(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) # Note this target has complete file and target dependencies for # a comparison of stdout and PostScript results. add_custom_target(test_diff_psc COMMAND ${compare_command} @@ -488,9 +490,9 @@ ) add_dependencies(test_diff_psc ${diff_targets_LIST}) set(noninteractive_targets_LIST test_diff_psc) - else(DIFF_EXECUTABLE AND TAIL_EXECUTABLE) + else(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) set(noninteractive_targets_LIST) - endif(DIFF_EXECUTABLE AND TAIL_EXECUTABLE) + endif(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) else(PLD_psc) set(noninteractive_targets_LIST) endif(PLD_psc) Modified: trunk/examples/plplot_configure.cmake_installed_examples.in =================================================================== --- trunk/examples/plplot_configure.cmake_installed_examples.in 2010-05-11 17:17:11 UTC (rev 10990) +++ trunk/examples/plplot_configure.cmake_installed_examples.in 2010-05-12 02:09:41 UTC (rev 10991) @@ -216,3 +216,4 @@ set(DIFF_EXECUTABLE @DIFF_EXECUTABLE@) set(TAIL_EXECUTABLE @TAIL_EXECUTABLE@) +set(CMP_EXECUTABLE @CMP_EXECUTABLE@) Modified: trunk/plplot_test/CMakeLists.txt =================================================================== --- trunk/plplot_test/CMakeLists.txt 2010-05-11 17:17:11 UTC (rev 10990) +++ trunk/plplot_test/CMakeLists.txt 2010-05-12 02:09:41 UTC (rev 10991) @@ -332,7 +332,7 @@ ) endif(PLD_pdf) - if(DIFF_EXECUTABLE AND TAIL_EXECUTABLE) + if(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) configure_file( test_diff.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_diff.sh @@ -342,7 +342,7 @@ add_test(examples_compare ${SH_EXECUTABLE} -c "./test_diff.sh" ) - endif(DIFF_EXECUTABLE AND TAIL_EXECUTABLE) + endif(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) # Make a copy of lena.pgm to the test subdirectory of the build Modified: trunk/plplot_test/test_diff.sh.in =================================================================== --- trunk/plplot_test/test_diff.sh.in 2010-05-11 17:17:11 UTC (rev 10990) +++ trunk/plplot_test/test_diff.sh.in 2010-05-12 02:09:41 UTC (rev 10991) @@ -107,11 +107,20 @@ if [ ! -f x${xsuffix}${index}${suffix}.psc ] ; then missing="${missing} ${index}" else - @TAIL_EXECUTABLE@ -n +9 x${xsuffix_c}${index}c.psc > test1.psc - @TAIL_EXECUTABLE@ -n +9 x${xsuffix}${index}${suffix}.psc > test2.psc - @DIFF_EXECUTABLE@ -q test1.psc test2.psc 2>&1 > /dev/null - if [ $? != 0 ] ; then - different="${different} ${index}" + if [ "@HAVE_CMP_I@" = "ON" ] ; then + # Skip first 190 bytes of comparison to ignore date stamp. + @CMP_EXECUTABLE@ -s -i 190 x${xsuffix_c}${index}c.psc x${xsuffix}${index}${suffix}.psc + if [ $? != 0 ] ; then + different="${different} ${index}" + fi + else + # Drop first 8 lines from comparison to ignore date stamp. + @TAIL_EXECUTABLE@ -n +9 x${xsuffix_c}${index}c.psc > test1.psc + @TAIL_EXECUTABLE@ -n +9 x${xsuffix}${index}${suffix}.psc > test2.psc + @DIFF_EXECUTABLE@ -q test1.psc test2.psc 2>&1 > /dev/null + if [ $? != 0 ] ; then + different="${different} ${index}" + fi fi if [ "$index" != "14a" ] ; then if [ -f x${xsuffix}${index}${suffix}_psc.txt ] ; then This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |