From cc51cd8b376484c83fa87e30582d1c53712387d5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 9 Dec 2020 10:20:03 +0000 Subject: Sync win/rules.vc with Tcl. And the use of TCL_USE_STATIC_PACKAGES as well --- unix/tkAppInit.c | 6 +++++- win/rules.vc | 42 +++++++++++++++++++++++++++++++++++------- win/winMain.c | 24 ++++++++++++++++++------ 3 files changed, 58 insertions(+), 14 deletions(-) diff --git a/unix/tkAppInit.c b/unix/tkAppInit.c index 712637b..6cf3d42 100644 --- a/unix/tkAppInit.c +++ b/unix/tkAppInit.c @@ -37,7 +37,11 @@ extern Tcl_PackageInitProc Tktest_Init; #define TK_LOCAL_APPINIT Tcl_AppInit #endif #ifndef MODULE_SCOPE -# define MODULE_SCOPE extern +# ifdef __cplusplus +# define MODULE_SCOPE extern "C" +# else +# define MODULE_SCOPE extern +# endif #endif MODULE_SCOPE int TK_LOCAL_APPINIT(Tcl_Interp *); MODULE_SCOPE int main(int, char **); diff --git a/win/rules.vc b/win/rules.vc index ab43909..76d93cd1 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -6,7 +6,7 @@ # compiler switches, defining common targets and macros. The Tcl makefile # directly includes this. Extensions include it via "rules-ext.vc". # -# See TIP 477 (https://core.tcl-lang.org/tips/doc/trunk/tip/477.md) for +# See TIP 477 (https://core.tcl-lang.org/tips/doc/main/tip/477.md) for # detailed documentation. # # See the file "license.terms" for information on usage and redistribution @@ -24,7 +24,7 @@ _RULES_VC = 1 # For modifications that are not backward-compatible, you *must* change # the major version. RULES_VERSION_MAJOR = 1 -RULES_VERSION_MINOR = 6 +RULES_VERSION_MINOR = 7 # The PROJECT macro must be defined by parent makefile. !if "$(PROJECT)" == "" @@ -667,9 +667,10 @@ LINKERFLAGS = $(LINKERFLAGS) -ltcg # MSVCRT - 1 -> link to dynamic C runtime even when building static Tcl build # 0 -> link to static C runtime for static Tcl build. # Does not impact shared Tcl builds (STATIC_BUILD == 0) +# Default: 1 for Tcl 8.7 and up, 0 otherwise. # TCL_USE_STATIC_PACKAGES - 1 -> statically link the registry and dde extensions -# in the Tcl shell. 0 -> keep them as shared libraries -# Does not impact shared Tcl builds. +# in the Tcl and Wish shell. 0 -> keep them as shared libraries. Does +# not impact shared Tcl builds. Implied by STATIC_BUILD since Tcl 8.7. # USE_THREAD_ALLOC - 1 -> Use a shared global free pool for allocation. # 0 -> Use the non-thread allocator. # UNCHECKED - 1 -> when doing a debug build with symbols, use the release @@ -724,7 +725,7 @@ MSVCRT = 0 !if [nmakehlp -f $(OPTS) "msvcrt"] !message *** Doing msvcrt !else -!if $(STATIC_BUILD) +!if "$(TCL_MAJOR_VERSION)" == "8" && "$(TCL_MINOR_VERSION)" < "7" && $(STATIC_BUILD) MSVCRT = 0 !endif !endif @@ -907,10 +908,14 @@ WARNINGS = $(WARNINGS) -Wp64 # Sets the following macros: # TCL_MAJOR_VERSION # TCL_MINOR_VERSION +# TCL_RELEASE_SERIAL # TCL_PATCH_LEVEL +# TCL_PATCH_LETTER # TCL_VERSION # TK_MAJOR_VERSION # TK_MINOR_VERSION +# TK_RELEASE_SERIAL +# TK_PATCH_LEVEL # TK_PATCH_LEVEL # TK_VERSION # DOTVERSION - set as (for example) 2.5 @@ -925,6 +930,9 @@ WARNINGS = $(WARNINGS) -Wp64 !if [echo TCL_MINOR_VERSION = \>> versions.vc] \ && [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc] !endif +!if [echo TCL_RELEASE_SERIAL = \>> versions.vc] \ + && [nmakehlp -V "$(_TCL_H)" TCL_RELEASE_SERIAL >> versions.vc] +!endif !if [echo TCL_PATCH_LEVEL = \>> versions.vc] \ && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc] !endif @@ -936,6 +944,9 @@ WARNINGS = $(WARNINGS) -Wp64 !if [echo TK_MINOR_VERSION = \>> versions.vc] \ && [nmakehlp -V $(_TK_H) TK_MINOR_VERSION >> versions.vc] !endif +!if [echo TK_RELEASE_SERIAL = \>> versions.vc] \ + && [nmakehlp -V "$(_TK_H)" TK_RELEASE_SERIAL >> versions.vc] +!endif !if [echo TK_PATCH_LEVEL = \>> versions.vc] \ && [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc] !endif @@ -945,9 +956,26 @@ WARNINGS = $(WARNINGS) -Wp64 TCL_VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION) TCL_DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) +!if [nmakehlp -f $(TCL_PATCH_LEVEL) "a"] +TCL_PATCH_LETTER = a +!elseif [nmakehlp -f $(TCL_PATCH_LEVEL) "b"] +TCL_PATCH_LETTER = b +!else +TCL_PATCH_LETTER = . +!endif + !if defined(_TK_H) + TK_VERSION = $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION) TK_DOTVERSION = $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION) +!if [nmakehlp -f $(TK_PATCH_LEVEL) "a"] +TK_PATCH_LETTER = a +!elseif [nmakehlp -f $(TK_PATCH_LEVEL) "b"] +TK_PATCH_LETTER = b +!else +TK_PATCH_LETTER = . +!endif + !endif # Set DOTVERSION and VERSION @@ -1538,11 +1566,11 @@ default-target: $(DEFAULT_BUILD_TARGET) !if $(MULTIPLATFORM_INSTALL) default-pkgindex: @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ - [list load [file join $$dir $(PLATFORM_IDENTIFY) $(PRJLIBNAME)]] > $(OUT_DIR)\pkgIndex.tcl + [list load [file join $$dir $(PLATFORM_IDENTIFY) $(PRJLIBNAME)] [string totitle $(PRJ_PACKAGE_TCLNAME)]] > $(OUT_DIR)\pkgIndex.tcl !else default-pkgindex: @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ - [list load [file join $$dir $(PRJLIBNAME)]] > $(OUT_DIR)\pkgIndex.tcl + [list load [file join $$dir $(PRJLIBNAME)] [string totitle $(PRJ_PACKAGE_TCLNAME)]] > $(OUT_DIR)\pkgIndex.tcl !endif default-pkgindex-tea: diff --git a/win/winMain.c b/win/winMain.c index f3dfd12..f072f78 100644 --- a/win/winMain.c +++ b/win/winMain.c @@ -29,17 +29,25 @@ int _CRT_glob = 0; extern "C" { #endif extern Tcl_PackageInitProc Tktest_Init; -#ifdef __cplusplus -} -#endif #endif /* TK_TEST */ -#if defined(STATIC_BUILD) && defined(TCL_USE_STATIC_PACKAGES) && TCL_USE_STATIC_PACKAGES +#if !defined(TCL_USE_STATIC_PACKAGES) +# if TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6 +# define TCL_USE_STATIC_PACKAGES 1 +# else +# define TCL_USE_STATIC_PACKAGES 0 +# endif +#endif + +#if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES extern Tcl_PackageInitProc Registry_Init; extern Tcl_PackageInitProc Dde_Init; extern Tcl_PackageInitProc Dde_SafeInit; #endif +#ifdef __cplusplus +} +#endif #ifdef TCL_BROKEN_MAINARGS static void setargv(int *argcPtr, TCHAR ***argvPtr); #endif @@ -60,7 +68,11 @@ static BOOL consoleRequired = TRUE; #define TK_LOCAL_APPINIT Tcl_AppInit #endif #ifndef MODULE_SCOPE -# define MODULE_SCOPE extern +# ifdef __cplusplus +# define MODULE_SCOPE extern "C" +# else +# define MODULE_SCOPE extern +# endif #endif MODULE_SCOPE int TK_LOCAL_APPINIT(Tcl_Interp *interp); @@ -202,7 +214,7 @@ Tcl_AppInit( return TCL_ERROR; } } -#if defined(STATIC_BUILD) && defined(TCL_USE_STATIC_PACKAGES) && TCL_USE_STATIC_PACKAGES +#if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES if (Registry_Init(interp) == TCL_ERROR) { return TCL_ERROR; } -- cgit v0.12 From d5272384313f273fd7eee58f1f9f913ef3a838e1 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 9 Dec 2020 23:26:53 +0000 Subject: Make sure there's a file in the home directory on Windows for winDialog-5.12.7 --- tests/winDialog.test | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/winDialog.test b/tests/winDialog.test index e70ae3f..a0dbc8d 100755 --- a/tests/winDialog.test +++ b/tests/winDialog.test @@ -591,7 +591,18 @@ test winDialog-5.12.6 {tk_getSaveFile: initial directory: relative} -constraints string equal $x [file join $dir testfile] } -result 1 -test winDialog-5.12.7 {tk_getOpenFile: initial directory: ~} -constraints { +test winDialog-5.12.7 {tk_getOpenFile: initial directory: ~} -setup { + # Ensure there's at least one file in the home directory in CI environments + set makeEmpty [expr {![llength [glob -type f -directory ~ *]]}] + if {$makeEmpty} { + for {set i 1} {$i < 1000} {incr i} { + # Technically a race condition... + set actualFilename [format "~/tkWinDialog5_12_7_%03d" $i] + if {![file exists $actualFilename]} break + } + close [open $actualFilename w] + } +} -constraints { nt testwinevent } -body { set fn [file tail [lindex [glob -types f ~/*] 0]] @@ -603,6 +614,10 @@ test winDialog-5.12.7 {tk_getOpenFile: initial directory: ~} -constraints { Click ok } string equal $x [file normalize [file join ~ $fn]] +} -cleanup { + if {$makeEmpty} { + file delete $actualFilename + } } -result 1 test winDialog-5.12.8 {tk_getOpenFile: initial directory: .} -constraints { -- cgit v0.12 From dd9981cdf34805e32668ccc8856f95631c0e9940 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 10 Dec 2020 14:43:05 +0000 Subject: On github actions, make build fail if any testcases fails. Mark 2 failing testcases --- .github/workflows/linux-build.yml | 10 ++++------ .github/workflows/win-build.yml | 16 +++++++++------- tests/font.test | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 7bbbef9..70bbd5e 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -143,15 +143,13 @@ jobs: } - name: Run Tests run: | - xvfb-run --auto-servernum make test-classic | tee out-classic.txt || { + xvfb-run --auto-servernum make test-classic | tee out-classic.txt + xvfb-run --auto-servernum make test-ttk | tee out-ttk.txt + grep -q "Failed 0" out-classic.txt || { echo "::error::Failure during Test" exit 1 } - xvfb-run --auto-servernum make test-ttk | tee out-ttk.txt || { - echo "::error::Failure during Test" - exit 1 - } - cat out-classic.txt out-ttk.txt | grep -q "Failed 0" || { + grep -q "Failed 0" out-ttk.txt || { echo "::error::Failure during Test" exit 1 } diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index 5893fb6..3bfd130 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -60,7 +60,11 @@ jobs: echo "::error::Failure during Test" exit 1 } - cat out-classic.txt out-ttk.txt | grep -q "Failed [1-9]" && { + grep -q "Failed 0" out-classic.txt || { + echo "::error::Failure during Test" + exit 1 + } + grep -q "Failed 0" out-ttk.txt || { echo "::error::Failure during Test" exit 1 } @@ -142,15 +146,13 @@ jobs: } - name: Run Tests run: | - make test-classic | tee out-classic.txt || { - echo "::error::Failure during Test" - exit 1 - } - make test-ttk | tee out-ttk.txt || { + make test-classic | tee out-classic.txt + make test-ttk | tee out-ttk.txt + grep -q "Failed 0" out-classic.txt || { echo "::error::Failure during Test" exit 1 } - cat out-classic.txt out-ttk.txt | grep -q "Failed [1-9]" && { + grep -q "Failed 0" out-ttk.txt || { echo "::error::Failure during Test" exit 1 } diff --git a/tests/font.test b/tests/font.test index cef8df2..6995a7b 100644 --- a/tests/font.test +++ b/tests/font.test @@ -2340,7 +2340,7 @@ test font-43.1 {FieldSpecified procedure: specified vs. non-specified} -body { } -result [font actual {times 0} -family] -test font-44.1 {TkFontGetPixels: size < 0} -constraints failsOnUbuntuNoXft -setup { +test font-44.1 {TkFontGetPixels: size < 0} -constraints failsOnUbuntu -setup { set oldscale [tk scaling] } -body { tk scaling 0.5 @@ -2364,7 +2364,7 @@ test font-45.1 {TkFontGetAliasList: no match} -body { test font-45.2 {TkFontGetAliasList: match} -constraints win -body { font actual {times 10} -family } -result {Times New Roman} -test font-45.3 {TkFontGetAliasList: match} -constraints {noExceed} -body { +test font-45.3 {TkFontGetAliasList: match} -constraints {noExceed failsOnUbuntu} -body { if {[font actual {{times new roman} 10} -family] eq "Times New Roman"} { # avoid test failure on systems that have a real "times new roman" font set res 1 -- cgit v0.12