summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDon Bright <hugh.m.bright@gmail.com>2011-12-01 04:24:14 (GMT)
committerDon Bright <hugh.m.bright@gmail.com>2011-12-01 04:24:14 (GMT)
commitb1b46e80707e0ca79f1dfb6aad67f44c7a8d719e (patch)
tree76407db4589ebc63cb1cb6e2da7b43fae556e0af
parent8e85f09b29ff8c56c26fa69e369080f1d7e09203 (diff)
fix up testing, add opencsg version info
-rw-r--r--tests/CMakeLists.txt28
-rw-r--r--tests/FindGLEW.cmake3
-rw-r--r--tests/csgtestcore.cc6
-rwxr-xr-xtests/test_pretty_print.py50
4 files changed, 66 insertions, 21 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index ac021e5..58df471 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -27,11 +27,7 @@ endif()
if(WIN32_STATIC_BUILD)
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
- set(EMSG "\nTo build Win32 STATIC OpenSCAD tests you must run")
- set(EMSG "${EMSG} \ncmake .. -DCMAKE_BUILD_TYPE=Release")
- set(EMSG "${EMSG} \nthen replace /MD with /MT in CMakeCache.txt")
- set(EMSG "${EMSG} \ni.e. sed -i s/\\/MD/\\/MT/ CMakeCache.txt")
- set(EMSG "${EMSG} \nthen re-run cmake ..")
+ set(EMSG "\nTo build Win32 STATIC OpenSCAD please see doc/testing.txt")
message(FATAL_ERROR ${EMSG})
endif()
endif()
@@ -158,7 +154,9 @@ include_directories(${OPENCSG_INCLUDE_DIR})
# GLEW
-if (NOT $ENV{MACOSX_DEPLOY_DIR} STREQUAL "")
+if (NOT $ENV{GLEW_DIR} STREQUAL "")
+ set(GLEW_DIR "$ENV{GLEW_DIR}")
+elseif (NOT $ENV{MACOSX_DEPLOY_DIR} STREQUAL "")
set(GLEW_DIR "$ENV{MACOSX_DEPLOY_DIR}")
endif()
@@ -195,8 +193,13 @@ elseif (NOT $ENV{MACOSX_DEPLOY_DIR} STREQUAL "")
set(CGAL_DIR "$ENV{MACOSX_DEPLOY_DIR}/lib/CGAL")
set(CMAKE_MODULE_PATH "${CGAL_DIR}")
endif()
+message(STATUS "CGAL_DIR: " ${CGAL_DIR})
find_package(CGAL REQUIRED)
-message(STATUS "CGAL found in ${CGAL_USE_FILE} ${CGAL_INCLUDE_DIRS} ${CGAL_LIBRARIES_DIR}")
+message(STATUS "CGAL config found in " ${CGAL_USE_FILE} )
+foreach(cgal_incdir ${CGAL_INCLUDE_DIRS})
+ message(STATUS "CGAL include found in " ${cgal_incdir} )
+endforeach()
+message(STATUS "CGAL libraries found in " ${CGAL_LIBRARIES_DIR} )
if("${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}" VERSION_LESS 3.6)
message(FATAL_ERROR "CGAL >= 3.6 required")
endif()
@@ -255,7 +258,7 @@ set(NOCGAL_SOURCES
set(CGAL_SOURCES
${NOCGAL_SOURCES}
- ../src/CSGTermEvaluator.cc
+ ../src/CSGTermEvaluator.cc
../src/CGAL_Nef_polyhedron.cc
../src/cgalutils.cc
../src/CGALEvaluator.cc
@@ -459,13 +462,12 @@ enable_testing()
# set up custom pretty printing of results
set(INFOCMD "execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/opencsgtest --info OUTPUT_FILE sysinfo.txt)")
-set(PRETTYCMD "\"${PYTHON_EXECUTABLE} test_pretty_print.py\"")
+set(PRETTYCMD "\"${PYTHON_EXECUTABLE} test_pretty_print.py --builddir=${CMAKE_CURRENT_BINARY_DIR}\"")
set(CTEST_CUSTOM_FILE ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake)
set(CTEST_CUSTOM_TXT "\n
message(\"running 'opencsgtest --info' to generate sysinfo.txt\")\n
${INFOCMD}\n
- # set(CTEST_CUSTOM_POST_TEST ${PRETTYCMD})\n # doesn't work. log is written
- # after all tests run.
+ set(CTEST_CUSTOM_POST_TEST ${PRETTYCMD})\n
")
file(WRITE ${CTEST_CUSTOM_FILE} ${CTEST_CUSTOM_TXT})
@@ -476,6 +478,7 @@ endforeach()
set_directory_properties(PROPERTIES TEST_INCLUDE_FILE "${CMAKE_SOURCE_DIR}/EnforceConfig.cmake")
+
# Find all scad files
file(GLOB MINIMAL_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/minimal/*.scad)
file(GLOB FEATURES_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/features/*.scad)
@@ -523,6 +526,9 @@ disable_tests(dumptest_transform-tests
# Reenable it when this is improved
disable_tests(opencsgtest_child-background)
+# FIXME: This single test takes over an hour to run on a 2.7 GHz P4
+disable_tests(opencsgtest_example006)
+
# These tests only makes sense in OpenCSG mode
disable_tests(cgalpngtest_child-background
cgalpngtest_highlight-and-background-modifier
diff --git a/tests/FindGLEW.cmake b/tests/FindGLEW.cmake
index 32c2d6e..8093ed3 100644
--- a/tests/FindGLEW.cmake
+++ b/tests/FindGLEW.cmake
@@ -44,7 +44,8 @@ ENDIF (WIN32)
IF (GLEW_INCLUDE_PATH)
SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
- MESSAGE(STATUS "GLEW found in " ${GLEW_INCLUDE_PATH} " " ${GLEW_LIBRARY})
+ MESSAGE(STATUS "GLEW include found in " ${GLEW_INCLUDE_PATH} )
+ MESSAGE(STATUS "GLEW library found in " ${GLEW_LIBRARY} )
ELSE (GLEW_INCLUDE_PATH)
SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
ENDIF (GLEW_INCLUDE_PATH)
diff --git a/tests/csgtestcore.cc b/tests/csgtestcore.cc
index 354c197..cd4d4b4 100644
--- a/tests/csgtestcore.cc
+++ b/tests/csgtestcore.cc
@@ -87,6 +87,10 @@ string info_dump(OffscreenView *glview)
#define compiler_info "unknown compiler"
#endif
+#ifndef OPENCSG_VERSION_STRING
+#define OPENCSG_VERSION_STRING "unknown, <1.3.2"
+#endif
+
std::stringstream out;
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
@@ -97,7 +101,7 @@ string info_dump(OffscreenView *glview)
<< "\nEigen version: " << EIGEN_WORLD_VERSION << "."
<< EIGEN_MAJOR_VERSION << "." << EIGEN_MINOR_VERSION
<< "\nCGAL version: " << TOSTRING(CGAL_VERSION)
- // << "\nOpenCSG" << ???
+ << "\nOpenCSG version: " << OPENCSG_VERSION_STRING
<< "\n" << glview->getInfo()
<< "\n";
diff --git a/tests/test_pretty_print.py b/tests/test_pretty_print.py
index 6931c35..df29fe7 100755
--- a/tests/test_pretty_print.py
+++ b/tests/test_pretty_print.py
@@ -1,4 +1,21 @@
#!/usr/bin/python
+
+# Copyright (C) 2011 Don Bright <hugh.m.bright@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
#
# This program 'pretty prints' the ctest output, namely
# files from builddir/Testing/Temporary.
@@ -6,6 +23,12 @@
# 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
+# 2. wikifiy the data
+# 3. save the wikified data to disk
# todo
# do something if tests for opencsg extensions fail (fail, no image production)
@@ -197,14 +220,18 @@ TESTLOG
'''Failed text tests'''
-{|border=1 cellspacing=0 cellpadding=1
-! Testname
<REPEAT2>
+{|border=1 cellspacing=0 cellpadding=1
|-
| FTESTNAME
-</REPEAT2>
|}
+<pre>
+TESTLOG
+</pre>
+
+</REPEAT2>
+
'''build.make and flags.make'''
<REPEAT3>
*[[MAKEFILE_NAME]]
@@ -225,12 +252,10 @@ TESTLOG
'NUMTESTS':len(tests), 'NUMPASSED':len(passed_tests), 'PERCENTPASSED':percent }
for key in dic.keys():
s = s.replace(key,str(dic[key]))
- testlogs = ''
for t in failed_tests:
- testlogs += '\n\n'+t.fulltestlog
if t.type=='txt':
- newchunk = re.sub('FTEST_OUTPUTFILE',t.fullname,repeat2)
newchunk = re.sub('FTESTNAME',t.fullname,repeat2)
+ newchunk = newchunk.replace('TESTLOG',t.fulltestlog)
s = s.replace(repeat2, newchunk+repeat2)
elif t.type=='png':
tmp = t.actualfile.replace(builddir,'')
@@ -336,12 +361,21 @@ def upload(wikiurl,api_php_path='/',wiki_rootpath='test', sysid='null', botname=
def findlogfile(builddir):
logpath = os.path.join(builddir,'Testing','Temporary')
- logfilename = os.path.join(logpath,'LastTest.log')
+ logfilename = os.path.join(logpath,'LastTest.log.tmp')
+ if not os.path.isfile(logfilename):
+ logfilename = os.path.join(logpath,'LastTest.log')
+ if not os.path.isfile(logfilename):
+ print 'cant find and/or open logfile',logfilename
+ sys.exit()
return logpath, logfilename
def main():
dry = False
+ print 'running test_pretty_print'
if '--dryrun' in sys.argv: dry=True
+ suffix = ezsearch('--suffix=(.*?) ',string.join(sys.argv)+' ')
+ builddir = ezsearch('--builddir=(.*?) ',string.join(sys.argv)+' ')
+ if builddir=='': builddir=os.getcwd()
print 'build dir set to', builddir
sysinfo, sysid = read_sysinfo(os.path.join(builddir,'sysinfo.txt'))
@@ -355,7 +389,7 @@ def main():
imgs, txtpages = towiki(wiki_rootpath, startdate, tests, enddate, sysinfo, sysid, makefiles)
- wikidir = os.path.join(logpath,'wiki')
+ wikidir = os.path.join(logpath,sysid+'_wiki')
print 'writing',len(imgs),'images and',len(txtpages),'wiki pages to:\n ', wikidir
for k in sorted(imgs): trysave( os.path.join(wikidir,k), imgs[k])
for k in sorted(txtpages): trysave( os.path.join(wikidir,k), txtpages[k])
contact: Jan Huwald // Impressum