I'm trying to automate a test that requires a separate server image to
be running. To ensure that the server code is compatible with the code in the test image, I want to snapshot the running testImage to another file, serverimage, such that the server runs when that image is restarted: ((Snapshot new) imageFilename: serverImage; snapshot) ifTrue: [serverProcess := self startServerImage: serverImage] ifFalse: [[Server start] fork. Processor activeProcess terminate] So far so good. But the annoying thing is that after the snapshot my running test image thinks it is now serverImage. In fact I want to delete serverImage when the test is done, so what I really want is a "detached" snapshot, where the running image is not retargeted to the new image name. Anyone know how to go about it? In particular, the test could be run from a normal dev image: $VM myDevImage.im in which case it would not be so bad to just snapshot back to that name. But the test could also be run from a built-on-the-fly test image: $VM visual.im -pcl MyTestParcel -doIt 'MyTest run' in which case I definitely don't want to overwrite visual.im. Dave |
At 10:27 AM 1/4/2007, Dave Stevenson wrote:
>what I really want is a "detached" snapshot, where the running image >is not retargeted to the >new image name. Anyone know how to go about it? The code that I wrote for one-click deployment uses an OS process and a "detached" snapshot (for RTP) that gets restarted. I needed to add a command-line hook for this so that the restarted snapshot understands that it has a different job. Communication back to the "master" image is also handled, so that you can delete the other image when it is finished. Details are here: http://cosmo.parcplace.com:8080/Engineering+Wiki/Deployment You could probably just look at the code and borrow a few parts of it. HTH, M |
In reply to this post by Dave Stevenson-2
This is how saveHeadless:to: works. It does it by reverting
the image name afterwards, but at least it's relatively easy to
do.
At 08:27 PM 1/3/2007, Dave Stevenson wrote: I'm trying to automate a test that requires a separate server image to --
Alan Knight [|], Cincom Smalltalk Development
"The Static Typing Philosophy: Make it fast. Make it right.
Make it run." - Niall Ross
|
Thanks, Alan. The implementation of #saveHeadless:to: seems sufficiently
general that it could be used for a detached save. The only thing specific to Headless is the line: self shouldSaveHeadless: beHeadless. If I'm right, that line could come first, and the method could be refactored to use a new detached facility in Snapshot, such as: saveHeadless: beHeadless to: prefix "Returns true if we just did the snapshot, false if we are restarting the image. Put our image prefix back the way it was if we're continuing to run." self shouldSaveHeadless: beHeadless. ^Snapshot new saveDetachedTo: prefix thenQuit: false or something similar. Correct? If so, any objection to adding #saveDetachedTo:thenQuit: to the system? Dave Alan Knight wrote: > This is how saveHeadless:to: works. It does it by reverting the image > name afterwards, but at least it's relatively easy to do. > > At 08:27 PM 1/3/2007, Dave Stevenson wrote: >> I'm trying to automate a test that requires a separate server image to >> be running. To ensure that the server code is compatible with the code >> in the test image, I want to snapshot the running testImage to another >> file, serverimage, such that the server runs when that image is restarted: >> >> ((Snapshot new) >> imageFilename: serverImage; >> snapshot) >> ifTrue: [serverProcess := self >> startServerImage: serverImage] >> ifFalse: >> [[Server start] fork. >> Processor activeProcess terminate] >> >> So far so good. But the annoying thing is that after the snapshot my >> running test image thinks it is now serverImage. In fact I want to >> delete serverImage when the test is done, so what I really want is a >> "detached" snapshot, where the running image is not retargeted to the >> new image name. Anyone know how to go about it? >> >> In particular, the test could be run from a normal dev image: >> $VM myDevImage.im >> >> in which case it would not be so bad to just snapshot back to that name. >> But the test could also be run from a built-on-the-fly test image: >> $VM visual.im -pcl MyTestParcel -doIt 'MyTest run' >> >> in which case I definitely don't want to overwrite visual.im. >> >> Dave > > -- > Alan Knight [|], Cincom Smalltalk Development > [hidden email] > [hidden email] > http://www.cincom.com/smalltalk > > "The Static Typing Philosophy: Make it fast. Make it right. Make it > run." - Niall Ross |
No objection. That sounds reasonable and useful.
At 06:41 PM 1/5/2007, Dave Stevenson wrote: Thanks, Alan. The implementation of #saveHeadless:to: seems sufficiently general that it could be used for a detached save. The only thing specific to Headless is the line: --
Alan Knight [|], Cincom Smalltalk Development
"The Static Typing Philosophy: Make it fast. Make it right.
Make it run." - Niall Ross
|
Free forum by Nabble | Edit this page |