summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandreas_kupries <akupries@shaw.ca>2001-04-04 17:35:24 (GMT)
committerandreas_kupries <akupries@shaw.ca>2001-04-04 17:35:24 (GMT)
commit1bc23f4977493306750102c044b833c0b2b73244 (patch)
tree73d04e6b5c7b92798ed03b19442bc0cbeedddbb2
parent8d8e328b979fd600857c37ba6aedb94871872d3b (diff)
downloadtcl-1bc23f4977493306750102c044b833c0b2b73244.zip
tcl-1bc23f4977493306750102c044b833c0b2b73244.tar.gz
tcl-1bc23f4977493306750102c044b833c0b2b73244.tar.bz2
2001-04-04 Andreas Kupries <andreas_kupries@users.sourceforge.net>
* generic/tclTest.c: * tests/io.tests: TIP #10 followup correcting a problem with the original patch because of the lack of 'testthread id' for a non-threaded compilation.
-rw-r--r--ChangeLog7
-rw-r--r--generic/tclTest.c40
-rw-r--r--tests/io.test11
3 files changed, 48 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index e3f87eb..8be6687 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2001-04-04 Andreas Kupries <andreas_kupries@users.sourceforge.net>
+
+ * generic/tclTest.c:
+ * tests/io.tests: TIP #10 followup correcting a problem with the
+ original patch because of the lacck of 'testthread id' for a
+ non-threaded compilation.
+
2001-04-04 Kevin Kenny <kennykb@acm.org>
* doc/ByteArrObj.3:
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 320f014..8c3ae5c 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTest.c,v 1.24 2001/03/31 01:55:37 hobbs Exp $
+ * RCS: @(#) $Id: tclTest.c,v 1.25 2001/04/04 17:35:25 andreas_kupries Exp $
*/
#define TCL_TEST
@@ -235,6 +235,8 @@ static int TestMathFunc _ANSI_ARGS_((ClientData clientData,
static int TestMathFunc2 _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, Tcl_Value *args,
Tcl_Value *resultPtr));
+static int TestmainthreadCmd _ANSI_ARGS_((ClientData dummy,
+ Tcl_Interp *interp, int argc, char **argv));
static Tcl_Channel TestOpenFileChannelProc1 _ANSI_ARGS_((Tcl_Interp *interp,
char *filename, char *modeString, int permissions));
static Tcl_Channel TestOpenFileChannelProc2 _ANSI_ARGS_((Tcl_Interp *interp,
@@ -453,6 +455,8 @@ Tcltest_Init(interp)
(ClientData) 345);
Tcl_CreateCommand(interp, "teststatproc", TeststatprocCmd, (ClientData) 0,
(Tcl_CmdDeleteProc *) NULL);
+ Tcl_CreateCommand(interp, "testmainthread", TestmainthreadCmd, (ClientData) 0,
+ (Tcl_CmdDeleteProc *) NULL);
t3ArgTypes[0] = TCL_EITHER;
t3ArgTypes[1] = TCL_EITHER;
Tcl_CreateMathFunc(interp, "T3", 2, t3ArgTypes, TestMathFunc2,
@@ -4045,6 +4049,40 @@ TestStatProc3(path, buf)
/*
*----------------------------------------------------------------------
*
+ * TestmainthreadCmd --
+ *
+ * Implements the "testmainthread" cmd that is used to test the
+ * 'Tcl_GetCurrentThread' API.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+TestmainthreadCmd (dummy, interp, argc, argv)
+ ClientData dummy; /* Not used. */
+ register Tcl_Interp *interp; /* Current interpreter. */
+ int argc; /* Number of arguments. */
+ char **argv; /* Argument strings. */
+{
+ if (argc == 1) {
+ Tcl_Obj *idObj = Tcl_NewLongObj((long)Tcl_GetCurrentThread());
+ Tcl_SetObjResult(interp, idObj);
+ return TCL_OK;
+ } else {
+ Tcl_SetResult(interp, "wrong # args", TCL_STATIC);
+ return TCL_ERROR;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TestaccessprocCmd --
*
* Implements the "testTclAccessProc" cmd that is used to test the
diff --git a/tests/io.test b/tests/io.test
index 044a803..e3ac4a1 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -12,7 +12,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: io.test,v 1.15 2001/03/30 23:06:40 andreas_kupries Exp $
+# RCS: @(#) $Id: io.test,v 1.16 2001/04/04 17:35:25 andreas_kupries Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -6723,13 +6723,6 @@ test io-58.1 {Tcl_NotifyChannel and error when closing} {unixOrPc} {
} {1 {gets {normal message from pipe} gets {} catch {error message from pipe}}}
-
-if {[info commands testthread] != {}} {
- set mainthread [testthread id]
-} else {
- set mainthread 0
-}
-
test io-59.1 {Thread reference of channels} {
# TIP #10
# More complicated tests (like that the reference changes as a
@@ -6741,7 +6734,7 @@ test io-59.1 {Thread reference of channels} {
set result [testchannel mthread $f]
close $f
set result
-} $mainthread
+} [testmainthread]