Tcl Source Code

View Ticket
Login
Ticket UUID: 572400
Title: constraint exprs defeat limitConstraints
Type: Bug Created on: 2002-06-22 04:05:02
Submitter: dgp Assigned to: dgp
Subsystem: 34. tcltest Package Severity: Minor
Priority: 5 Medium Last modified: 2026-10-28 13:43:31
Status: Closed Closed by: jan.nijtmans
Resolution: Fixed Closed on: 2026-10-28 13:43:31
Version: 8.6.18, 9.0.5, 9.1.0
Description:
The [test] command honors constraint "expressions" so that,
for example, one could constrain a test with "!unix" to run
only on platforms that are not unix.  (Don't do that!  Use
notUnix instead).

However, the [limitConstraints] feature is implemented so
that it only works if all constraints are simple lists of
constraint keywords.  (It may be even worse -- it could
be that only simple constraints can be managed by
the [limitConstraints] feature).

For example, testing Tcl with the options
    -constraints knownBug -limitConstraints 1
to try to test only known bugs, the test
tcltest-5.5 is still run because its constraint is
    !singleProc
User Comments:
serhiy.storchaka added on 2026-10-20 14:26:05:

Still the case on main, 9.0 and 8.6: -limitconstraints forces the unselected constraints to 0, so expressions like !foo or $::tcl_version > 0 become true. With -constraints knownBug -limitconstraints 1 the whole test suite runs 76 tests.

Proposed fix in branch [241d536f30|tcltest-limitconstraints-expr] (stacked on the other tcltest fixes): in that mode an expression constraint must also name one of the selected constraints. The knownBug run then has 29 tests. New test tcltest-5.2b.


dgp added on 2026-10-20 18:20:29:
Thanks for the work on this.  I'm putting it on my list of
fixes to examine.

Just a comment that for me a desired long-range fix for
these issues would be to eliminate support for constraint
expressions.  They've always been short of working well,
reliably and robustly, and the gain from trying to offer
it is just not compelling.

At least the ideal tcltest, version 3 in my head does not have it.

dgp added on 2026-10-20 18:30:18:
One consequence of constraint expression support
is you cannot have an expression with a name
anything like

  this-should-only-run-in-this-situation

because tcltest insists on thinking that is
a constraint subtraction.  Just not good.

jan.nijtmans added on 2026-10-22 08:35:38:
Fixed in [891b7e7921|trunk], not backported yet to 9.0 and 8.6

I don't think I would want constraints with minus-signs in it. What I see now is using camelCase, like thisShouldOnlyRunInThisSituation

jan.nijtmans added on 2026-10-28 13:43:31:

Now also backported to core-9-0-branch and core-8-6-branch

Closing. Many thanks!