diff options
-rw-r--r-- | doc/testing.txt | 30 | ||||
-rw-r--r-- | src/renderer.h | 4 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 23 | ||||
-rw-r--r-- | tests/FindGLEW.cmake | 6 | ||||
-rwxr-xr-x | tests/test_pretty_print.py | 16 |
5 files changed, 52 insertions, 27 deletions
diff --git a/doc/testing.txt b/doc/testing.txt index 403ef4a..04768cb 100644 --- a/doc/testing.txt +++ b/doc/testing.txt @@ -33,7 +33,7 @@ $ ctest -C <configs> Adds extended tests belonging to configs. Examples - test all examples All - test everything -Adding a new regression test: +Adding a new regression test: ------------------------------ 1) create a test file at an appropriate location under testdata/ @@ -58,15 +58,18 @@ $ DISPLAY=:5 ctest 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: + environment variables, just like for the main qmake & openscad.pro. Examples: - cmake . -DOPENCSG_DIR=~/OpenCSG-1.3.2 - cmake . -DCGAL_DIR=c:\CGAL-3.7 -DBOOST_DIR=c:\boost_1_46_0 + OPENCSGDIR=~/OpenCSG-1.3.2 EIGEN2DIR=~/eigen2 cmake . + + Valid variables are as follows (see CMakeLists.txt for more info): + + BOOSTDIR, CGALDIR, EIGEN2DIR, GLEWDIR, OPENCSGDIR, MACOSX_DEPLOY_DIR 2. Logs Logs of test runs are found in tests/build/Testing/Temporary -Pretty-printed html output is in a subdir of tests/build/Testing/Temporary +Pretty-printed index.html 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/* @@ -74,17 +77,22 @@ Actual results are found in tests/build/testname-output/* Cross-compiling of tests has not been automated nor tested -4. Testing images takes forever, they fail, and it says 'return -11' +4. Image-based tests takes a long time, they fail, and it says 'return -11' -Imagemagick may have crashed. You can try using the alternate comparison +Imagemagick may have crashed. You can try using the alternate IM comparator based on Normalized Cross Correlation. Pass -DCOMPARATOR=ncc to cmake 5. Testing images fails with 'morphology' not found for ImageMagick -Your version of imagemagick is old. Upgrade, or pass -DCOMPARATOR=old to cmake. -The comparison will be of lowered reliability. +Your version of imagemagick is old. Upgrade, or pass -DCOMPARATOR=old to +cmake. The comparison will be of lowered reliability. -6. Many cgalpngtests are failing with weird assertion errors. +6. Unexplained or bizarre errors. -Edit CMakeCache.txt and replace '-DNDEBUG' or '/D NDEBUG' with blank spaces +This can happen on dynamic-library systems (linux) where you try to use +your own version of a library while the system still has another version +under the system paths. You can diagnose this by looking at your cmake +log as well as your sysinfo.txt file, as well as running 'ldd' against +your binaries, to make sure that the proper versions of libraries are +getting compiled and linked with the test binaries. diff --git a/src/renderer.h b/src/renderer.h index e978080..8deabe8 100644 --- a/src/renderer.h +++ b/src/renderer.h @@ -3,6 +3,10 @@ #include "system-gl.h" +#ifdef _MSC_VER // NULL +#include <cstdlib> +#endif + class Renderer { public: diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d795951..d79925a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,3 +1,5 @@ +# instructions - see ../doc/testing.txt + cmake_minimum_required(VERSION 2.8) if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3) # Explicitly use new include policy to avoid globally shadowing included modules @@ -57,16 +59,11 @@ if(WIN32) # you have to pass -DCMAKE_VERBOSE_MAKEFILE=ON to cmake when you run it. endif() - # # Build test apps # # Boost -# -# usually it's found automatically, but some systems may need a custom install. -# in that case, run cmake with -DBOOST_ROOT=/path/to/boost/install -# (being the same path you passed to boost's --prefix when you built it) if (NOT $ENV{MACOSX_DEPLOY_DIR} STREQUAL "") set(BOOST_ROOT "$ENV{MACOSX_DEPLOY_DIR}") endif() @@ -109,10 +106,20 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # Qt4 + +if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") + # make /usr/local/include/qt4 come before /usr/local/include (QT4 vs QT3) + set(CMAKE_INCLUDE_DIRECTORIES_BEFORE ON) +endif() + find_package(OpenGL) find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL REQUIRED) include(${QT_USE_FILE}) +if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") + set(CMAKE_INCLUDE_DIRECTORIES_BEFORE OFF) +endif() + # Eigen2 # Turn off Eigen SIMD optimization @@ -125,11 +132,13 @@ endif() if (NOT EIGEN2_INCLUDE_DIR) find_path(EIGEN2_INCLUDE_DIR Eigen/Core - PATHS ENV EIGEN2DIR /opt/local/include/eigen2 /usr/include/eigen2) + HINTS $ENV{EIGEN2DIR} + PATHS /opt/local/include/eigen2 /usr/include/eigen2) if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") find_path(EIGEN2_INCLUDE_DIR Eigen/Core - PATHS ENV EIGEN2DIR /usr/local/include/eigen2 ) + HINTS $ENV{EIGEN2DIR} + PATHS /usr/local/include/eigen2 ) endif() if (NOT EIGEN2_INCLUDE_DIR) message(FATAL_ERROR "Eigen2 not found") diff --git a/tests/FindGLEW.cmake b/tests/FindGLEW.cmake index 8093ed3..fa3071f 100644 --- a/tests/FindGLEW.cmake +++ b/tests/FindGLEW.cmake @@ -32,12 +32,14 @@ IF (WIN32) ELSE (WIN32) message(STATUS "GLEW_DIR: " ${GLEW_DIR}) FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h - PATHS ${GLEW_DIR}/include /usr/include /usr/local/include + HINTS ${GLEW_DIR}/include + PATHS /usr/include /usr/local/include NO_DEFAULT_PATH DOC "The directory where GL/glew.h resides") FIND_LIBRARY( GLEW_LIBRARY NAMES GLEW glew - PATHS ${GLEW_DIR}/lib /usr/lib /usr/local/lib + HINTS ${GLEW_DIR}/lib + PATHS /usr/lib /usr/local/lib NO_DEFAULT_PATH DOC "The GLEW library") ENDIF (WIN32) diff --git a/tests/test_pretty_print.py b/tests/test_pretty_print.py index d0c24c6..6fdc663 100755 --- a/tests/test_pretty_print.py +++ b/tests/test_pretty_print.py @@ -33,19 +33,16 @@ # 3. save the wikified data to disk # todo +# deal better with the situation where Offscreen rendering fails # do something if tests for GL extensions for OpenCSG fail (test fail, no image production) # copy all images, sysinfo.txt to bundle for html/upload (images # can be altered by subsequent runs) -# figure out hwo to make the thing run after the test -# figure out how CTEST treats the logfiles. # why is hash differing -# instead of having special '-info' prerun, put it as yet-another-test -# and parse the log # fix windows so that it won't keep asking 'this program crashed' over and over. # (you can set this in the registry to never happen, but itd be better if the program # itself was able to disable that temporarily in it's own process) -import string,sys,re,os,hashlib,subprocess,textwrap,time +import string,sys,re,os,hashlib,subprocess,textwrap,time,platform def tryread(filename): data = None @@ -88,7 +85,12 @@ def read_gitinfo(): def read_sysinfo(filename): data = tryread(filename) - if not data: return 'sysinfo: unknown' + if not data: + sinfo = platform.sys.platform + sinfo += '\nsystem cannot create offscreen GL framebuffer object' + sinfo += '\nsystem cannot create images' + sysid = platform.sys.platform+'_no_images' + return sinfo, sysid machine = ezsearch('Machine:(.*?)\n',data) machine = machine.replace(' ','-').replace('/','-') @@ -468,7 +470,7 @@ def main(): if verbose: print 'erasing files in',wikidir try: map(lambda x:os.remove(os.path.join(wikidir,x)), os.listdir(wikidir)) except: pass - print 'writing',len(imgs),'images and',len(txtpages),'text pages to:\n', ' .'+wikidir.replace(os.getcwd(),'') + print 'writing',len(imgs),'images, ',len(txtpages)-1,'text pages, and index.html to:\n', ' .'+wikidir.replace(os.getcwd(),'') for pgname in sorted(imgs): trysave( os.path.join(wikidir,pgname), imgs[pgname]) for pgname in sorted(txtpages): trysave( os.path.join(wikidir,pgname), txtpages[pgname]) |