summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDon Bright <hugh.m.bright@gmail.com>2011-11-24 03:47:33 (GMT)
committerDon Bright <hugh.m.bright@gmail.com>2011-11-24 03:47:33 (GMT)
commit29783dc4aa6e44221c9a584c2651624a93dfcf9a (patch)
treec41ebda97e594eadbce1225e4afe72ee0d9628fd
parente4ceccec9e81723567a07883dfa0a1db751f6926 (diff)
patch for opencsg1.3.1 and add --forceupload option to pretty printer
-rw-r--r--patches/OpenCSG-1.3.1-FBO.patch117
-rwxr-xr-xtests/test_pretty_print.py31
2 files changed, 132 insertions, 16 deletions
diff --git a/patches/OpenCSG-1.3.1-FBO.patch b/patches/OpenCSG-1.3.1-FBO.patch
new file mode 100644
index 0000000..234992d
--- /dev/null
+++ b/patches/OpenCSG-1.3.1-FBO.patch
@@ -0,0 +1,117 @@
+Only in OpenCSG-1.3.1-fbo-patch/: lib
+diff -ur OpenCSG-1.3.1/src/frameBufferObject.cpp OpenCSG-1.3.1-fbo-patch/src/frameBufferObject.cpp
+--- OpenCSG-1.3.1/src/frameBufferObject.cpp 2010-06-09 14:39:58.000000000 -0500
++++ OpenCSG-1.3.1-fbo-patch/src/frameBufferObject.cpp 2011-11-23 21:42:42.709641637 -0600
+@@ -3,8 +3,8 @@
+ //
+ // This library is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License,
+-// Version 2, as published by the Free Software Foundation.
+-// As a special exception, you have permission to link this library
++// Version 2, as published by the Free Software Foundation.
++// As a special exception, you have permission to link this library
+ // with the CGAL library and distribute executables.
+ //
+ // This library is distributed in the hope that it will be useful,
+@@ -59,6 +59,7 @@
+ glGenRenderbuffers(1, &depthID);
+ glGenTextures(1, &textureID);
+
++ glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFramebufferID);
+ glBindFramebuffer(GL_FRAMEBUFFER, framebufferID);
+ glBindTexture(GL_TEXTURE_2D, textureID);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_INT, 0);
+@@ -78,7 +79,7 @@
+ return false;
+ }
+
+- glBindFramebuffer(GL_FRAMEBUFFER, 0);
++ glBindFramebuffer(GL_FRAMEBUFFER, oldFramebufferID);
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ textureTarget = GL_TEXTURE_2D;
+Only in OpenCSG-1.3.1-fbo-patch/src: frameBufferObject.cpp~
+diff -ur OpenCSG-1.3.1/src/frameBufferObjectExt.cpp OpenCSG-1.3.1-fbo-patch/src/frameBufferObjectExt.cpp
+--- OpenCSG-1.3.1/src/frameBufferObjectExt.cpp 2010-06-09 14:39:58.000000000 -0500
++++ OpenCSG-1.3.1-fbo-patch/src/frameBufferObjectExt.cpp 2011-11-23 21:07:00.073641732 -0600
+@@ -3,8 +3,8 @@
+ //
+ // This library is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License,
+-// Version 2, as published by the Free Software Foundation.
+-// As a special exception, you have permission to link this library
++// Version 2, as published by the Free Software Foundation.
++// As a special exception, you have permission to link this library
+ // with the CGAL library and distribute executables.
+ //
+ // This library is distributed in the hope that it will be useful,
+@@ -60,6 +60,7 @@
+ glGenRenderbuffersEXT(1, &depthID);
+ glGenTextures(1, &textureID);
+
++ glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &oldFramebufferID);
+ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebufferID);
+ glBindTexture(GL_TEXTURE_2D, textureID);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_INT, 0);
+@@ -79,7 +80,7 @@
+ return false;
+ }
+
+- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
++ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, oldFramebufferID);
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ textureTarget = GL_TEXTURE_2D;
+@@ -136,7 +137,7 @@
+ // Unbinds frame buffer texture.
+ bool FrameBufferObjectExt::EndCapture()
+ {
+- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
++ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, oldFramebufferID);
+ return true;
+ }
+
+diff -ur OpenCSG-1.3.1/src/frameBufferObjectExt.h OpenCSG-1.3.1-fbo-patch/src/frameBufferObjectExt.h
+--- OpenCSG-1.3.1/src/frameBufferObjectExt.h 2010-06-09 14:39:58.000000000 -0500
++++ OpenCSG-1.3.1-fbo-patch/src/frameBufferObjectExt.h 2011-11-23 21:07:15.529642039 -0600
+@@ -3,8 +3,8 @@
+ //
+ // This library is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License,
+-// Version 2, as published by the Free Software Foundation.
+-// As a special exception, you have permission to link this library
++// Version 2, as published by the Free Software Foundation.
++// As a special exception, you have permission to link this library
+ // with the CGAL library and distribute executables.
+ //
+ // This library is distributed in the hope that it will be useful,
+@@ -85,6 +85,7 @@
+ unsigned int depthID;
+
+ unsigned int framebufferID;
++ int oldFramebufferID;
+
+ bool initialized;
+ };
+diff -ur OpenCSG-1.3.1/src/frameBufferObject.h OpenCSG-1.3.1-fbo-patch/src/frameBufferObject.h
+--- OpenCSG-1.3.1/src/frameBufferObject.h 2010-06-09 14:39:58.000000000 -0500
++++ OpenCSG-1.3.1-fbo-patch/src/frameBufferObject.h 2011-11-23 21:37:07.565641308 -0600
+@@ -3,8 +3,8 @@
+ //
+ // This library is free software; you can redistribute it and/or
+ // modify it under the terms of the GNU General Public License,
+-// Version 2, as published by the Free Software Foundation.
+-// As a special exception, you have permission to link this library
++// Version 2, as published by the Free Software Foundation.
++// As a special exception, you have permission to link this library
+ // with the CGAL library and distribute executables.
+ //
+ // This library is distributed in the hope that it will be useful,
+@@ -85,6 +85,7 @@
+ unsigned int depthID;
+
+ unsigned int framebufferID;
++ int oldFramebufferID;
+
+ bool initialized;
+ };
diff --git a/tests/test_pretty_print.py b/tests/test_pretty_print.py
index 8ba0512..ffc74eb 100755
--- a/tests/test_pretty_print.py
+++ b/tests/test_pretty_print.py
@@ -10,14 +10,12 @@
# todo
# ban opencsg<2.0 from opencsgtest
# copy all images, sysinfo.txt to bundle for html/upload (images
-# can be altered by subsequent runs)
+# 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
-# provide option to replace 'expected' images on wiki
-# (yes sometimes you do need to change/update them)
import string,sys,re,os,hashlib,subprocess
@@ -196,11 +194,11 @@ FAILED_TESTLOGS
s = wiki_template
repeat1 = ezsearch('(<REPEAT1>.*?</REPEAT1>)',s)
repeat2 = ezsearch('(<REPEAT2>.*?</REPEAT2>)',s)
- dic = { 'STARTDATE': str(startdate), 'ENDDATE': str(enddate), 'WIKI_ROOTPATH': str(wiki_rootpath),
- 'SYSINFO': str(sysinfo), 'SYSID':str(sysid), 'LASTTESTLOG':str(testlog),
- 'NUMTESTS':str(len(tests)), 'NUMPASSED':str(numpassed), 'PERCENTPASSED':str(percent) }
+ dic = { 'STARTDATE': startdate, 'ENDDATE': enddate, 'WIKI_ROOTPATH': wiki_rootpath,
+ 'SYSINFO': sysinfo, 'SYSID':sysid, 'LASTTESTLOG':testlog,
+ 'NUMTESTS':len(tests), 'NUMPASSED':numpassed, 'PERCENTPASSED':percent }
for key in dic.keys():
- s = s.replace(key,dic[key])
+ s = re.sub(key,str(dic[key]),s)
testlogs = ''
for t in tests:
# if t.passed: noop
@@ -236,7 +234,7 @@ def wikitohtml(wiki_rootpath, sysid, wikidata, manifest):
x=re.sub("'''(.*?)'''","<b>\\1</b>",x)
filestrs=re.findall('\[\[File\:(.*?)\|.*?\]\]',x)
for f in filestrs:
- newfile_html='<img src="'+os.path.abspath(revmanifest[f])+'" width=250/>'
+ newfile_html='<img src="'+revmanifest[f]+'" width=250/>'
x=re.sub('\[\[File\:'+f+'\|.*?\]\]',newfile_html,x)
dic = { '|}':'</table>', '|-':'<tr>', '||':'<td>', '|':'<td>',
'!!':'<th>', '!':'<tr><th>', '\n\n':'\n<p>\n'} #order matters
@@ -255,14 +253,14 @@ def upload_dryrun(wikiurl,api_php_path,wikidata,manifest,wiki_rootpath,sysid,bot
wikifile = manifest[localfile]
print 'upload',localfile,wikifile
-def upload(wikiurl,api_php_path,wikidata,manifest,wiki_rootpath,sysid,botname,botpass,dryrun=True):
+def upload(wikiurl,api_php_path,wikidata,manifest,wiki_rootpath,sysid,botname,botpass,dryrun=True,forceupload=False):
if dryrun:
upload_dryrun(wikiurl,api_php_path,wikidata,manifest,wiki_rootpath,sysid,botname,botpass)
return None
try:
import mwclient
except:
- print 'please download mwclient and unpack here:', os.getcwd()
+ print 'please download mwclient and unpack here:', os.cwd()
print 'open site',wikiurl
if not api_php_path == '':
site = mwclient.Site(wikiurl,api_php_path)
@@ -287,16 +285,16 @@ def upload(wikiurl,api_php_path,wikidata,manifest,wiki_rootpath,sysid,botname,bo
print 'upload images'
for localfile in sorted(manifest.keys()):
if localfile:
- localf = open(localfile,'rb')
+ localf = open(localfile)
wikifile = manifest[localfile]
skip=False
if 'expected.png' in wikifile.lower():
image = site.Images[wikifile]
- if image.exists:
- print 'skipping ',wikifile, '(expected image, already on wiki)'
+ if image.exists and forceupload==False:
+ print 'skipping ',wikifile, '(image with same name and size ',localsize,'already on wiki)'
skip=True
if not skip:
- print wikifile,'...'
+ print 'uploading',wikifile,'...'
site.upload(localf,wikifile,wiki_rootpath + ' test', ignore=True)
wikisite = 'cakebaby.referata.com'
@@ -310,8 +308,9 @@ def main():
startdate, tests, enddate = parselog(testlog)
tests = sorted(tests, key = lambda t:t.passed)
sysinfo, sysid = read_sysinfo('sysinfo.txt')
- if '--hack' in sys.argv: sysid+='_hack'
- manifest, wikidata = towiki(wiki_rootpath, startdate, tests, enddate, sysinfo, sysid, testlog)
+ if '--forceupload' in sys.argv: forceupload=True
+ else: forceupload=False
+ manifest, wikidata = towiki(wiki_rootpath, startdate, tests, enddate, sysinfo, sysid, testlog, forceupload)
trysave(wikidata, os.path.join(logpath,sysid+'.wiki'))
htmldata = wikitohtml(wiki_rootpath, sysid, wikidata, manifest)
trysave(htmldata, os.path.join(logpath,sysid+'.html'))
contact: Jan Huwald // Impressum