From: <no...@so...> - 2002-06-06 15:21:22
|
Patches item #512214, was opened at 2002-02-02 16:13 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=310894&aid=512214&group_id=10894 Category: 33. tcltest Package Group: None Status: Open Resolution: None Priority: 7 Submitted By: Kenneth Cox (kenstir) Assigned to: Don Porter (dgp) Summary: allow skipping of constraint init code Initial Comment: Some of the tcltest constraint initialization code is nontrivial. A caller may want to avoid running the initialization code. In my case, running the constraint initialization code hangs my application. This patch uses [info exists] to test a constraint first, and runs the code to set the constraint if it doesn't already exist. This patch is incomplete; it only handles the (stdio) constraint. If you agree with this style of test- first constraint setting, I can patch the other constraints and submit them. My example: I have a client app which opens an exclusive connection to a server. When this app tries to spawn itself (while setting the stdio constraint), it deadlocks waiting for the exclusive connection to the server. Whether this is good app design is outside the scope of this patch! Most of this patch is whitespace-only change. ---------------------------------------------------------------------- >Comment By: Don Porter (dgp) Date: 2002-06-06 11:21 Message: Logged In: YES user_id=80530 Here's a patch that converts tcltest to do "lazy" initialization of test constraints. The value of a built-in constraint is not determined unless/until a [test] command that depends on that constraint is evaluated. This should address the problem. The patch also deprecates the [initConstraintsHook] because contraints are no longer initialized at package load time by default. For compatibility, if an [initConstraintsHook] has been defined, tcltest reverts to the old behavior of initialization of constraints at package load time. This should be discouraged. The hook is completely unnecessary; any tcltest user that wants to add a constraint can do so directly by calling the [testConstraint] command. No need for a hook at all. This patch also cleans up the mess that was the [limitConstraints] command. Some comments/documentation indicated this command took a boolean value; some that it took a list value. The existing code/tests did not appear to do anything sensible. I replaced the whole things with a consistent command that accepts a boolean value indicating whether or not to limit running of [test]s to those with constraints specified by the "-constraints" command line option. committing to tcltest 2.1 (Tcl 8.4a5) ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2002-03-25 12:02 Message: Logged In: YES user_id=80530 I haven't examine this patch, but I agree with the sentiment. I think the tcltest package still suffers from its legacy as something that grew by accretion, and is something mostly used exclusively in a single appliction. The package/application boundary is not clean. It would be better for the package to make functionality available, and leave it to applications to actually exercise it. In the case, the tcltest package should provide a means for defining constraints, and it could even offer code that queries the system and sets up some standard constraints. But that code should only run in response to a command executed by an application. It should not be part of package initialization. Tricky bit will be making this transition while supporting compatibility -- perhaps some form of "auto-loading" of the currently built-in constraints. Not gonna get to this soon, but did want to comment. ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=310894&aid=512214&group_id=10894 |