diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/.gitignore | 1 | ||||
| -rw-r--r-- | tests/CMakeLists.txt | 28 | ||||
| -rw-r--r-- | tests/FindGLEW.cmake | 3 | ||||
| -rw-r--r-- | tests/cgalpngtest.cc | 3 | ||||
| -rw-r--r-- | tests/csgtermtest.cc | 4 | ||||
| -rw-r--r-- | tests/csgtestcore.cc | 9 | ||||
| -rw-r--r-- | tests/csgtexttest.cc | 3 | ||||
| -rw-r--r-- | tests/dumptest.cc | 6 | ||||
| -rw-r--r-- | tests/echotest.cc | 3 | ||||
| -rw-r--r-- | tests/regression/dumptest/background-modifier-expected.txt | 2 | ||||
| -rw-r--r-- | tests/regression/dumptest/example009-expected.txt | 4 | ||||
| -rw-r--r-- | tests/regression/dumptest/example017-expected.txt | 2 | ||||
| -rw-r--r-- | tests/regression/dumptest/highlight-and-background-modifier-expected.txt | 4 | ||||
| -rwxr-xr-x | tests/test_pretty_print.py | 50 | 
14 files changed, 95 insertions, 27 deletions
diff --git a/tests/.gitignore b/tests/.gitignore index e525181..ba02d4c 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1,3 +1,4 @@ +/*.dSYM  /*.a  /*-output  /*.scad 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/cgalpngtest.cc b/tests/cgalpngtest.cc index eabea86..7aa4b25 100644 --- a/tests/cgalpngtest.cc +++ b/tests/cgalpngtest.cc @@ -199,6 +199,9 @@ int main(int argc, char **argv)  	csgInfo.glview->paintGL();  	csgInfo.glview->save(outfile); +	delete root_node; +	delete root_module; +  	Builtins::instance(true);  	return 0; diff --git a/tests/csgtermtest.cc b/tests/csgtermtest.cc index 8f2d76e..2383126 100644 --- a/tests/csgtermtest.cc +++ b/tests/csgtermtest.cc @@ -143,6 +143,10 @@ int main(int argc, char **argv)  	}  	outfile.close(); +	if (root_term) root_term->unlink(); +	delete root_node; +	delete root_module; +  	Builtins::instance(true);  	return rc; diff --git a/tests/csgtestcore.cc b/tests/csgtestcore.cc index 418738d..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"; @@ -395,6 +399,9 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type)  	csgInfo.glview->save(outfilename); +	delete root_node; +	delete root_module; +  	Builtins::instance(true);  	return 0; diff --git a/tests/csgtexttest.cc b/tests/csgtexttest.cc index 76f6eb1..d7f94f1 100644 --- a/tests/csgtexttest.cc +++ b/tests/csgtexttest.cc @@ -129,6 +129,9 @@ int main(int argc, char **argv)  	outfile << csgcache[*root_node] << "\n";  	outfile.close(); +	delete root_node; +	delete root_module; +  	Builtins::instance(true);  	return rc; diff --git a/tests/dumptest.cc b/tests/dumptest.cc index 4071669..22dd96c 100644 --- a/tests/dumptest.cc +++ b/tests/dumptest.cc @@ -139,6 +139,9 @@ int main(int argc, char **argv)  	outfile << dumpstdstr << "\n";  	outfile.close(); +	delete root_node; +	delete root_module; +  	root_module = parsefile(outfilename);  	if (!root_module) {  		fprintf(stderr, "Error: Unable to read back dumped file\n"); @@ -159,6 +162,9 @@ int main(int argc, char **argv)  		exit(1);  	} +	delete root_node; +	delete root_module; +  	Builtins::instance(true);  	return rc; diff --git a/tests/echotest.cc b/tests/echotest.cc index 2f7ae4c..afa3d03 100644 --- a/tests/echotest.cc +++ b/tests/echotest.cc @@ -124,6 +124,9 @@ int main(int argc, char **argv)  	AbstractNode::resetIndexCounter();  	root_node = root_module->evaluate(&root_ctx, &root_inst); +	delete root_node; +	delete root_module; +  	Builtins::instance(true);  	ofile.close();  	return rc; diff --git a/tests/regression/dumptest/background-modifier-expected.txt b/tests/regression/dumptest/background-modifier-expected.txt index ca75e52..b52612f 100644 --- a/tests/regression/dumptest/background-modifier-expected.txt +++ b/tests/regression/dumptest/background-modifier-expected.txt @@ -1,5 +1,5 @@  	difference() {  		sphere($fn = 0, $fa = 12, $fs = 1, r = 10); -		cylinder($fn = 0, $fa = 12, $fs = 1, h = 30, r1 = 6, r2 = 6, center = true); +		%cylinder($fn = 0, $fa = 12, $fs = 1, h = 30, r1 = 6, r2 = 6, center = true);  	} diff --git a/tests/regression/dumptest/example009-expected.txt b/tests/regression/dumptest/example009-expected.txt index df05fe2..47ada91 100644 --- a/tests/regression/dumptest/example009-expected.txt +++ b/tests/regression/dumptest/example009-expected.txt @@ -1,7 +1,7 @@ -	linear_extrude(height = 22, center = true, convexity = 10, $fn = 0, $fa = 12, $fs = 1) { +	%linear_extrude(height = 22, center = true, convexity = 10, $fn = 0, $fa = 12, $fs = 1) {  		import(file = "example009.dxf", layer = "body", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1);  	} -	group() { +	%group() {  		multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 12], [0, 0, 0, 1]]) {  			linear_extrude(height = 2, center = true, convexity = 10, $fn = 0, $fa = 12, $fs = 1) {  				import(file = "example009.dxf", layer = "plate", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); diff --git a/tests/regression/dumptest/example017-expected.txt b/tests/regression/dumptest/example017-expected.txt index 42ef321..3f4ded6 100644 --- a/tests/regression/dumptest/example017-expected.txt +++ b/tests/regression/dumptest/example017-expected.txt @@ -187,7 +187,7 @@  					}  				}  			} -			multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 12], [0, 0, 0, 1]]) { +			%multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 12], [0, 0, 0, 1]]) {  				group() {  					rotate_extrude(convexity = 2, $fn = 0, $fa = 12, $fs = 1) {  						square(size = [25, 68], center = false); diff --git a/tests/regression/dumptest/highlight-and-background-modifier-expected.txt b/tests/regression/dumptest/highlight-and-background-modifier-expected.txt index 16f7b2a..8f13dcd 100644 --- a/tests/regression/dumptest/highlight-and-background-modifier-expected.txt +++ b/tests/regression/dumptest/highlight-and-background-modifier-expected.txt @@ -1,11 +1,11 @@  	difference() {  		sphere($fn = 0, $fa = 12, $fs = 1, r = 10); -		cylinder($fn = 0, $fa = 12, $fs = 1, h = 30, r1 = 6, r2 = 6, center = true); +		%cylinder($fn = 0, $fa = 12, $fs = 1, h = 30, r1 = 6, r2 = 6, center = true);  	}  	multmatrix([[1, 0, 0, 13], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {  		difference() {  			sphere($fn = 0, $fa = 12, $fs = 1, r = 10); -			cylinder($fn = 0, $fa = 12, $fs = 1, h = 30, r1 = 6, r2 = 6, center = true); +			%cylinder($fn = 0, $fa = 12, $fs = 1, h = 30, r1 = 6, r2 = 6, center = true);  		}  	} diff --git a/tests/test_pretty_print.py b/tests/test_pretty_print.py index 62ed062..8f519d7 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  # repair html output @@ -200,14 +223,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]] @@ -227,12 +254,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,'') @@ -339,12 +364,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')) @@ -358,7 +392,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])  | 
