From: Stephen D. <sd...@gm...> - 2005-03-08 08:09:49
|
Neither RedHat or Fedora ship with a threaded build of Tcl, so I build my own package and install in parallel with the original. I've been naming the tclsh84 executable nsdsh. Our tests, such as they are, also need to run in a threaded Tcl shell. Which one? How to find it? Maybe we should build an nsdsh which would load libnsd.so by default and link to the correct Tcl libs. It's also currently quite difficult to test certain aspects of the server. e.g. for cookie handling you really want a connection available, but making actual network connections in a test environment seems a little fragile. So I thought maybe the nsdsh could provide extra testing hooks. It could take a '-t' option on the command line and load a standard server config file, using it to more fully emulate a running server than the current libnsd does. With this option present, stdin could be the request stream, stdout the response, and stderr the log file? It might register some extra _ns_debug_* commands? I'm not sure what the right way to go here is. Would such an nsdsh be useful, or should we just add more to the server binary, or should I just be a bit more creative when writing tests..? |
From: Zoran V. <zv...@ar...> - 2005-03-08 09:43:25
|
On Tuesday 08 March 2005 09:09, Stephen Deasey wrote: > I'm not sure what the right way to go here is. Would such an nsdsh be > useful, or should we just add more to the server binary, or should I > just be a bit more creative when writing tests..? > I do not know if this is what you'd need... What we've done is to spawn a thread on server start which opens a named pipe on the filesystem. The location and naming convention of the named pipe is well known. The thread reads incoming data more/less the same as nscp and executes the command. We also wrote a very tiny utility in Tcl (and wrapped it into a single exectuable with mktclapp) which also connects to the same named pipe, reads stdin for commands and passes the input to the pipe. This looks like: zvlinux:/usr/local/homes/zv # cd /usr/local/aw zvlinux:/usr/local/aw # bin/nsdchat % srvinfo version 4.0 The "nsdchat" is this small utility. This way we can execute any server command on a running server instance. The thread which reads the pipe executes command in a secure Tcl interp and we have opened a special API for that. This need not be, of course. So, this way we are actually using the server itself to run arbitrary scripts. The nsdchat utility can also read files on the filesystem and pass them to server for execution: zvlinux:/usr/local/aw # echo "srvinfo version" > my.tcl zvlinux:/usr/local/aw # bin/nsdchat < my.tcl 4.0 Is this the functionality you're looking for? Cheers Zoran |
From: Vlad S. <vl...@cr...> - 2005-03-08 14:33:54
|
I am using ncp module with socat which supports readline: i have bash alias ncp="socat readline tcp4:localhost:2080" and then i can type/execute anything there. Never thought about anything else since. The only thing that needs to be tested with browser is connection stuff, like cookies/headers, but that wget is for, prepare file with everything and then just call it, a lot of manual work but actually i donot use it very often, browser is s till real testing environment. Zoran Vasiljevic wrote: > On Tuesday 08 March 2005 09:09, Stephen Deasey wrote: > > >>I'm not sure what the right way to go here is. Would such an nsdsh be >>useful, or should we just add more to the server binary, or should I >>just be a bit more creative when writing tests..? >> > > > I do not know if this is what you'd need... > > What we've done is to spawn a thread on server start which opens a > named pipe on the filesystem. The location and naming convention of > the named pipe is well known. The thread reads incoming data more/less > the same as nscp and executes the command. We also wrote a very tiny > utility in Tcl (and wrapped it into a single exectuable with mktclapp) > which also connects to the same named pipe, reads stdin for commands > and passes the input to the pipe. > > This looks like: > > zvlinux:/usr/local/homes/zv # cd /usr/local/aw > zvlinux:/usr/local/aw # bin/nsdchat > % srvinfo version > 4.0 > > The "nsdchat" is this small utility. This way we can execute any > server command on a running server instance. The thread which reads > the pipe executes command in a secure Tcl interp and we have opened > a special API for that. This need not be, of course. > > So, this way we are actually using the server itself to run arbitrary > scripts. The nsdchat utility can also read files on the filesystem > and pass them to server for execution: > > zvlinux:/usr/local/aw # echo "srvinfo version" > my.tcl > zvlinux:/usr/local/aw # bin/nsdchat < my.tcl > 4.0 > > Is this the functionality you're looking for? > > Cheers > Zoran > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > naviserver-devel mailing list > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel -- Vlad Seryakov 571 262-8608 office vl...@cr... http://www.crystalballinc.com/vlad/ |
From: Zoran V. <zv...@ar...> - 2005-03-08 19:05:25
|
On Tuesday 08 March 2005 15:30, Vlad Seryakov wrote: > i have bash alias ncp="socat readline tcp4:localhost:2080" and then i > can type/execute anything Ah... GPL! I knew there is a catch! My first impression was: DAMN! So many development for nothing! (after I saw that this thingy would suit us perfectly and we have invested so much in our nsdchat thing...) and then the cold shower after reading the license! OK. For non-commercial inhouse use, this is pretty nice tool. But as we have a commercial package we're selling we have to be very careful with those licensing issues... Nevertheless, it is a good idea to use this to write tests and run them against the running server instance. Can this thing read files and spit their content to socket? You know what I mean? Have a Tcl script in a file and you kinda redirect it to nscp? Cheers Zoran |
From: Stephen D. <sd...@gm...> - 2005-03-17 12:13:32
|
There's the command ns_geturl which if called without specifying a host dummies up a request and fetches the result from the local machine. If there was an nsdsh which loaded with some kind of minimal fake server config so that the server commands were available, connection testing stuff would Just Work with the above command. It's kind of limited, so it may need extended with extra headers etc... On Tue, 8 Mar 2005 20:00:55 +0100, Zoran Vasiljevic <zv...@ar...> wrote: > On Tuesday 08 March 2005 15:30, Vlad Seryakov wrote: > > i have bash alias ncp="socat readline tcp4:localhost:2080" and then i > > can type/execute anything > > Ah... GPL! I knew there is a catch! My first impression was: > DAMN! So many development for nothing! > (after I saw that this thingy would suit us perfectly > and we have invested so much in our nsdchat thing...) > > and then the cold shower after reading the license! > OK. For non-commercial inhouse use, this is pretty nice tool. > But as we have a commercial package we're selling we have to > be very careful with those licensing issues... > > Nevertheless, it is a good idea to use this to write tests > and run them against the running server instance. Can this > thing read files and spit their content to socket? > You know what I mean? Have a Tcl script in a file and you > kinda redirect it to nscp? > > Cheers > Zoran > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > naviserver-devel mailing list > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel > |