Jim Tcl
Check-in [b1f8a31bdc]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:tests: Use a more explicit approach to test SIGPIPE

Write to a closed pipe in exec2-3.2 to force SIGPIPE

Signed-off-by: Steve Bennett <steveb@workware.net.au>

Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b1f8a31bdcd198df326ea3b460c10d4d90aa54f6
User & Date: steveb@workware.net.au 2017-10-21 03:25:47
Context
2017-11-04
09:16
tests: exec2-3.2 now passes on OpenBSD

Reported-by: Stuart Cassoff <stwo@bell.net> Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 713502fb49 user: steveb@workware.net.au tags: trunk

2017-10-21
03:25
tests: Use a more explicit approach to test SIGPIPE

Write to a closed pipe in exec2-3.2 to force SIGPIPE

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: b1f8a31bdc user: steveb@workware.net.au tags: trunk

02:49
aio: No need to create a new channel for ssl

Just "promote" the current channel to ssl

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 256d17bf10 user: steveb@workware.net.au tags: trunk

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/exec2.test.

1
2
3
4
5
6
7

8
9
10
11
12
13
14
..
47
48
49
50
51
52
53


54



55
56
57
58
59
60
61
62
63
# These tests are design especially for the vfork() implementation
# of exec where sh -c must be used and thus we must take extra care
# in quoting arguments to exec.

source [file dirname [info script]]/testing.tcl

needs cmd exec


set d \"
set s '
set b \\

array set saveenv [array get env]

................................................................................
test exec2-3.1 "close pipeline return value" {
	set f [open |false]
	set rc [catch {close $f} msg opts]
	lassign [dict get $opts -errorcode] status pid exitcode
	list $rc $msg $status $exitcode
} {1 {child process exited abnormally} CHILDSTATUS 1}



test exec2-3.2 "close pipeline return value" -body {



	set bigstring [string repeat a 10000]
	set f [open [list |cat << $bigstring]]
	set rc [catch {close $f} msg opts]
	lassign [dict get $opts -errorcode] status pid exitcode
	list $rc $msg $status $exitcode
} -match glob -result {1 {child killed*} CHILDKILLED SIGPIPE}

test exec2-3.4 "wait for background task" {
	set pid [exec sleep 0.1 &]







>







 







>
>
|
>
>
>

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# These tests are design especially for the vfork() implementation
# of exec where sh -c must be used and thus we must take extra care
# in quoting arguments to exec.

source [file dirname [info script]]/testing.tcl

needs cmd exec
testConstraint pipe [expr {[info commands pipe] ne ""}]

set d \"
set s '
set b \\

array set saveenv [array get env]

................................................................................
test exec2-3.1 "close pipeline return value" {
	set f [open |false]
	set rc [catch {close $f} msg opts]
	lassign [dict get $opts -errorcode] status pid exitcode
	list $rc $msg $status $exitcode
} {1 {child process exited abnormally} CHILDSTATUS 1}

# Note that on at least one Windows system, this fails to return SIGPIPE
# and cat simply fails instead. How to it simply returns 
test exec2-3.2 "close pipeline return value" -constraints pipe -body {
	# Create a pipe and immediately close the read end
	lassign [pipe] r w
	close $r
	set bigstring [string repeat a 10000]
	set f [open [list |cat << $bigstring >$@w]]
	set rc [catch {close $f} msg opts]
	lassign [dict get $opts -errorcode] status pid exitcode
	list $rc $msg $status $exitcode
} -match glob -result {1 {child killed*} CHILDKILLED SIGPIPE}

test exec2-3.4 "wait for background task" {
	set pid [exec sleep 0.1 &]