You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Chris Anderson <jc...@apache.org> on 2008/10/02 08:59:09 UTC

command line test runner

Couch-heads,

I've got the tests from couch_tests.js running from the command line.

Here is the git-branch I'm developing in for now:

http://github.com/jchris/couchdb/tree/jstests

And here's a diff if you'd rather just apply it to trunk:

http://gist.github.com/raw/14299/2d80746d7e33d8f0e48260846b81fddaa19f2bfa

To run the tests, checkout the git branch (or download the tarball)
boostrap, configure, and make. Then run:

src/couchdb/couchjs share/server/test.js

from inside the trunk directory.

If all goes well, you'll see something like this:
http://friendpaste.com/Q7sTsPPs

I could use some help - I've documented the failures with printing to
stdout. Naturally CouchDB should be passing all the tests right now,
but there are some loose ends with the curl integration that are
causing tests to fail in the couchjs context.

TODO to get this solid for inclusion in the build system:

Fix curl issues (C hackers, I know you're out there):
Loading attachments causes couchjs to exit.
Curl support is missing the HEAD, COPY, and MOVE verbs.
No curl support for setting accept headers.

DRY up the code:
Expose the load() method to couchjs, so we can load the other source
files, instead of pasting it all in one file.
Organize the code so that we can maintain just a single version of
couch_tests.js and have it run both in the browser and from the
console. Once load() is available we can probably do this by loading
couch_tests.js and couch.js, and monkey patching a couple of things.

Cleanup / format the output.

Integrate with the build system.

Oh and there's a funky utf8 issue. Hopefully its easy to ask
Spidermonkey to treat its source files as utf8.

Cheers,
Chris

-- 
Chris Anderson
http://jchris.mfdz.com

Re: command line test runner

Posted by Damien Katz <da...@apache.org>.
Woot! This is much needed. Let me know if there is anything I can do  
to help get this in.

-Damien

On Oct 2, 2008, at 2:59 AM, Chris Anderson wrote:

> Couch-heads,
>
> I've got the tests from couch_tests.js running from the command line.
>
> Here is the git-branch I'm developing in for now:
>
> http://github.com/jchris/couchdb/tree/jstests
>
> And here's a diff if you'd rather just apply it to trunk:
>
> http://gist.github.com/raw/14299/2d80746d7e33d8f0e48260846b81fddaa19f2bfa
>
> To run the tests, checkout the git branch (or download the tarball)
> boostrap, configure, and make. Then run:
>
> src/couchdb/couchjs share/server/test.js
>
> from inside the trunk directory.
>
> If all goes well, you'll see something like this:
> http://friendpaste.com/Q7sTsPPs
>
> I could use some help - I've documented the failures with printing to
> stdout. Naturally CouchDB should be passing all the tests right now,
> but there are some loose ends with the curl integration that are
> causing tests to fail in the couchjs context.
>
> TODO to get this solid for inclusion in the build system:
>
> Fix curl issues (C hackers, I know you're out there):
> Loading attachments causes couchjs to exit.
> Curl support is missing the HEAD, COPY, and MOVE verbs.
> No curl support for setting accept headers.
>
> DRY up the code:
> Expose the load() method to couchjs, so we can load the other source
> files, instead of pasting it all in one file.
> Organize the code so that we can maintain just a single version of
> couch_tests.js and have it run both in the browser and from the
> console. Once load() is available we can probably do this by loading
> couch_tests.js and couch.js, and monkey patching a couple of things.
>
> Cleanup / format the output.
>
> Integrate with the build system.
>
> Oh and there's a funky utf8 issue. Hopefully its easy to ask
> Spidermonkey to treat its source files as utf8.
>
> Cheers,
> Chris
>
> -- 
> Chris Anderson
> http://jchris.mfdz.com


Re: command line test runner

Posted by Paul Davis <pa...@gmail.com>.
Unless I've got this wrong, the HTTP stuff is default available in
views now, perhaps we should make including those functions in the JS
runtime a non-default option?

Paul

On Thu, Oct 9, 2008 at 6:13 PM, Chris Anderson <jc...@apache.org> wrote:
> On Wed, Oct 1, 2008 at 11:59 PM, Chris Anderson <jc...@apache.org> wrote:
>> Couch-heads,
>>
>> I've got the tests from couch_tests.js running from the command line.
>
> I've commited this to trunk as revision 703276. To run the tests, run
> `make check` while you have a CouchDB instance available at
> http://127.0.0.1:5984 - ideally make check should be able bootstrap a
> CouchDB. I'm not sure the best way to manage this, so I've left it out
> of scope.
>
> Because couchjs can take a script on stdin, I'm able to merge the
> couch.js, couch_tests.js and test.js (the test runner which
> monkeypatches http support into couchjs) using cat, so the copy of the
> tests run by this command is the same as that run in the browser.
>
>>
>> Oh and there's a funky utf8 issue. Hopefully its easy to ask
>> Spidermonkey to treat its source files as utf8.
>>
>
> This is still an issue with utf8. I'm just skipping that test right
> now because I don't see a fix that doesn't involve deep Spidermonkey
> magic.
>
> BTW - see test.js for JavaScript code that makes HTTP GET, HEAD, POST,
> PUT, DELETE, COPY, and MOVE available to Javascripts. I already have a
> few other ideas about what this could be good for. Making HTTP
> requests in the view runner (main.js) is what we call a *bad idea* so
> don't even think about it.
>
> Thanks to Michael Gottesman (gottesmm) for the initial work on libcurl
> integration.
>
> --
> Chris Anderson
> http://jchris.mfdz.com
>

Re: command line test runner

Posted by Chris Anderson <jc...@apache.org>.
On Fri, Oct 10, 2008 at 3:40 AM, Jan Lehnardt <ja...@apache.org> wrote:
>
> Chris, this is mighty cool! :)
>
> However:
>
> Host: 127.0.0.1
> Port: 5984
> Version: 0.9.0a696059-incubating
>
> basics
> ./runner.sh: line 5: 24486 Done                    cat
> ../share/www/script/couch.js ../share/www/script/couch_tests.js test.js
>     24487 Bus error               (core dumped) | ../src/couchdb/couchjs -
>

Yes, this is maybe expected. I'm no build-master. I think we'll need
someone with dependency cops to take a look at why. For now, I will
add libcurl-dev to the README because it maybe that some people don't
have it installed already.

I don't know why you'd get a bus error after having compiled. I also
don't know why the code mentions kerberos. I'll try pulling that line
out and see if it still works.

I'm mostly over my head when it comes to this sort of thing, so I hope
these problems are of the sort that are easy to resolve.

Thanks for running interference on IRC, Jan!

Chris

-- 
Chris Anderson
http://jchris.mfdz.com

Re: command line test runner

Posted by Paul Davis <pa...@gmail.com>.
I get the same thing.

On Fri, Oct 10, 2008 at 6:40 AM, Jan Lehnardt <ja...@apache.org> wrote:
>
> On Oct 10, 2008, at 00:13, Chris Anderson wrote:
>
>> On Wed, Oct 1, 2008 at 11:59 PM, Chris Anderson <jc...@apache.org> wrote:
>>>
>>> Couch-heads,
>>>
>>> I've got the tests from couch_tests.js running from the command line.
>>
>> I've commited this to trunk as revision 703276. To run the tests, run
>> `make check` while you have a CouchDB instance available at
>> http://127.0.0.1:5984 - ideally make check should be able bootstrap a
>> CouchDB. I'm not sure the best way to manage this, so I've left it out
>> of scope.
>
> Chris, this is mighty cool! :)
>
> However:
>
> Host: 127.0.0.1
> Port: 5984
> Version: 0.9.0a696059-incubating
>
> basics
> ./runner.sh: line 5: 24486 Done                    cat
> ../share/www/script/couch.js ../share/www/script/couch_tests.js test.js
>     24487 Bus error               (core dumped) | ../src/couchdb/couchjs -
>
> --
>
> The DEBUG backtrace:
>
> #0  0x00038c6c in Curl_getFormData ()
> #1  0x0003bdff in Curl_http ()
> #2  0x00047879 in Curl_do ()
> #3  0x00051393 in Curl_perform ()
> #4  0x000037ef in PostHttp ()
> #5  0x0017f36b in js_Invoke (cx=0x3017b0, argc=3, flags=0) at
> jsinterp.c:1375
> #6  0x00190a6c in js_Interpret (cx=0x3017b0, pc=0x31a43a ":",
> result=0xbffff50c) at jsinterp.c:3944
> #7  0x0017fd41 in js_Execute (cx=0x3017b0, chain=0x80a2b8, script=0x8dd600,
> down=0x0, flags=0, result=0xbffff5d4) at jsinterp.c:1633
> #8  0x00140d7a in JS_ExecuteScript (cx=0x3017b0, obj=0x80a2b8,
> script=0x8dd600, rval=0xbffff5d4) at jsapi.c:4188
> #9  0x00002a91 in ExecuteScript ()
> #10 0x00004877 in main ()
> (gdb)
>
> All on Intel Mac OS X 10.5.5
>
> Cheers
> Jan
> --
>

Re: command line test runner

Posted by Jan Lehnardt <ja...@apache.org>.
On Oct 10, 2008, at 00:13, Chris Anderson wrote:

> On Wed, Oct 1, 2008 at 11:59 PM, Chris Anderson <jc...@apache.org>  
> wrote:
>> Couch-heads,
>>
>> I've got the tests from couch_tests.js running from the command line.
>
> I've commited this to trunk as revision 703276. To run the tests, run
> `make check` while you have a CouchDB instance available at
> http://127.0.0.1:5984 - ideally make check should be able bootstrap a
> CouchDB. I'm not sure the best way to manage this, so I've left it out
> of scope.

Chris, this is mighty cool! :)

However:

Host: 127.0.0.1
Port: 5984
Version: 0.9.0a696059-incubating

basics
./runner.sh: line 5: 24486 Done                    cat ../share/www/ 
script/couch.js ../share/www/script/couch_tests.js test.js
      24487 Bus error               (core dumped) | ../src/couchdb/ 
couchjs -

--

The DEBUG backtrace:

#0  0x00038c6c in Curl_getFormData ()
#1  0x0003bdff in Curl_http ()
#2  0x00047879 in Curl_do ()
#3  0x00051393 in Curl_perform ()
#4  0x000037ef in PostHttp ()
#5  0x0017f36b in js_Invoke (cx=0x3017b0, argc=3, flags=0) at  
jsinterp.c:1375
#6  0x00190a6c in js_Interpret (cx=0x3017b0, pc=0x31a43a ":",  
result=0xbffff50c) at jsinterp.c:3944
#7  0x0017fd41 in js_Execute (cx=0x3017b0, chain=0x80a2b8,  
script=0x8dd600, down=0x0, flags=0, result=0xbffff5d4) at jsinterp.c: 
1633
#8  0x00140d7a in JS_ExecuteScript (cx=0x3017b0, obj=0x80a2b8,  
script=0x8dd600, rval=0xbffff5d4) at jsapi.c:4188
#9  0x00002a91 in ExecuteScript ()
#10 0x00004877 in main ()
(gdb)

All on Intel Mac OS X 10.5.5

Cheers
Jan
--

Re: command line test runner

Posted by Chris Anderson <jc...@apache.org>.
On Wed, Oct 1, 2008 at 11:59 PM, Chris Anderson <jc...@apache.org> wrote:
> Couch-heads,
>
> I've got the tests from couch_tests.js running from the command line.

I've commited this to trunk as revision 703276. To run the tests, run
`make check` while you have a CouchDB instance available at
http://127.0.0.1:5984 - ideally make check should be able bootstrap a
CouchDB. I'm not sure the best way to manage this, so I've left it out
of scope.

Because couchjs can take a script on stdin, I'm able to merge the
couch.js, couch_tests.js and test.js (the test runner which
monkeypatches http support into couchjs) using cat, so the copy of the
tests run by this command is the same as that run in the browser.

>
> Oh and there's a funky utf8 issue. Hopefully its easy to ask
> Spidermonkey to treat its source files as utf8.
>

This is still an issue with utf8. I'm just skipping that test right
now because I don't see a fix that doesn't involve deep Spidermonkey
magic.

BTW - see test.js for JavaScript code that makes HTTP GET, HEAD, POST,
PUT, DELETE, COPY, and MOVE available to Javascripts. I already have a
few other ideas about what this could be good for. Making HTTP
requests in the view runner (main.js) is what we call a *bad idea* so
don't even think about it.

Thanks to Michael Gottesman (gottesmm) for the initial work on libcurl
integration.

-- 
Chris Anderson
http://jchris.mfdz.com