[seed] Ignore missing X extensions when testing



commit de65135b89104cc49cd893951650cc3d6f4236eb
Author: Tim Horton <hortont424 gmail com>
Date:   Sat Jan 2 18:19:27 2010 -0500

    Ignore missing X extensions when testing
    
    This fixes testing over X forwarding to a machine lacking expected extensions

 tests/run-tests.py |   65 +++++++++++++++++++++++++--------------------------
 1 files changed, 32 insertions(+), 33 deletions(-)
---
diff --git a/tests/run-tests.py b/tests/run-tests.py
index 8c5ca73..57930ea 100755
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -21,43 +21,42 @@ for root, dirs, files in os.walk(os.path.join(mcwd,"javascript")):
 		if f.endswith(".js") and not f.endswith("_.js"):
 			attempts = 0
 			while attempts < 10:
-				try:
-					rfile = open(f, "r")
-					test_code = rfile.readlines()
-					test_retval = int(test_code[1].replace("// Returns:","").rstrip().replace("\\n","\n"));
-					test_in = test_code[2].replace("// STDIN:","").rstrip().replace("\\n","\n");
-					test_out = "^" + test_code[3].replace("// STDOUT:","").rstrip().replace("\\n","\n") + "$";
-					test_err = "^" + test_code[4].replace("// STDERR:","").rstrip().replace("\\n","\n") + "$";
+				rfile = open(f, "r")
+				test_code = rfile.readlines()
+				test_retval = int(test_code[1].replace("// Returns:","").rstrip().replace("\\n","\n"));
+				test_in = test_code[2].replace("// STDIN:","").rstrip().replace("\\n","\n");
+				test_out = "^" + test_code[3].replace("// STDOUT:","").rstrip().replace("\\n","\n") + "$";
+				test_err = "^" + test_code[4].replace("// STDERR:","").rstrip().replace("\\n","\n") + "$";
 
-					p = subprocess.Popen(f, shell=True,
-								 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
-								 stderr=subprocess.PIPE, close_fds=True,
-								 cwd=os.path.join(mcwd,"javascript"))
-					(out,err)=(p.stdout, p.stderr)
+				p = subprocess.Popen(f, shell=True,
+							 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+							 stderr=subprocess.PIPE, close_fds=True,
+							 cwd=os.path.join(mcwd,"javascript"))
+				(out,err)=(p.stdout, p.stderr)
 
-					(run_out,run_err)=p.communicate(test_in + "\004")
-					run_out = run_out.rstrip()
-					run_err = run_err.rstrip()
+				(run_out,run_err)=p.communicate(test_in + "\004")
+				run_out = run_out.rstrip()
+				run_err = run_err.rstrip()
+				run_err = re.sub("Xlib:  extension \".*\" missing on display \".*\".\n?","",run_err)
 
-					out.close()
-					err.close()
+				out.close()
+				err.close()
 
-					if not re.match(test_out,run_out):
-						failed.append([filename,test_out,run_out,0,run_err])
-						sys.stdout.write("x")
-					elif not re.match(test_err,run_err):
-						failed.append([filename,test_err,run_err,1])
-						sys.stdout.write("x")
-					elif p.returncode != test_retval:
-						failed.append([filename,test_retval,p.returncode,2]);
-						sys.stdout.write("x")
-					else:
-						passed.append([filename])
-						sys.stdout.write(".")
-						sys.stdout.flush()
-					break
-				except:
-					attempts += 1
+				if not re.match(test_out,run_out):
+					failed.append([filename,test_out,run_out,0,run_err])
+					sys.stdout.write("x")
+				elif not re.match(test_err,run_err):
+					failed.append([filename,test_err,run_err,1])
+					sys.stdout.write("x")
+				elif p.returncode != test_retval:
+					failed.append([filename,test_retval,p.returncode,2]);
+					sys.stdout.write("x")
+				else:
+					passed.append([filename])
+					sys.stdout.write(".")
+					sys.stdout.flush()
+				break
+				attempts += 1
 			if attempts == 10:
 				print "WARNING: Strange error in " + f + "\n\n"
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]