diff options
author | don bright <hugh.m.bright@gmail.com> | 2011-12-07 04:20:17 (GMT) |
---|---|---|
committer | don bright <hugh.m.bright@gmail.com> | 2011-12-07 04:20:17 (GMT) |
commit | d26effccf4c9fabfe19355d6da4903291d8dd599 (patch) | |
tree | d6f2fc42feae2fa494546886d9fd4889651769e9 | |
parent | 61bfb8f058e8935432fed6098a1d70dba194f6bf (diff) |
allow alternate image comparison using option to cmake
-rw-r--r-- | doc/testing.txt | 17 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 8 | ||||
-rwxr-xr-x | tests/test_cmdline_tool.py | 20 | ||||
-rwxr-xr-x | tests/test_pretty_print.py | 6 |
4 files changed, 36 insertions, 15 deletions
diff --git a/doc/testing.txt b/doc/testing.txt index df77073..c2d3ccf 100644 --- a/doc/testing.txt +++ b/doc/testing.txt @@ -50,13 +50,15 @@ Adding a new regression test: Troubleshooting: ------------------------------ -0. Headless unix servers (no X11): +0. Headless unix servers (no X11) $ Xvfb :5 -screen 0 800x600x24 & $ DISPLAY=:5 ctest -1. To help CMAKE find eigen2, OpenCSG, CGAL, Boost, and GLEW, you can use - the -D option. See CMakeLists.txt for more information. Examples: +1. Trouble finding libraries + + To help CMAKE find eigen2, OpenCSG, CGAL, Boost, and GLEW, you can use + the -D option. See CMakeLists.txt for more information. Examples: cmake . -DOPENCSG_DIR=~/OpenCSG-1.3.2 cmake . -DCGAL_DIR=c:\CGAL-3.7 -DBOOST_ROOT=c:\boost_1_46_0 @@ -68,4 +70,11 @@ Pretty-printed html output is in a subdir of tests/build/Testing/Temporary Expected results are found in tests/regression/* Actual results are found in tests/build/testname-output/* -3. Cross-compiling of tests has not been automated nor tested. +3. Cross-compiling + +Cross-compiling of tests has not been automated nor tested + +4. Testing images takes forever, they fail, and it says 'return -11' + +Imagemagick may have crashed. Try passing -DCOMPARATOR=ncc to cmake + diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 314b51f..04be773 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -422,6 +422,12 @@ function(get_test_fullname TESTCMD FILENAME FULLNAME) set(${FULLNAME} ${${FULLNAME}} PARENT_SCOPE) endfunction() +# comparison method to use +if (NOT $ENV{COMPARATOR} STREQUAL "") + set(COMPARATOR "$ENV{COMPARATOR}") +endif() +message(STATUS "COMPARATOR: " ${COMPARATOR}) + # # This functions adds cmd-line tests given files. # Files are sent as the parameters following TESTSUFFIX @@ -452,7 +458,7 @@ macro(add_cmdline_test TESTCMD TESTSUFFIX) set(CONFARG CONFIGURATIONS) set(CONFVAL ${FOUNDCONFIGS}) - add_test(NAME ${TEST_FULLNAME} ${CONFARG} ${CONFVAL} COMMAND ${PYTHON_EXECUTABLE} ${tests_SOURCE_DIR}/test_cmdline_tool.py -c ${ImageMagick_convert_EXECUTABLE} -s ${TESTSUFFIX} ${CMAKE_BINARY_DIR}/${TESTCMD} "${SCADFILE}") + add_test(NAME ${TEST_FULLNAME} ${CONFARG} ${CONFVAL} COMMAND ${PYTHON_EXECUTABLE} ${tests_SOURCE_DIR}/test_cmdline_tool.py --comparator=${COMPARATOR} -c ${ImageMagick_convert_EXECUTABLE} -s ${TESTSUFFIX} ${CMAKE_BINARY_DIR}/${TESTCMD} "${SCADFILE}") endif() endforeach() endmacro() diff --git a/tests/test_cmdline_tool.py b/tests/test_cmdline_tool.py index 480584c..dace3f5 100755 --- a/tests/test_cmdline_tool.py +++ b/tests/test_cmdline_tool.py @@ -78,16 +78,18 @@ def compare_default(resultfilename): def compare_png(resultfilename): compare_method = 'pixel' #args = [expectedfilename, resultfilename, "-alpha", "Off", "-compose", "difference", "-composite", "-threshold", "10%", "-blur", "2", "-threshold", "30%", "-format", "%[fx:w*h*mean]", "info:"] - #args = [expectedfilename, resultfilename, "-alpha", "Off", "-compose", "difference", "-composite", "-threshold", "10%", "-morphology", "Erode", "Square", "-format", "%[fx:w*h*mean]", "info:"] + args = [expectedfilename, resultfilename, "-alpha", "Off", "-compose", "difference", "-composite", "-threshold", "10%", "-morphology", "Erode", "Square", "-format", "%[fx:w*h*mean]", "info:"] # for systems with older imagemagick that doesnt support '-morphology' # http://www.imagemagick.org/Usage/morphology/#alturnative - args = [expectedfilename, resultfilename, "-alpha", "Off", "-compose", "difference", "-composite", "-threshold", "10%", "-gaussian-blur","3x65535", "-threshold", "99.99%", "-format", "%[fx:w*h*mean]", "info:"] + if options.comparator == 'old': + args = [expectedfilename, resultfilename, "-alpha", "Off", "-compose", "difference", "-composite", "-threshold", "10%", "-gaussian-blur","3x65535", "-threshold", "99.99%", "-format", "%[fx:w*h*mean]", "info:"] - # for systems where imagemagick crashes when using the above comparators - # args = [expectedfilename, resultfilename, "-alpha", "Off", "-compose", "difference", "-metric", "NCC", "tmp.png"] - # options.convert_exec = 'compare' - # compare_method = 'NCC' + if options.comparator == 'ncc': + # for systems where imagemagick crashes when using the above comparators + args = [expectedfilename, resultfilename, "-alpha", "Off", "-compose", "difference", "-metric", "NCC", "tmp.png"] + options.convert_exec = 'compare' + compare_method = 'NCC' msg = 'ImageMagick image comparison: ' msg += os.path.basename(options.convert_exec) + ' ' + ' '.join(args) @@ -168,7 +170,7 @@ def usage(): if __name__ == '__main__': # Handle command-line arguments try: - opts, args = getopt.getopt(sys.argv[1:], "gs:c:t:", ["generate", "convexec=", "suffix=", "test="]) + opts, args = getopt.getopt(sys.argv[1:], "gs:c:t:m:", ["generate", "convexec=", "suffix=", "test=", "comparator="]) except getopt.GetoptError, err: usage() sys.exit(2) @@ -186,8 +188,10 @@ if __name__ == '__main__': else: options.suffix = a elif o in ("-t", "--test"): options.testname = a - elif o in ("-c", "--convexec"): + elif o in ("-c", "--convexec"): options.convert_exec = os.path.normpath( a ) + elif o in ("-m", "--comparator"): + options.comparator = a # <cmdline-tool> and <argument> if len(args) < 2: diff --git a/tests/test_pretty_print.py b/tests/test_pretty_print.py index d297caf..ca6af5f 100755 --- a/tests/test_pretty_print.py +++ b/tests/test_pretty_print.py @@ -19,11 +19,13 @@ # # This program 'pretty prints' the ctest output, namely # files from builddir/Testing/Temporary. -# html & wiki output are produced in Testing/Temporary/wiki -# wiki uploading is available by running +# html & wiki output are produced in Testing/Temporary/sysid_report +# +# experimental wiki uploading is available by running # # python test_pretty_print.py --upload # + # Design philosophy # # 1. parse the data (images, logs) into easy-to-use data structures |