|
2017-12-10
| ||
| 17:40 | • Ticket [9d579f1450] Incorrect handling of test constraints status still Open... artifact: 74d2c37968 user: erikleunissen | |
| 16:53 | • Ticket [9d579f1450]: 3 changes artifact: 8e5b889a67 user: erikleunissen | |
|
2017-12-09
| ||
| 23:17 | • Open ticket [9d579f1450]. artifact: 179fdc276b user: dgp | |
| 23:12 | • Closed ticket [9d579f1450]. artifact: e36e73967a user: dgp | |
| 22:27 | • Add attachment patch to ticket [9d579f1450] artifact: 4938e7cb0b user: erikleunissen | |
| 22:27 | • Add attachment testconstraints.tcl to ticket [9d579f145034b21a|9d579f14... artifact: 69f32cea22 user: erikleunissen | |
| 22:26 | • New ticket [9d579f1450] Incorrect handling of test constraints. artifact: e3ad46ab2d user: erikleunissen | |
Incorrect handling of test constraints
Open9d579f145034b21ab250dcd808c78764fd40ac1bCreated 9 years agoUpdated 9 years ago
Descriptionplain2017-12-09 22:26:26
Some test constraints are handled incorrectly, letting tests being run when they should not and conversely. This behaviour appears to depend on certain characters being present in the name of the constraint. The attached Tcl script "testconstraints.tcl" exercises the incorrect behaviour for two cases.
Expected behaviour: test foo is skipped and test bar is run.
Observed behaviour: test foo is run and test bar is skipped.
> cat testconstraints.tcl
#! /bin/sh
# If executed as a shell script, the next line replaces the shell with wish \
exec tclsh "$0" ${1+"$@"}
puts "tcltest version: [package require tcltest]"
namespace import tcltest::*
tcltest::configure -verbose {pass error}
testConstraint tcl>=11.1 [expr {$tcl_version >= 11.1}]
testConstraint abc-def-ghi 1
# This test ought be skipped
test foo {foo} -constraints {tcl>=11.1} -body {
# no need to do anything here
} -result ""
# This test ought be run
test bar {bar} -constraints {abc-def-ghi} -body {
# no need to do anything here
} -result ""
tcltest::cleanupTests
> tclsh8.5 testconstraints.tcl
tcltest version: 2.4.1
++++ foo PASSED
testconstraints.tcl: Total 2 Passed 1 Skipped 1 Failed 0
Number of tests skipped for each constraint:
1 abc-def-ghi
>
The attached patch corrects the behaviour:
> tclsh8.5 testconstraints.tcl
tcltest version: 2.4.1
++++ bar PASSED
testconstraints.tcl: Total 2 Passed 1 Skipped 1 Failed 0
Number of tests skipped for each constraint:
1 tcl>=11.1
>
Sincerely,
Erik Leunissen
--
dgpplain2017-12-09 23:12:39
The constraint names you are trying to use conflict with the support for constraint expressions https://www.tcl.tk/man/tcl/TclCmd/tcltest.htm#M50 Constraint expressions are an over-ambitious, fragile, bad idea, but they are there. I'm happy to see them not continue in tcltest 3. That said, I'll take a look at your patch idea.
dgpplain2017-12-09 23:17:18
Re-opened as a feature request. I see your patch is just to rip out half of the expression support. My preferences is when they go, they all go. I'd expect the patch to conflict most often with test scripts that use both 'foo' and '!foo' as constraint expressions.
erikleunissenplain2017-12-10 16:53:25
I agree with removing "expression support" completely. In fact, I considered removing it completely in my patch. The reason I didn't is that support for expressions is mentioned in the docs. However, the part that I stripped in the patch is not what I'd call "expression support" because the targetted constraint names are not proper expressions: [expr] will error out on them. I'd rather call it "support for combinations of constraints", which is not documented as such. Therefore, I considered that specific misfeature a bug. Regardless, both misfeatures (expressions and combinations of constraints) interfere with the regular handling of constraint names, and I'd be very happy to see them go. The functionality that these misfeatures target, can easily (ought?) be implemented outside the tcltest framework.
erikleunissenplain2017-12-10 17:40:20
B.t.w. can anything be said about the planning for tcltest 3? On what does it depend? Any 2.5 or 2.6 on the horizon? I'd be happy to propvide a patch that removes the "support for constraint expressions" entirely, when the moment/opportunity is there.
Log in (anonymous is fine) to add a comment.