From b40c3af17683766d1e1359c9ceb4dd7178f6afc5 Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Fri, 23 Oct 2015 22:29:23 +0000 Subject: Correct bad regexp in platform::identify that causes it to return incorrect results everywhere. --- library/platform/platform.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/platform/platform.tcl b/library/platform/platform.tcl index c596e60..0160184 100644 --- a/library/platform/platform.tcl +++ b/library/platform/platform.tcl @@ -165,7 +165,7 @@ proc ::platform::identify {} { global tcl_platform set id [generic] - regexp {^([^-]+)-([^-]+)$} $id -> plat ver wow cpu + regexp {^([^-]+)(-[0-9\.]+)?(-wow)?-([^-]+)$} $id -> plat ver wow cpu switch -- $plat { solaris { -- cgit v0.12 From 24c49324b4488e47b21eaa259a0950464f9b930c Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 23 Oct 2015 22:30:57 +0000 Subject: Ensure that at lease the format of the output of the platform package's commands is consistently parsable. --- tests/platform.test | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/platform.test b/tests/platform.test index ab82d07..b5ddc48 100644 --- a/tests/platform.test +++ b/tests/platform.test @@ -1,4 +1,4 @@ -# The file tests the tcl_platform variable +# The file tests the tcl_platform variable and platform package. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and @@ -54,6 +54,17 @@ test platform-3.1 {CPU ID on Windows/UNIX} \ -match regexp \ -result {^(?:AuthenticAMD|CentaurHauls|CyrixInstead|GenuineIntel)$} +# The platform package makes very few promises, but does promise that the +# format of string it produces consists of two non-empty words separated by a +# hyphen. +package require platform +test platform-4.1 {format of platform::identify result} -match regexp -body { + platform::identify +} -result {^[^-]+-[^-]+$} +test platform-4.2 {format of platform::generic result} -match regexp -body { + platform::generic +} -result {^[^-]+-[^-]+$} + # cleanup cleanupTests -- cgit v0.12