Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2006-12-02
02:11 • Closed ticket [1606860fff]: chan-16.9 fails on Mac OS X plus 8 other changes artifact: ccbb8d2b11 user: dgp
00:27 • Ticket [1606860fff]: 4 changes artifact: 2412d22a59 user: cleverly
00:26 • Ticket [1606860fff]: 4 changes artifact: bf725feb3f user: cleverly
2006-12-01
16:04 • New ticket [1606860fff]. artifact: 7784598939 user: dgp

chan-16.9 fails on Mac OS X

Closed / Fixed1606860fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2006-12-01 16:04:59
==== chan-16.9 chan command: pending input subcommand FAILED
==== Contents of test case:

    after idle chan-16.9-client 
    vwait ::chan-16.9-done
    set ::chan-16.9-data

---- Result was:
-1 0 0 1 36 -1 0 0 1 72 -1 0 0 1 144 ABC 890
---- Result should have been (exact matching):
-1 0 0 1 36 -1 0 0 1 72 -1 0 0 1 108 -1 0 0 1 144 ABC 890
==== chan-16.9 FAILED
cleverlyplain2006-12-02 00:26:14
Logged In: YES 
user_id=22080
Originator: NO

This failure is timing related, not anything specific to OS X.  (I wrote the test on my [getting older] powerpc OS X laptop.)

The test sets up a server socket with a readable fileevent and then opens a client socket to it and writes chunks of 36-bytes worth of data (with no newlines) spaced 100ms apart.  

The failure above shows first chunk of 36 bytes read, second chunk of 36 bytes, then a third chunk of 72 bytes (i.e., when the fileevent triggered the client had been called twice in between).

I'm attaching a patch which modifies the test where the next write chunk is scheduled as an after idle callback when the prior data is read. I think this will eliminate timing conditions (which the test isn't designed to say anything about) while still exercising the functionality [chan pending input] that the test is testing.

Comments, feedback, suggestions of course welcomed.  Thanks!
cleverlyplain2006-12-02 00:27:27
Logged In: YES 
user_id=22080
Originator: NO

Well, it seems SF doesn't want to give me the option of attaching a file to this ticket (I guess since I'm not the creator of it?).  So here is the patch as a comment:

--- chan.test.old       2006-12-01 10:16:16.000000000 -0700
+++ chan.test   2006-12-01 10:17:11.000000000 -0700
@@ -153,13 +153,14 @@
             lappend ::chan-16.9-data [string range $data 0 2]
             lappend ::chan-16.9-data [string range $data end-2 end]
             set ::chan-16.9-done 1
+        } else {
+            after idle chan-16.9-client
         }
     }
 
     proc chan-16.9-client {} {
         chan puts -nonewline $::client ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
         chan flush $::client
-        after 100 chan-16.9-client
     }
 
     set ::server [socket -server chan-16.9-accept -myaddr 127.0.0.1 0]
dgpplain2006-12-02 02:11:05
Logged In: YES 
user_id=80530
Originator: YES


fix committed
Log in (anonymous is fine) to add a comment.