diff options
author | Don Bright <hugh.m.bright@gmail.com> | 2011-09-18 22:53:33 (GMT) |
---|---|---|
committer | Don Bright <hugh.m.bright@gmail.com> | 2011-09-18 22:53:33 (GMT) |
commit | 0b219ae4b46bbab5593d0ee644d7f6bcdb36d17e (patch) | |
tree | 83da7c12741a0409531657cac4a4217cf8e76727 | |
parent | 6d70855a4d92a7aafbc21fdd97c570e9ef227182 (diff) |
opencsg testing
-rw-r--r-- | doc/testing.txt | 15 | ||||
-rw-r--r-- | src/CGALRenderer.cc | 6 | ||||
-rw-r--r-- | src/dxfdata.h | 7 | ||||
-rw-r--r-- | src/polyset.h | 7 | ||||
-rw-r--r-- | tests/OffscreenContext.cc | 2 | ||||
-rw-r--r-- | tests/OffscreenView.h | 3 | ||||
-rw-r--r-- | tests/cgalpngtest.cc | 1 | ||||
-rw-r--r-- | tests/opencsgtest.cc | 18 | ||||
-rwxr-xr-x | tests/test_cmdline_tool.py | 8 |
9 files changed, 52 insertions, 15 deletions
diff --git a/doc/testing.txt b/doc/testing.txt index b64d5a4..26000c6 100644 --- a/doc/testing.txt +++ b/doc/testing.txt @@ -27,3 +27,18 @@ Adding a new regression test: Note that test files which don't have an *-expected.<suffix> file will be ignored for the test apps in question. + +Troubleshooting a failed test: +------------------------------ + +You can run a single test by running + $ ctest -R testname + +You can run a series by running + $ ctest -R cgalpng # runs all cgalpng tests + $ ctest -R sphere # runs all sphere tests + +Logs of test runs are found in tests/build/Testing/Temporary +Expected results are found in tests/regression/* +Actual results are found in tests/build/testname-output/* + diff --git a/src/CGALRenderer.cc b/src/CGALRenderer.cc index 4d165ce..95bcba1 100644 --- a/src/CGALRenderer.cc +++ b/src/CGALRenderer.cc @@ -24,10 +24,12 @@ * */ -#include "CGALRenderer.h" +// dxfdata.h must come first for Eigen SIMD alignment issues +#include "dxfdata.h" #include "polyset.h" + +#include "CGALRenderer.h" #include "CGAL_renderer.h" -#include "dxfdata.h" #include "dxftess.h" #include "CGAL_Nef_polyhedron.h" #include "cgal.h" diff --git a/src/dxfdata.h b/src/dxfdata.h index bada031..4e4b4ab 100644 --- a/src/dxfdata.h +++ b/src/dxfdata.h @@ -1,8 +1,13 @@ #ifndef DXFDATA_H_ #define DXFDATA_H_ -#include <vector> +#ifndef __APPLE__ +#define EIGEN_DONT_VECTORIZE 1 +#define EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT 1 +#endif + #include <Eigen/Dense> +#include <vector> using Eigen::Vector2d; diff --git a/src/polyset.h b/src/polyset.h index c59d86a..3cfb21a 100644 --- a/src/polyset.h +++ b/src/polyset.h @@ -1,11 +1,16 @@ #ifndef POLYSET_H_ #define POLYSET_H_ +#ifndef __APPLE__ +#define EIGEN_DONT_VECTORIZE 1 +#define EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT 1 +#endif + #include <GL/glew.h> #include "grid.h" -#include <vector> #include <Eigen/Core> #include <Eigen/Geometry> +#include <vector> using Eigen::Vector3d; typedef Eigen::AlignedBox<double, 3> BoundingBox; diff --git a/tests/OffscreenContext.cc b/tests/OffscreenContext.cc index d5c4c09..66b4ab3 100644 --- a/tests/OffscreenContext.cc +++ b/tests/OffscreenContext.cc @@ -181,7 +181,7 @@ bool save_framebuffer(OffscreenContext *ctx, const char *filename) //char * filename2="blah2.tga"; //PRINTF("writing %s\n",filename2); //write_targa(filename2,pixels,ctx->width, ctx->height); - char * filename2="blah2.png"; + //char * filename2="blah2.png"; PRINTF("writing %s . . .",filename); //write_targa(filename2,pixels,ctx->width, ctx->height); write_png(filename,pixels,ctx->width, ctx->height); diff --git a/tests/OffscreenView.h b/tests/OffscreenView.h index 587255a..85c0144 100644 --- a/tests/OffscreenView.h +++ b/tests/OffscreenView.h @@ -1,6 +1,9 @@ #ifndef OFFSCREENVIEW_H_ #define OFFSCREENVIEW_H_ +#define EIGEN_DONT_VECTORIZE 1 +#define EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT 1 + #include "OffscreenContext.h" #include <Eigen/Core> #include <Eigen/Geometry> diff --git a/tests/cgalpngtest.cc b/tests/cgalpngtest.cc index d7c6886..cae5c67 100644 --- a/tests/cgalpngtest.cc +++ b/tests/cgalpngtest.cc @@ -178,6 +178,7 @@ int main(int argc, char **argv) QDir::setCurrent(original_path.absolutePath()); +// match with csgtest ends csgInfo.glview = new OffscreenView(512,512); //glewInit(); diff --git a/tests/opencsgtest.cc b/tests/opencsgtest.cc index 98e1037..d5e83dd 100644 --- a/tests/opencsgtest.cc +++ b/tests/opencsgtest.cc @@ -1,4 +1,4 @@ -#include <GL/glew.h> +//#include <GL/glew.h> #include "openscad.h" #include "handle_dep.h" #include "builtin.h" @@ -144,9 +144,9 @@ int main(int argc, char *argv[]) CsgInfo csgInfo; CGALEvaluator cgalevaluator(tree); CSGTermEvaluator evaluator(tree, &cgalevaluator.psevaluator); - CSGTerm *root_raw_term = evaluator.evaluateCSGTerm(*root_node, - csgInfo.highlight_terms, - csgInfo.background_terms); + CSGTerm *root_raw_term = evaluator.evaluateCSGTerm(*root_node, + csgInfo.highlight_terms, + csgInfo.background_terms); if (!root_raw_term) { cerr << "Error: CSG generation failed! (no top level object found)\n"; @@ -203,6 +203,8 @@ int main(int argc, char *argv[]) QDir::setCurrent(original_path.absolutePath()); + + csgInfo.glview = new OffscreenView(512,512); BoundingBox bbox = csgInfo.root_chain->getBoundingBox(); @@ -214,7 +216,7 @@ int main(int argc, char *argv[]) Vector3d camerapos = center - radius*1.8*cameradir; csgInfo.glview->setCamera(camerapos, center); - glewInit(); + //glewInit(); #ifdef DEBUG cout << "GLEW version " << glewGetString(GLEW_VERSION) << "\n"; cout << (const char *)glGetString(GL_RENDERER) << "(" << (const char *)glGetString(GL_VENDOR) << ")\n" @@ -234,9 +236,9 @@ int main(int argc, char *argv[]) #endif OpenCSGRenderer opencsgRenderer(csgInfo.root_chain, csgInfo.highlights_chain, csgInfo.background_chain, csgInfo.glview->shaderinfo); - ThrownTogetherRenderer thrownTogetherRenderer(csgInfo.root_chain, csgInfo.highlights_chain, csgInfo.background_chain); - csgInfo.glview->setRenderer(&thrownTogetherRenderer); -// csgInfo.glview->setRenderer(&opencsgRenderer); + //ThrownTogetherRenderer thrownTogetherRenderer(csgInfo.root_chain, csgInfo.highlights_chain, csgInfo.background_chain); + //csgInfo.glview->setRenderer(&thrownTogetherRenderer); + csgInfo.glview->setRenderer(&opencsgRenderer); csgInfo.glview->paintGL(); diff --git a/tests/test_cmdline_tool.py b/tests/test_cmdline_tool.py index 7f68775..07afcc8 100755 --- a/tests/test_cmdline_tool.py +++ b/tests/test_cmdline_tool.py @@ -47,8 +47,8 @@ def execute_and_redirect(cmd, params, outfile): try: proc = subprocess.Popen([cmd] + params, stdout=outfile) retval = proc.wait() - except OSError as (errno, strerror): - print >> sys.stderr, "Error: ", errno, strerror + except: + print >> sys.stderr, "Error running subprocess: ", sys.exc_info()[1] print >> sys.stderr, " cmd:", cmd print >> sys.stderr, " params:", params print >> sys.stderr, " outfile:", outfile @@ -68,6 +68,10 @@ def compare_default(resultfilename): return True def compare_png(resultfilename): + if not resultfilename: + print >> sys.stderr, "Error: OpenSCAD did not generate an image" + return False + print >> sys.stderr, 'Yee image compare: ', expectedfilename, ' ', resultfilename if execute_and_redirect("./yee_compare", [expectedfilename, resultfilename], sys.stderr) != 0: return False return True |