Changeset: 5aebbb6f96b0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5aebbb6f96b0
Modified Files:
        common/stream/stream.c
        sql/test/BugTracker-2012/Tests/url_script_test.Bug-2972.sql.in
        testing/Mtest.py.in
Branch: Jul2012
Log Message:

Make that sql test BugTracker-2012/url_script_test.Bug-2972 works on Windows.
This involves creating a special environment variable within Mtest
called UTSTSRCDIR which is the file: URL version of TSTSRCDIR, and
fixing the non-cURL implementation of open_urlstream to skip all
slashes that are part of a file: url on Windows.


diffs (49 lines):

diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -1335,9 +1335,18 @@ open_urlstream(const char *url)
 }
 
 #else
-stream *open_urlstream(const char *url) {
-       if (url != NULL && strncmp(url, "file://", sizeof("file://") - 1) == 0)
-               return open_rastream(url + sizeof("file://") - 1);
+stream *
+open_urlstream(const char *url)
+{
+       if (url != NULL && strncmp(url, "file://", sizeof("file://") - 1) == 0) 
{
+               url += sizeof("file://") - 1;
+#ifdef _MSC_VER
+               /* file:///C:/... -- remove third / as well */
+               if (url[0] == '/' && url[2] == ':')
+                       url++;
+#endif
+               return open_rastream(url);
+       }
        return NULL;
 }
 #endif /* HAVE_CURL */
diff --git a/sql/test/BugTracker-2012/Tests/url_script_test.Bug-2972.sql.in 
b/sql/test/BugTracker-2012/Tests/url_script_test.Bug-2972.sql.in
--- a/sql/test/BugTracker-2012/Tests/url_script_test.Bug-2972.sql.in
+++ b/sql/test/BugTracker-2012/Tests/url_script_test.Bug-2972.sql.in
@@ -39,8 +39,7 @@ drop table t;
 
 create table t(u url);
 
--- this works on UNIX, on Windows we likely need an extra / after file://
-insert into t values ('file://$TSTSRCDIR/url_script_test.Bug-2972.txt');
+insert into t values ('$UTSTSRCDIR/url_script_test.Bug-2972.txt');
 
 select getContent(u) from t;
 
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -1101,6 +1101,7 @@ def PerformDir(env, testdir, testlist, B
     env['TSTDB']     = TSTDB
     env['TSTDIR']    = TSTDIR
     env['TSTSRCDIR'] = TSTSRCDIR
+    env['UTSTSRCDIR'] = 'file:' + url(TSTSRCDIR)
     env['TSTTRGDIR'] = TSTTRGDIR
     if TSTDIR == os.curdir:
         env['RELSRCDIR'] = os.path.join(os.pardir, env['RELSRCBASE'], TSTSUFF)
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to