[Monetdb-developers] [Monetdb-sql-checkins] sql/src/test/BugDay_2005-10-06_2.8/Tests MapiClient-dump.SF-905851.SQL.py, SQL_2-20, 1.1.2.1, 1.1.2.2

Stefan Manegold Stefan.Manegold at cwi.nl
Sat Oct 13 10:06:34 CEST 2007


Hi,

this any all other tests that were ported from .sh/.bat to .py yesterday
now fail on platforms that have a pyhton installed without subprocess; cf.,
http://monetdb.cwi.nl/testing/projects/monetdb/Stable/sql/.mTests103/index_short.html

To solve the problem, in all newly added .py scripts,
========
import subprocess
========
should be replaced by
========
try:
    import subprocess
except ImportError:
    # use private copy for old Python versions
    import MonetDB.subprocess26 as subprocess
========
as in Mtest.py[.in] to fall-back to the subprocess that we provide with
MonetDB in case there is none available on the respective system.

However, before checking in, please coordinate with Sjoerd, first!

Stefan

On Fri, Oct 12, 2007 at 09:53:41AM +0000, Romulo Goncalves wrote:
> Update of /cvsroot/monetdb/sql/src/test/BugDay_2005-10-06_2.8/Tests
> In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31626
> 
> Modified Files:
>       Tag: SQL_2-20
> 	MapiClient-dump.SF-905851.SQL.py 
> Log Message:
> On windows the stdout and stderr of a python subprocess is not automatically redirect to 
> main process stdout and stderr. 
> The proper way is to use Popen and then use a PIPE to read the stderr
> and stdout from the subprocess.
> 
> NOTE: This script was tested on windows and Linux, and the test became green on both platforms.     ;)     
> 
> 
> 
> Index: MapiClient-dump.SF-905851.SQL.py
> ===================================================================
> RCS file: /cvsroot/monetdb/sql/src/test/BugDay_2005-10-06_2.8/Tests/MapiClient-dump.SF-905851.SQL.py,v
> retrieving revision 1.1.2.1
> retrieving revision 1.1.2.2
> diff -u -d -r1.1.2.1 -r1.1.2.2
> --- MapiClient-dump.SF-905851.SQL.py	11 Oct 2007 14:40:50 -0000	1.1.2.1
> +++ MapiClient-dump.SF-905851.SQL.py	12 Oct 2007 09:53:39 -0000	1.1.2.2
> @@ -1,15 +1,21 @@
> -import os, sys
> +import os, sys, subprocess
> +
> +
> +def client(cmd):
> +	clt = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
> +	sys.stdout.write(clt.stdout.read())
> +	clt.stdout.close()
> +	sys.stderr.write(clt.stderr.read())
> +	clt.stderr.close()
> +	
>  
>  
>  def main():
>  	clcmd = ("%s/bin/Mlog -x " % os.getenv('MONETDB_PREFIX')) + str(os.getenv('SQL_CLIENT')) + "< %s" % ('%s/JdbcClient_create_tables.sql' % os.getenv('RELSRCDIR'))
>  	clcmd1 = ("%s/bin/Mlog -x " % os.getenv('MONETDB_PREFIX')) + str(os.getenv('SQL_CLIENT')) + "< %s" % ('%s/JdbcClient_inserts_selects.sql' % os.getenv('RELSRCDIR'))
>  	clcmd2 = ("%s/bin/Mlog -x " % os.getenv('MONETDB_PREFIX')) + str(os.getenv('SQL_DUMP'))
> -	clt = os.popen(clcmd, 'w')
> -	clt.close() 
> -	clt1 = os.popen(clcmd1, 'w')
> -	clt1.close() 
> -	clt2 = os.popen(clcmd2, 'w')
> -	clt2.close() 
> +	client(clcmd)
> +	client(clcmd1)
> +	client(clcmd2)
>  
>  main()
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Monetdb-sql-checkins mailing list
> Monetdb-sql-checkins at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

-- 
| Dr. Stefan Manegold | mailto:Stefan.Manegold at cwi.nl |
| CWI,  P.O.Box 94079 | http://www.cwi.nl/~manegold/  |
| 1090 GB Amsterdam   | Tel.: +31 (20) 592-4212       |
| The Netherlands     | Fax : +31 (20) 592-4312       |




More information about the developers-list mailing list