From 0e3cc87362584b9a0cc3bb6890dd588e50fd979f Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 14 Jan 2019 08:55:49 +0000 Subject: minor optimization: check length instead of content - don't touch other memory (so potentially fewer cpu-cache washout's) --- generic/tclExecute.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 51dd382..fafd511 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5238,7 +5238,7 @@ TEBCresume( /* Every range of an empty list is an empty list */ if (objc == 0) { /* avoid return of not canonical list (e. g. spaces in string repr.) */ - if (!valuePtr->bytes || !valuePtr->bytes[0]) { + if (!valuePtr->bytes || !valuePtr->length) { TRACE_APPEND(("\n")); NEXT_INST_F(9, 0, 0); } -- cgit v0.12 From 6933dc699128b0c5f9f0f2174efcc760a1c35eda Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 14 Jan 2019 10:00:46 +0000 Subject: win: allows testchmod to reset DELETE DACL-mask (repaired several tests winFCmd-6.*, winFCmd-9.3, that should catch EACCESS) --- win/tclWinTest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win/tclWinTest.c b/win/tclWinTest.c index b2fe6c0..aa2c15a 100644 --- a/win/tclWinTest.c +++ b/win/tclWinTest.c @@ -399,11 +399,11 @@ TestplatformChmod( { static const SECURITY_INFORMATION infoBits = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION; - /* don't deny DELETE mask (reset writable only, allow test-cases cleanup) */ + /* don't reset change permissions mask (WRITE_DAC, allow test-cases restore it to cleanup) */ static const DWORD readOnlyMask = FILE_DELETE_CHILD | FILE_ADD_FILE | FILE_ADD_SUBDIRECTORY | FILE_WRITE_EA | FILE_APPEND_DATA | FILE_WRITE_DATA - /* | DELETE */; + | DELETE; /* * References to security functions (only available on NT and later). -- cgit v0.12 From ae312970b6c7a2d7eed2af248389ba5b7497602f Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 14 Jan 2019 17:04:24 +0000 Subject: mingw/win-autoconf build: provide tcltest-executable (for consistency reasons); normalizes loading packages calls in test-suite, added build of helpers tcltest (tcltest.cmd) to start tcl-test suite (with all dependencies/facilities) from shell --- win/Makefile.in | 53 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/win/Makefile.in b/win/Makefile.in index 9d955cd..52c7ede 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -116,6 +116,7 @@ GENERIC_DIR_NATIVE = $(shell $(CYGPATH) '$(GENERIC_DIR)') TOMMATH_DIR_NATIVE = $(shell $(CYGPATH) '$(TOMMATH_DIR)') WIN_DIR_NATIVE = $(shell $(CYGPATH) '$(WIN_DIR)') ROOT_DIR_NATIVE = $(shell $(CYGPATH) '$(ROOT_DIR)') +ROOT_DIR_WIN_NATIVE = $(shell cd '$(ROOT_DIR)' ; pwd -W || pwd -P) ZLIB_DIR_NATIVE = $(shell $(CYGPATH) '$(ZLIB_DIR)') #GENERIC_DIR_NATIVE = $(GENERIC_DIR) #TOMMATH_DIR_NATIVE = $(TOMMATH_DIR) @@ -145,7 +146,12 @@ DDE_LIB_FILE = @LIBPREFIX@tcldde$(DDEVER)${LIBSUFFIX} REG_DLL_FILE = tclreg$(REGVER)${DLLSUFFIX} REG_LIB_FILE = @LIBPREFIX@tclreg$(REGVER)${LIBSUFFIX} TEST_DLL_FILE = tcltest$(VER)${DLLSUFFIX} +TEST_EXE_FILE = tcltest${EXESUFFIX} TEST_LIB_FILE = @LIBPREFIX@tcltest$(VER)${LIBSUFFIX} +TEST_LOAD_PRMS = package ifneeded dde 1.4.1 [list load [file normalize ${DDE_DLL_FILE}] dde];\ + package ifneeded registry 1.3.3 [list load [file normalize ${REG_DLL_FILE}] registry] +TEST_LOAD_FACILITIES = package ifneeded Tcltest ${VERSION}@TCL_PATCH_LEVEL@ [list load [file normalize ${TEST_DLL_FILE}] Tcltest];\ + $(TEST_LOAD_PRMS) ZLIB_DLL_FILE = zlib1.dll SHARED_LIBRARIES = $(TCL_DLL_FILE) @ZLIB_DLL_FILE@ @@ -417,7 +423,34 @@ TCL_DOCS = "$(ROOT_DIR_NATIVE)"/doc/*.[13n] all: binaries libraries doc packages -tcltest: $(TCLSH) $(TEST_DLL_FILE) +# Test-suite helper (can be used to test Tcl from build directory with all expected modules). +# To start from windows shell use: +# > tcltest.cmd -verbose bps -file fileName.test +# or from mingw/msys shell: +# $ ./tcltest -verbose bps -file fileName.test + +tcltest.cmd: + @echo 'Create tcltest.cmd helpers'; + @(\ + echo '@echo off'; \ + echo 'rem set LANG=en_US'; \ + echo 'set BDP=%~dp0'; \ + echo 'set OWD=%CD%'; \ + echo 'cd /d %TEMP%'; \ + echo 'rem "%BDP%\$(TCLSH)" "$(ROOT_DIR_WIN_NATIVE)/tests/all.tcl" $(TESTFLAGS) -load "$(TEST_LOAD_FACILITIES)" %*'; \ + echo '"%BDP%\$(TEST_EXE_FILE)" "$(ROOT_DIR_WIN_NATIVE)/tests/all.tcl" $(TESTFLAGS) -load "$(TEST_LOAD_PRMS)" %*'; \ + echo 'cd /d %OWD%'; \ + ) > tcltest.cmd; + @(\ + echo '#!/bin/sh'; \ + echo '#LANG=en_US'; \ + echo 'BDP=$$(dirname $$(readlink -f %0))'; \ + echo 'cd /tmp'; \ + echo '#"$$BDP/$(TCLSH)" "$(ROOT_DIR_WIN_NATIVE)/tests/all.tcl" $(TESTFLAGS) -load "$(TEST_LOAD_FACILITIES)" "$$@"'; \ + echo '"$$BDP/$(TEST_EXE_FILE)" "$(ROOT_DIR_WIN_NATIVE)/tests/all.tcl" $(TESTFLAGS) -load "$(TEST_LOAD_PRMS)" "$$@"'; \ + ) > tcltest; + +tcltest: $(TCLSH) $(TEST_EXE_FILE) $(TEST_DLL_FILE) tcltest.cmd binaries: $(TCL_STUB_LIB_FILE) @LIBRARIES@ winextensions $(TCLSH) @@ -466,6 +499,11 @@ ${TEST_DLL_FILE}: ${TCL_STUB_LIB_FILE} ${TCLTEST_OBJS} @$(RM) ${TEST_DLL_FILE} ${TEST_LIB_FILE} @MAKE_DLL@ ${TCLTEST_OBJS} $(TCL_STUB_LIB_FILE) $(SHLIB_LD_LIBS) +${TEST_EXE_FILE}: ${TCL_STUB_LIB_FILE} ${TCLTEST_OBJS} tclTestMain.${OBJEXT} + @$(RM) ${TEST_EXE_FILE} + $(CC) $(CFLAGS) $(TCLTEST_OBJS) tclTestMain.$(OBJEXT) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \ + tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) + # use pre-built zlib1.dll ${ZLIB_DLL_FILE}: ${TCL_STUB_LIB_FILE} @if test "@ZLIB_LIBS@set" != "${ZLIB_DIR_NATIVE}/win32/zdll.libset" ; then \ @@ -483,6 +521,9 @@ ${ZLIB_DLL_FILE}: ${TCL_STUB_LIB_FILE} # Special case object targets +tclTestMain.${OBJEXT}: tclAppInit.c + $(CC) -c $(CC_SWITCHES) -DTCL_TEST -DBUILD_tcl $(EXTFLAGS) $(CC_OBJNAME) $(WIN_DIR)/tclAppInit.c + tclWinInit.${OBJEXT}: tclWinInit.c $(CC) -c $(CC_SWITCHES) -DBUILD_tcl $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME) @@ -711,16 +752,12 @@ test: test-tcl test-packages test-tcl: binaries $(TCLSH) $(CAT32) $(TEST_DLL_FILE) TCL_LIBRARY="$(LIBRARY_DIR)"; export TCL_LIBRARY; \ ./$(TCLSH) "$(ROOT_DIR_NATIVE)/tests/all.tcl" $(TESTFLAGS) \ - -load "package ifneeded Tcltest ${VERSION}@TCL_PATCH_LEVEL@ [list load [file normalize ${TEST_DLL_FILE}] Tcltest]; \ - package ifneeded dde 1.4.1 [list load [file normalize ${DDE_DLL_FILE}] dde]; \ - package ifneeded registry 1.3.3 [list load [file normalize ${REG_DLL_FILE}] registry]" | ./$(CAT32) + -load "$(TEST_LOAD_FACILITIES)" | ./$(CAT32) # Useful target to launch a built tclsh with the proper path,... runtest: binaries $(TCLSH) $(TEST_DLL_FILE) @TCL_LIBRARY="$(LIBRARY_DIR)"; export TCL_LIBRARY; \ - ./$(TCLSH) $(TESTFLAGS) -load "package ifneeded Tcltest ${VERSION}@TCL_PATCH_LEVEL@ [list load [file normalize ${TEST_DLL_FILE}] Tcltest]; \ - package ifneeded dde 1.4.1 [list load [file normalize ${DDE_DLL_FILE}] dde]; \ - package ifneeded registry 1.3.3 [list load [file normalize ${REG_DLL_FILE}] registry]" $(SCRIPT) + ./$(TCLSH) $(TESTFLAGS) -load "$(TEST_LOAD_FACILITIES)" $(SCRIPT) # This target can be used to run tclsh from the build directory via # `make shell SCRIPT=foo.tcl` @@ -744,7 +781,7 @@ cleanhelp: clean: cleanhelp clean-packages $(RM) *.lib *.a *.exp *.dll *.$(RES) *.${OBJEXT} *~ \#* TAGS a.out - $(RM) $(TCLSH) $(CAT32) + $(RM) $(TCLSH) $(CAT32) $(TEST_EXE_FILE) $(TEST_DLL_FILE) tcltest.cmd tcltest $(RM) *.pch *.ilk *.pdb distclean: distclean-packages clean -- cgit v0.12 From 4aca9276dfef3ce6d54718351c0a3f80896228ff Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 14 Jan 2019 19:51:02 +0000 Subject: normalize package provide for tcltests 0.1 (declaration moved from pkgIndex.tcl to package source) --- tests/pkgIndex.tcl | 5 +---- tests/tcltests.tcl | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/pkgIndex.tcl b/tests/pkgIndex.tcl index 854b943..9d89277 100644 --- a/tests/pkgIndex.tcl +++ b/tests/pkgIndex.tcl @@ -1,6 +1,3 @@ #! /usr/bin/env tclsh -package ifneeded tcltests 0.1 " - source [list $dir/tcltests.tcl] - package provide tcltests 0.1 -" +package ifneeded tcltests 0.1 [list source $dir/tcltests.tcl] diff --git a/tests/tcltests.tcl b/tests/tcltests.tcl index 74d1b40..cfd3ea3 100644 --- a/tests/tcltests.tcl +++ b/tests/tcltests.tcl @@ -9,3 +9,5 @@ testConstraint fileevent [llength [info commands fileevent]] testConstraint thread [ expr {0 == [catch {package require Thread 2.7-}]}] testConstraint notValgrind [expr {![testConstraint valgrind]}] + +package provide tcltests 0.1 -- cgit v0.12