| Ticket UUID: | 5d70d14a092160d19d913d8fa2b36a01e1c3a9b4 | ||
| Title: | tcltest: test result differs for different singleproc values | ||
| Type: | Bug | Created on: | 2025-01-11 11:28:45 |
| Submitter: | anonymous | Assigned to: | nobody |
| Subsystem: | 34. tcltest Package | Severity: | Important |
| Priority: | 5 Medium | Last modified: | 2026-05-22 09:45:34 |
| Status: | Closed | Closed by: | apnadkarni |
| Resolution: | Wont Fix | Closed on: | 2026-05-22 09:45:34 |
| Version: | 8.6.17 | ||
| Description: | ||||
I have a following test (sources encoded as utf-8)
--- all.tcl ---
package require tcltest
::tcltest::runAllTests
---------------
--- utf8.test ---
package require tcltest 2.5
::tcltest::test notascii {string corrupted when singleproc == 0} {
string length "äöü"
} 3
-----------------
Test passes in singleproc mode:
> tclsh all.tcl -singleproc 1
Test fails for default run:
> tclsh all.tcl
Test files run in separate interpreters
Running tests that match: *
Skipping test files that match: l.*.test
Only running test files that match: *.test
Tests began at Sat Jan 11 13:04:12 EET 2025
utf-8.test
==== notascii string corrupted when singleproc == 0 FAILED
==== Contents of test case:
string length "äöü"
---- Result was:
6
---- Result should have been (exact matching):
3
==== notascii FAILED
Environment:
tcl_platform(byteOrder) = littleEndian
tcl_platform(engine) = Tcl
tcl_platform(machine) = amd64
tcl_platform(os) = Windows NT
tcl_platform(osVersion) = 10.0
tcl_platform(pathSeparator) = ;
tcl_platform(platform) = windows
tcl_platform(pointerSize) = 8
tcl_platform(threaded) = 1
tcl_platform(user) = user
tcl_platform(wordSize) = 4
tcl = 8.6.17
tcltest = 2.5.9
Problem:
tcltest's runAllTests sources test file as utf-8 for singleProc:
--- tcltest-2.5.9.tm ---
...
2926: uplevel 1 [list ::source -encoding utf-8 $file]
...
---
and runAllTests runs test file using system defaults otherwise
--- tcltest-2.5.9.tm ---
...
2950: set cmd [linsert $childargv 0 | $shell $file]
...
2953: set pipeFd [open $cmd "r"]
...
---
| ||||
| User Comments: | ||||
jan.nijtmans added on 2025-01-11 23:03:46:
Let me guess. What does "encoding system" give on your system? Does it look like?: $ tclsh86 % encoding system cp1252If so, the answer with -singleproc is wrong, the default run is right. Since the source-file is considered cp1252, the length of the string is indeed 6. What we can do is sourcing "all.tcl" in utf-8 regardless of the system-encoding. See [5e8914a8ad|here] jan.nijtmans added on 2025-01-11 23:52:28:
Hm. that doesn't work ..... anonymous added on 2025-01-12 07:19:54:
Sorry, I didn't make it clear that the test file should be saved in utf-8 encoding.
C:\Temp>tclsh
% encoding system
cp1251
C:\Temp>file utf-8.test
utf-8.test: Tcl script, Unicode text, UTF-8 text, with CRLF line terminators
My system encoding is cyrillic cp1251 but the test with cyrillic chars also failed
--- utf-8.test ---
package require tcltest 2.5
::tcltest::test notascii_cyr {string corrupted when singleproc == 0} {
string length "іїє"
} 3
------------------
==== notascii_cyr string corrupted when singleproc == 0 FAILED
==== Contents of test case:
string length "їіє"
---- Result was:
6
---- Result should have been (exact matching):
3
==== notascii_cyr FAILED
anonymous added on 2025-01-12 07:34:06:
And yes, am using -encoding utf-8 for tclsh But runAllTest (when singleproc==0) 'exec' secondary tclsh without '-encoding utf-8'. > tclsh -encoding utf-8 all.tcl -singleproc 0 fails > tclsh -encoding utf-8 utf-8.test works apnadkarni added on 2026-05-22 09:45:34:
Closing as won't fix. Issues does not exist in 9.0 and 8.6 is EOL. | ||||
