Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C62C691BF for ; Thu, 26 Apr 2012 20:27:14 +0000 (UTC) Received: (qmail 41392 invoked by uid 500); 26 Apr 2012 20:27:13 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 41255 invoked by uid 500); 26 Apr 2012 20:27:13 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 41174 invoked by uid 99); 26 Apr 2012 20:27:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Apr 2012 20:27:13 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [80.244.253.218] (HELO mail.traeumt.net) (80.244.253.218) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Apr 2012 20:27:08 +0000 Received: from [10.0.0.15] (91-64-198-154-dynip.superkabel.de [91.64.198.154]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.traeumt.net (Postfix) with ESMTPSA id 8099214359 for ; Thu, 26 Apr 2012 22:28:11 +0200 (CEST) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Apple Message framework v1257) Subject: Re: [2/7] git commit: COUCHDB-1338 - run js tests with port=0 From: Jan Lehnardt In-Reply-To: Date: Thu, 26 Apr 2012 22:26:44 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20120127013712.8829B319D8A@tyr.zones.apache.org> <8844F652-309F-4A4B-8AC2-2D3D0E7B28E0@apache.org> To: dev@couchdb.apache.org X-Mailer: Apple Mail (2.1257) X-Virus-Checked: Checked by ClamAV on apache.org On Apr 26, 2012, at 19:38 , Paul Davis wrote: > Reproduces for me. Also looks related to the vpath build because it > only reproduces in distcheck and runs fine otherwise. Looking into it. one more interesting point, if you cd into the distcheck build dir, currently apache-couchdb-1.3.0a-eb3d5d8-git/_build after the test fails and then run ./test/javascript/run it all succeeds as well. Maybe we are digging in the wrong place? > On Thu, Apr 26, 2012 at 6:56 AM, Jan Lehnardt wrote: >> Actually, no. >>=20 >> I can now repeatedly get make distcheck to fail at >>=20 >> not ok 18 cookie_auth >>=20 >> on two different machines. I don't know if this was introduced in the = "fixing" commit or one of Paul's others. >>=20 >> Full log: >>=20 >> not ok 18 cookie_auth >> Reason: false >> Trace back (most recent call first): >>=20 >> 46: = /Users/jan/Work/couchdb/apache-couchdb-1.3.0a-0250310-git/_build/../test/j= avascript/cli_runner.js >> T(false) >> 133: = /Users/jan/Work/couchdb/apache-couchdb-1.3.0a-0250310-git/_build/../share/= www/script/test/cookie_auth.js >> () >> "jchris@apache.org"}, "eh, Boo-Boo?");try = {usersDb.save(duplicateJchrisDoc);T(false && "Can't create duplicate = user names. Should have thrown an error.");} catch (e) {T(e.error =3D=3D = "conflict");T(usersDb.last_req.status =3D=3D 409);}var underscoreUserDoc = =3D CouchDB.prepareUserDoc({name: "_why"}, "copperfield");try = {usersDb.save(underscoreUserDoc);T(false && "Can't create underscore = user names. Should have thrown an error.");} catch (e) {T(e.error =3D=3D = "forbidden");T(usersDb.last_req.status =3D=3D 403);}var badIdDoc =3D = CouchDB.prepareUserDoc({name: "foo"}, "bar");badIdDoc._id =3D = "org.apache.couchdb:w00x";try {usersDb.save(badIdDoc);T(false && "Can't = create malformed docids. Should have thrown an error.");} catch (e) = {T(e.error =3D=3D "forbidden");T(usersDb.last_req.status =3D=3D = 403);}T(CouchDB.login("Jason Davies", = password).ok);T(CouchDB.session().userCtx.name =3D=3D "Jason = Davies");var xhr =3D CouchDB.request("POST", "/_session", {headers: = {'Content-Type': "application/json"}, body: JSON.stringify({name: "Jason = Davies", password: = password})});T(JSON.parse(xhr.responseText).ok);T(CouchDB.session().userCt= x.name =3D=3D "Jason Davies");jasonUserDoc.foo =3D = 2;T(usersDb.save(jasonUserDoc).ok);T(CouchDB.session().userCtx.roles.index= Of("_admin") =3D=3D -1);try {usersDb.deleteDoc(jchrisUserDoc);T(false && = "Can't delete other users docs. Should have thrown an error.");} catch = (e) {T(e.error =3D=3D "forbidden");T(usersDb.last_req.status =3D=3D = 403);}T(!CouchDB.login("Jason Davies", = "2.71828").ok);T(!CouchDB.login("Robert Allen Zimmerman", = "d00d").ok);T(CouchDB.session().userCtx.name !=3D "Jason Davies");xhr =3D = CouchDB.request("POST", "/_session?next=3D/", {headers: {'Content-Type': = "application/x-www-form-urlencoded"}, body: = "name=3DJason%20Davies&password=3D" + encodeURIComponent(password)});if = (xhr.status =3D=3D 200) {T(/Welcome/.test(xhr.responseText));}xhr =3D = CouchDB.request("POST", "/_session?fail=3D/", {headers: {'Content-Type': = "application/x-www-form-urlencoded"}, body: = "name=3DJason%20Davies&password=3Dfoobar"});if (xhr.status =3D=3D 200) = {T(/Welcome/.test(xhr.responseText));}T(CouchDB.login("jchris@apache.org",= "funnybone").ok);T(CouchDB.session().userCtx.name =3D=3D = "jchris@apache.org");T(CouchDB.session().userCtx.roles.length =3D=3D = 0);jasonUserDoc.foo =3D 3;try {usersDb.save(jasonUserDoc);T(false && = "Can't update someone else's user doc. Should have thrown an error.");} = catch (e) {T(e.error =3D=3D "forbidden");T(usersDb.last_req.status =3D=3D = 403);}jchrisUserDoc.roles =3D ["foo"];try = {usersDb.save(jchrisUserDoc);T(false && "Can't set roles unless you are = admin. Should have thrown an error.");} catch (e) {T(e.error =3D=3D = "forbidden");T(usersDb.last_req.status =3D=3D = 403);}T(CouchDB.logout().ok);jchrisUserDoc.foo =3D = ["foo"];T(save_as(usersDb, jchrisUserDoc, "jan"));jchrisUserDoc.roles =3D = ["_bar"];var res =3D save_as(usersDb, jchrisUserDoc, "jan");T(res.error = =3D=3D "forbidden");T(usersDb.last_req.status =3D=3D = 403);T(CouchDB.login("jchris@apache.org", = "funnybone").ok);T(CouchDB.session().userCtx.name =3D=3D = "jchris@apache.org");T(CouchDB.session().userCtx.roles.indexOf("_admin") = =3D=3D -1);T(CouchDB.session().userCtx.roles.indexOf("foo") !=3D = -1);T(CouchDB.logout().ok);TEquals(true, CouchDB.login("jan", = "apple").ok);run_on_modified_server([{section: "admins", key: = "jchris@apache.org", value: "funnybone"}], function () = {T(CouchDB.login("jchris@apache.org", = "funnybone").ok);T(CouchDB.session().userCtx.name =3D=3D = "jchris@apache.org");T(CouchDB.session().userCtx.roles.indexOf("_admin") = !=3D -1);T(CouchDB.session().userCtx.roles.indexOf("foo") !=3D = -1);jchrisUserDoc =3D usersDb.open(jchrisUserDoc._id);delete = jchrisUserDoc.salt;delete = jchrisUserDoc.password_sha;T(usersDb.save(jchrisUserDoc).ok);T(CouchDB.log= out().ok);T(CouchDB.login("jchris@apache.org", "funnybone").ok);var s =3D = CouchDB.session();T(s.userCtx.name =3D=3D = "jchris@apache.org");T(s.userCtx.roles.indexOf("_admin") !=3D = -1);T(s.info.authenticated =3D=3D "cookie");T(s.info.authentication_db = =3D=3D = "test_suite_users");T(CouchDB.session().userCtx.roles.indexOf("foo") !=3D = -1);});} finally {T(CouchDB.logout().ok);}TEquals(true, = CouchDB.login("jan", = "apple").ok);}))@/Users/jan/Work/couchdb/apache-couchdb-1.3.0a-0250310-git= /_build/../share/www/script/couch_test_runner.js:380: apache.org"}, = "funnybone");T(usersDb.save(jchrisUserDoc).ok);var duplicateJchrisDoc =3D = CouchDB.prepareUserDoc({name >> run_on_modified_server([object Array],(function () {try {var = ddoc =3D op >> 286: = /Users/jan/Work/couchdb/apache-couchdb-1.3.0a-0250310-git/_build/../share/= www/script/test/cookie_auth.js >> () >> "jchris@apache.org"}, "eh, Boo-Boo?");try = {usersDb.save(duplicateJchrisDoc);T(false && "Can't create duplicate = user names. Should have thrown an error.");} catch (e) {T(e.error =3D=3D = "conflict");T(usersDb.last_req.status =3D=3D 409);}var underscoreUserDoc = =3D CouchDB.prepareUserDoc({name: "_why"}, "copperfield");try = {usersDb.save(underscoreUserDoc);T(false && "Can't create underscore = user names. Should have thrown an error.");} catch (e) {T(e.error =3D=3D = "forbidden");T(usersDb.last_req.status =3D=3D 403);}var badIdDoc =3D = CouchDB.prepareUserDoc({name: "foo"}, "bar");badIdDoc._id =3D = "org.apache.couchdb:w00x";try {usersDb.save(badIdDoc);T(false && "Can't = create malformed docids. Should have thrown an error.");} catch (e) = {T(e.error =3D=3D "forbidden");T(usersDb.last_req.status =3D=3D = 403);}T(CouchDB.login("Jason Davies", = password).ok);T(CouchDB.session().userCtx.name =3D=3D "Jason = Davies");var xhr =3D CouchDB.request("POST", "/_session", {headers: = {'Content-Type': "application/json"}, body: JSON.stringify({name: "Jason = Davies", password: = password})});T(JSON.parse(xhr.responseText).ok);T(CouchDB.session().userCt= x.name =3D=3D "Jason Davies");jasonUserDoc.foo =3D = 2;T(usersDb.save(jasonUserDoc).ok);T(CouchDB.session().userCtx.roles.index= Of("_admin") =3D=3D -1);try {usersDb.deleteDoc(jchrisUserDoc);T(false && = "Can't delete other users docs. Should have thrown an error.");} catch = (e) {T(e.error =3D=3D "forbidden");T(usersDb.last_req.status =3D=3D = 403);}T(!CouchDB.login("Jason Davies", = "2.71828").ok);T(!CouchDB.login("Robert Allen Zimmerman", = "d00d").ok);T(CouchDB.session().userCtx.name !=3D "Jason Davies");xhr =3D = CouchDB.request("POST", "/_session?next=3D/", {headers: {'Content-Type': = "application/x-www-form-urlencoded"}, body: = "name=3DJason%20Davies&password=3D" + encodeURIComponent(password)});if = (xhr.status =3D=3D 200) {T(/Welcome/.test(xhr.responseText));}xhr =3D = CouchDB.request("POST", "/_session?fail=3D/", {headers: {'Content-Type': = "application/x-www-form-urlencoded"}, body: = "name=3DJason%20Davies&password=3Dfoobar"});if (xhr.status =3D=3D 200) = {T(/Welcome/.test(xhr.responseText));}T(CouchDB.login("jchris@apache.org",= "funnybone").ok);T(CouchDB.session().userCtx.name =3D=3D = "jchris@apache.org");T(CouchDB.session().userCtx.roles.length =3D=3D = 0);jasonUserDoc.foo =3D 3;try {usersDb.save(jasonUserDoc);T(false && = "Can't update someone else's user doc. Should have thrown an error.");} = catch (e) {T(e.error =3D=3D "forbidden");T(usersDb.last_req.status =3D=3D = 403);}jchrisUserDoc.roles =3D ["foo"];try = {usersDb.save(jchrisUserDoc);T(false && "Can't set roles unless you are = admin. Should have thrown an error.");} catch (e) {T(e.error =3D=3D = "forbidden");T(usersDb.last_req.status =3D=3D = 403);}T(CouchDB.logout().ok);jchrisUserDoc.foo =3D = ["foo"];T(save_as(usersDb, jchrisUserDoc, "jan"));jchrisUserDoc.roles =3D = ["_bar"];var res =3D save_as(usersDb, jchrisUserDoc, "jan");T(res.error = =3D=3D "forbidden");T(usersDb.last_req.status =3D=3D = 403);T(CouchDB.login("jchris@apache.org", = "funnybone").ok);T(CouchDB.session().userCtx.name =3D=3D = "jchris@apache.org");T(CouchDB.session().userCtx.roles.indexOf("_admin") = =3D=3D -1);T(CouchDB.session().userCtx.roles.indexOf("foo") !=3D = -1);T(CouchDB.logout().ok);TEquals(true, CouchDB.login("jan", = "apple").ok);run_on_modified_server([{section: "admins", key: = "jchris@apache.org", value: "funnybone"}], function () = {T(CouchDB.login("jchris@apache.org", = "funnybone").ok);T(CouchDB.session().userCtx.name =3D=3D = "jchris@apache.org");T(CouchDB.session().userCtx.roles.indexOf("_admin") = !=3D -1);T(CouchDB.session().userCtx.roles.indexOf("foo") !=3D = -1);jchrisUserDoc =3D usersDb.open(jchrisUserDoc._id);delete = jchrisUserDoc.salt;delete = jchrisUserDoc.password_sha;T(usersDb.save(jchrisUserDoc).ok);T(CouchDB.log= out().ok);T(CouchDB.login("jchris@apache.org", "funnybone").ok);var s =3D = CouchDB.session();T(s.userCtx.name =3D=3D = "jchris@apache.org");T(s.userCtx.roles.indexOf("_admin") !=3D = -1);T(s.info.authenticated =3D=3D "cookie");T(s.info.authentication_db = =3D=3D = "test_suite_users");T(CouchDB.session().userCtx.roles.indexOf("foo") !=3D = -1);});} finally {T(CouchDB.logout().ok);}TEquals(true, = CouchDB.login("jan", "apple").ok);};var usersDb =3D new = CouchDB("test_suite_users", {'X-Couch-Full-Commit': = "false"});usersDb.deleteDb();usersDb.createDb();run_on_modified_server([{s= ection: "couch_httpd_auth", key: "authentication_db", value: = "test_suite_users"}, {section: "couch_httpd_auth", key: "iterations", = value: "1"}, {section: "admins", key: "jan", value: "apple"}], = testFun);}))@/Users/jan/Work/couchdb/apache-couchdb-1.3.0a-0250310-git/_bu= ild/../test/javascript/cli_runner.js:53: apache.org"}, = "funnybone");T(usersDb.save(jchrisUserDoc).ok);var duplicateJchrisDoc =3D = CouchDB.prepareUserDoc({name >> var testFun =3D function () {try {var ddoc =3D open_as(usersDb, = "_design/_ >> 72: = /Users/jan/Work/couchdb/apache-couchdb-1.3.0a-0250310-git/_build/../test/j= avascript/cli_runner.js >> runAllTestsConsole() >> 85: = /Users/jan/Work/couchdb/apache-couchdb-1.3.0a-0250310-git/_build/../test/j= avascript/cli_runner.js >>=20 >>=20 >>=20 >>=20 >>=20 >> On Apr 26, 2012, at 13:27 , Jan Lehnardt wrote: >>=20 >>> Paul fixed this in = http://git-wip-us.apache.org/repos/asf/couchdb/commit/02503102 >>>=20 >>> Cheers! >>>=20 >>> On Apr 24, 2012, at 20:39 , Jan Lehnardt wrote: >>>=20 >>>> Thanks for the replies! >>>>=20 >>>> ./test/javascript/run.tpl, line 15: >>>>=20 >>>> SRC_DIR=3D%abs_top_srcdir% >>>>=20 >>>> What now? :) >>>>=20 >>>> Jan >>>> -- >>>>=20 >>>>=20 >>>> On Apr 24, 2012, at 20:25 , Paul Davis wrote: >>>>=20 >>>>> Yeah. We'll need an $(abs_top_srcdir) or $(abs_top_builddir) here >>>>> depending on how they're used. It can be a bit of a PITA if one of >>>>> those needs to support write backs by one of the tests. Basic = solution >>>>> is to name them foo.ini.tpl and then "build" foo.ini and use >>>>> $(abs_top_builddir) in that case. Where by "build" I mean `cp $< = $@` >>>>> or so. >>>>>=20 >>>>> On Tue, Apr 24, 2012 at 12:04 PM, Randall Leeds = wrote: >>>>>> On Tue, Apr 24, 2012 at 08:08, Jan Lehnardt = wrote: >>>>>>>=20 >>>>>>> On Apr 24, 2012, at 17:05 , Jan Lehnardt wrote: >>>>>>>=20 >>>>>>>>=20 >>>>>>>> On Jan 27, 2012, at 02:37 , randall@apache.org wrote: >>>>>>>>=20 >>>>>>>>> COUCHDB-1338 - run js tests with port=3D0 >>>>>>>>>=20 >>>>>>>>> When the JS tests POST to /_restart, the server comes back up = on a >>>>>>>>> different port. To work around this, add a getter property for = the >>>>>>>>> CouchHTTP.prototype.base_url property, using a reserved slot = on the >>>>>>>>> object to store the value. >>>>>>>>>=20 >>>>>>>>>=20 >>>>>>>>> Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo >>>>>>>>> Commit: = http://git-wip-us.apache.org/repos/asf/couchdb/commit/d20e7926 >>>>>>>>> Tree: = http://git-wip-us.apache.org/repos/asf/couchdb/tree/d20e7926 >>>>>>>>> Diff: = http://git-wip-us.apache.org/repos/asf/couchdb/diff/d20e7926 >>>>>>>>>=20 >>>>>>>>> Branch: refs/heads/master >>>>>>>>> Commit: d20e792617db738dd5ad0e046ae847cd740f586f >>>>>>>>> Parents: 257eb52 >>>>>>>>> Author: Randall Leeds >>>>>>>>> Authored: Sat Jan 7 14:21:29 2012 -0800 >>>>>>>>> Committer: Randall Leeds >>>>>>>>> Committed: Thu Jan 26 17:03:10 2012 -0800 >>>>>>>>>=20 >>>>>>>>> = ---------------------------------------------------------------------- >>>>>>>>> src/couchdb/priv/couch_js/help.h | 2 + >>>>>>>>> src/couchdb/priv/couch_js/http.c | 60 = +++++++++++++++++++++++++++++++- >>>>>>>>> src/couchdb/priv/couch_js/http.h | 3 ++ >>>>>>>>> src/couchdb/priv/couch_js/sm170.c | 8 ++++ >>>>>>>>> src/couchdb/priv/couch_js/sm180.c | 8 ++++ >>>>>>>>> src/couchdb/priv/couch_js/sm185.c | 8 ++++ >>>>>>>>> src/couchdb/priv/couch_js/util.c | 3 +- >>>>>>>>> src/couchdb/priv/couch_js/util.h | 2 + >>>>>>>>> test/Makefile.am | 1 + >>>>>>>>> test/etap/Makefile.am | 1 - >>>>>>>>> test/etap/random_port.ini | 19 ---------- >>>>>>>>> test/etap/test_util.erl.in | 2 +- >>>>>>>>> test/javascript/Makefile.am | 1 + >>>>>>>>> test/javascript/couch_http.js | 9 ++--- >>>>>>>>> test/javascript/run.tpl | 9 ++++- >>>>>>>>> test/random_port.ini | 19 ++++++++++ >>>>>>>>> 16 files changed, 125 insertions(+), 30 deletions(-) >>>>>>>>> = ---------------------------------------------------------------------- >>>>>>>>>=20 >>>>>>>>>=20 >>>>>>>>> [...] >>>>>>>>> = http://git-wip-us.apache.org/repos/asf/couchdb/blob/d20e7926/test/javascri= pt/run.tpl >>>>>>>>> = ---------------------------------------------------------------------- >>>>>>>>> diff --git a/test/javascript/run.tpl b/test/javascript/run.tpl >>>>>>>>> index 47d2f6e..ac78b50 100644 >>>>>>>>> --- a/test/javascript/run.tpl >>>>>>>>> +++ b/test/javascript/run.tpl >>>>>>>>> @@ -17,6 +17,7 @@ SCRIPT_DIR=3D$SRC_DIR/share/www/script >>>>>>>>> JS_TEST_DIR=3D$SRC_DIR/test/javascript >>>>>>>>>=20 >>>>>>>>> COUCHJS=3D%abs_top_builddir%/src/couchdb/priv/couchjs >>>>>>>>> +COUCH_URI_FILE=3D%localstaterundir%/couch.uri >>>>>>>>>=20 >>>>>>>>> if [ "$#" -eq 0 ]; >>>>>>>>> then >>>>>>>>> @@ -48,11 +49,15 @@ abort() { >>>>>>>>> if [ -z $COUCHDB_NO_START ]; then >>>>>>>>> make dev >>>>>>>>> trap 'abort' 0 1 2 3 4 6 8 15 >>>>>>>>> - ./utils/run -b -r 1 >>>>>>>>> + ./utils/run -b -r 1 -n \ >>>>>>>>> + -a $SRC_DIR/etc/couchdb/default_dev.ini \ >>>>>>>>> + -a $SRC_DIR/test/random_port.ini \ >>>>>>>>> + -a $SRC_DIR/etc/couchdb/local_dev.ini >>>>>>>>=20 >>>>>>>>=20 >>>>>>>> Randall, this breaks vpath builds. removing the -n option and = the -n lines makes it work for me. >>>>>>>=20 >>>>>>> =85 and the -a lines =85 >>>>>>=20 >>>>>> Hmm. Maybe it should be "$(abs_top_builddir)" instead of SRC_DIR? >>>>>> The -a ...random_port.ini is the crucial one, because that's the = point >>>>>> of the patch. I can't remember at this moment why I needed to = specify >>>>>> exactly all the configs and use the -n to reset the config chain, = but >>>>>> I'm sure there was a reason (like random_port.ini not getting >>>>>> preference over default_dev.ini or something). >>>>>>=20 >>>>>> -R >>>>=20 >>>=20 >>=20