← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1709: 1. Add wrapper for running tests, to trap exit segfault at squeeze

 

------------------------------------------------------------
revno: 1709
committer: Václav Šmilauer <vaclav@flux>
branch nick: trunk
timestamp: Thu 2009-08-20 14:00:28 +0200
message:
  1. Add wrapper for running tests, to trap exit segfault at squeeze
  2. Use the wrapper for tests in debian/control
  3. Add wrapper for vector<Se3r>
added:
  scripts/yade-exec-wrapper
modified:
  debian/rules
  gui/qt3/QtGUI-python.cpp
  pkg/common/RenderingEngine/OpenGLRenderingEngine/OpenGLRenderingEngine.cpp
  py/yadeWrapper/customConverters.cpp
  scripts/pbuilder-test-distributions.sh


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription.
=== modified file 'debian/rules'
--- debian/rules	2009-08-20 09:38:22 +0000
+++ debian/rules	2009-08-20 12:00:28 +0000
@@ -67,8 +67,8 @@
 check: install
 	dh_testdir
 	dh_testroot
-	LD_PRELOAD= YADE_PREFIX=debian/yade${_VERSION}-dbg/usr debian/yade${_VERSION}-dbg/usr/bin/yade${_VERSION}-dbg -x -N PythonUI -- -n -x scripts/regression-tests.py 
-	LD_PRELOAD= YADE_PREFIX=debian/yade${_VERSION}/usr debian/yade${_VERSION}/usr/bin/yade${_VERSION} -x -N PythonUI -- -n -x scripts/regression-tests.py 
+	scripts/yade-exec-wrapper debian/yade${_VERSION}-dbg/usr/bin/yade${_VERSION}-dbg -x -N PythonUI -- -n -x scripts/regression-tests.py
+	scripts/yade-exec-wrapper debian/yade${_VERSION}/usr/bin/yade${_VERSION} -x -N PythonUI -- -n -x scripts/regression-tests.py
 
 # Build architecture-independent files here.
 binary-indep: build install

=== modified file 'gui/qt3/QtGUI-python.cpp'
--- gui/qt3/QtGUI-python.cpp	2009-08-20 09:38:22 +0000
+++ gui/qt3/QtGUI-python.cpp	2009-08-20 12:00:28 +0000
@@ -6,6 +6,7 @@
 #include"QtSimulationPlayer.hpp"
 
 #include<qapplication.h>
+#include<qcolor.h>
 
 #include<cstdio>
 
@@ -156,6 +157,7 @@
 		void useDisplayParameters(size_t n){GLV; MUTEX; glv->useDisplayParameters(n);}
 		string get_timeDisp(){GLV; const int& m(glv->timeDispMask); string ret; if(m&GLViewer::TIME_REAL) ret+='r'; if(m&GLViewer::TIME_VIRT) ret+="v"; if(m&GLViewer::TIME_ITER) ret+="i"; return ret;}
 		void set_timeDisp(string s){GLV; MUTEX; int& m(glv->timeDispMask); m=0; FOREACH(char c, s){switch(c){case 'r': m|=GLViewer::TIME_REAL; break; case 'v': m|=GLViewer::TIME_VIRT; break; case 'i': m|=GLViewer::TIME_ITER; break; default: throw invalid_argument(string("Invalid flag for timeDisp: `")+c+"'");}}}
+		void set_bgColor(const Vector3r& c){ QColor cc(255*c[0],255*c[1],255*c[2]); GLV; MUTEX; glv->setBackgroundColor(cc);} Vector3r get_bgColor(){ GLV; MUTEX; QColor c(glv->backgroundColor()); return Vector3r(c.red()/255.,c.green()/255.,c.blue()/255.);}
 		#undef MUTEX
 		#undef GLV
 };
@@ -201,6 +203,7 @@
 		.add_property("ortho",&pyGLViewer::get_orthographic,&pyGLViewer::set_orthographic)
 		.add_property("screenSize",&pyGLViewer::get_screenSize,&pyGLViewer::set_screenSize)
 		.add_property("timeDisp",&pyGLViewer::get_timeDisp,&pyGLViewer::set_timeDisp)
+		// .add_property("bgColor",&pyGLViewer::get_bgColor,&pyGLViewer::set_bgColor) // useless: OpenGLRenderingEngine::Background_color is used via openGL directly, bypassing QGLViewer background property
 		.def("fitAABB",&pyGLViewer::fitAABB)
 		.def("fitSphere",&pyGLViewer::fitSphere)
 		.def("showEntireScene",&pyGLViewer::showEntireScene)

=== modified file 'pkg/common/RenderingEngine/OpenGLRenderingEngine/OpenGLRenderingEngine.cpp'
--- pkg/common/RenderingEngine/OpenGLRenderingEngine/OpenGLRenderingEngine.cpp	2009-08-07 09:27:49 +0000
+++ pkg/common/RenderingEngine/OpenGLRenderingEngine/OpenGLRenderingEngine.cpp	2009-08-20 12:00:28 +0000
@@ -180,7 +180,13 @@
 	glPopMatrix();	
 
 	// clipping
-	for(int i=0;i<clipPlaneNum; i++){
+	assert(clipPlaneNormals.size()==(size_t)clipPlaneNum);
+	for(size_t i=0;i<(size_t)clipPlaneNum; i++){
+		// someone could have modified those from python and truncate the vectors; fill those here in that case
+		if(i==clipPlaneSe3.size()) clipPlaneSe3.push_back(Se3r(Vector3r::ZERO,Quaternionr::IDENTITY));
+		if(i==clipPlaneActive.size()) clipPlaneActive.push_back(false);
+		if(i==clipPlaneNormals.size()) clipPlaneNormals.push_back(Vector3r::UNIT_X);
+		// end filling stuff modified from python
 		if(clipPlaneActive[i]) clipPlaneNormals[i]=clipPlaneSe3[i].orientation*Vector3r(0,0,1);
 		/* glBegin(GL_LINES);glVertex3v(clipPlaneSe3[i].position);glVertex3v(clipPlaneSe3[i].position+clipPlaneNormals[i]);glEnd(); */
 	}

=== modified file 'py/yadeWrapper/customConverters.cpp'
--- py/yadeWrapper/customConverters.cpp	2009-07-27 17:08:23 +0000
+++ py/yadeWrapper/customConverters.cpp	2009-08-20 12:00:28 +0000
@@ -118,6 +118,7 @@
 	// register from-python converter and to-python converter
 	custom_vector_from_seq<int>(); to_python_converter<std::vector<int>, custom_vector_to_list<int> >();
 	custom_vector_from_seq<Real>(); to_python_converter<std::vector<Real>, custom_vector_to_list<Real> >();
+	custom_vector_from_seq<Se3r>(); to_python_converter<std::vector<Se3r>, custom_vector_to_list<Se3r> >();
 	custom_vector_from_seq<Vector3r>(); to_python_converter<std::vector<Vector3r>, custom_vector_to_list<Vector3r> >();
 	custom_vector_from_seq<std::string>(); to_python_converter<std::vector<std::string>, custom_vector_to_list<std::string> >();
 	custom_vector_from_seq<shared_ptr<Body> >(); to_python_converter<std::vector<shared_ptr<Body> >, custom_vector_to_list<shared_ptr<Body> > >();

=== modified file 'scripts/pbuilder-test-distributions.sh'
--- scripts/pbuilder-test-distributions.sh	2009-08-20 09:38:22 +0000
+++ scripts/pbuilder-test-distributions.sh	2009-08-20 12:00:28 +0000
@@ -10,7 +10,7 @@
 cd trunk; scripts/debian-prep jaunty; cd .. # distro not important here
 dpkg-source -b -I trunk
 DSC=yade-`cat trunk/VERSION`_1.dsc
-for DIST in hardy jaunty karmic lenny squeeze; do
+for DIST in lenny squeeze hardy jaunty karmic; do
 	echo ======================================================================================================
 	echo ============================================= TESTING $DIST ==========================================
 	echo ======================================================================================================

=== added file 'scripts/yade-exec-wrapper'
--- scripts/yade-exec-wrapper	1970-01-01 00:00:00 +0000
+++ scripts/yade-exec-wrapper	2009-08-20 12:00:28 +0000
@@ -0,0 +1,22 @@
+#!/usr/bin/python 
+"""Get yade binary as the first argument. Run it, passing all other arguments.
+If yade succeeds or crashes at exit, return success, otherwise return the same error as yade.
+
+Purpose: run binary even if no installed in the PREFIX (using YADE_PREFIX),
+and return no error if there is only (expected) crash at exit.
+
+You should only run non-interactive sessions this way.
+"""
+import os,sys,subprocess
+from os.path import *
+bin=abspath(sys.argv[1])
+print bin,dirname(bin)
+prefix=normpath(dirname(bin)+'/..')
+cmd='LD_PRELOAD= YADE_PREFIX='+prefix+' '+' '.join(sys.argv[1:])
+print cmd
+p=subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,shell=True)
+pout=p.communicate()[0]
+retval=p.wait()
+print pout
+if retval==0 or 'terminating...' in pout: sys.exit(0)
+sys.exit(retval)


Follow ups