From 9a7583c2191aa650ad26a26ab89a94e644ac0240 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 14 Dec 2020 07:33:42 +0000 Subject: Fix [fe57ad096d97623e]: Fix test http-4.14 for tcl-8.6.11rc0 --- tests/http.test | 13 ++++++------- tests/httpd | 10 ++++------ tests/httpold.test | 11 +++++------ 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/tests/http.test b/tests/http.test index d1b2d22..c45a45a 100644 --- a/tests/http.test +++ b/tests/http.test @@ -38,13 +38,10 @@ proc bgerror {args} { puts stderr $errorInfo } -if {$::tcl_platform(os) eq "Darwin"} { - # Name resolution often a problem on OSX; not focus of HTTP package anyway - set HOST localhost -} else { - set HOST [info hostname] -} - +# Do not use [info hostname]. +# Name resolution is often a problem on OSX; not focus of HTTP package anyway. +# Also a problem on other platforms for http-4.14 (test with bad port number). +set HOST localhost set port 8010 set bindata "This is binary data\x0d\x0amore\x0dmore\x0amore\x00null" catch {unset data} @@ -81,6 +78,8 @@ if {[catch {package present Thread}] == 0 && [file exists $httpdFile]} { unset port return } else { + # Running httpd in the current thread overwrites the values of port + # (here) and HOST (in the sourced server file). set port [lindex [fconfigure $listen -sockname] 2] } } diff --git a/tests/httpd b/tests/httpd index 16e0382..4f5f600 100644 --- a/tests/httpd +++ b/tests/httpd @@ -10,12 +10,10 @@ #set httpLog 1 -if {$::tcl_platform(os) eq "Darwin"} { - # Name resolution often a problem on OSX; not focus of HTTP package anyway - set HOST localhost -} else { - set HOST [info hostname] -} +# Do not use [info hostname]. +# Name resolution is often a problem on OSX; not focus of HTTP package anyway. +# Also a problem on other platforms for http-4.14 (test with bad port number). +set HOST localhost proc httpd_init {{port 8015}} { socket -server httpdAccept $port diff --git a/tests/httpold.test b/tests/httpold.test index 1b07c90..e5d974c 100644 --- a/tests/httpold.test +++ b/tests/httpold.test @@ -33,18 +33,17 @@ if {[catch {package require http 1.0}]} { } } -if {$::tcl_platform(os) eq "Darwin"} { - # Name resolution often a problem on OSX; not focus of HTTP package anyway - set HOST localhost -} else { - set HOST [info hostname] -} +# Do not use [info hostname]. +# Name resolution is often a problem on OSX; not focus of HTTP package anyway. +# Also a problem on other platforms for http-4.14 (test with bad port number). +set HOST localhost set bindata "This is binary data\x0d\x0amore\x0dmore\x0amore\x00null" catch {unset data} ## ## The httpd script implement a stub http server +## Sourcing httpd overwrites the value of HOST. ## source [file join [file dirname [info script]] httpd] -- cgit v0.12