Backport the previous commit's changes for tcl9 to the tc8 recipe:

I discovered that running a single test case with tcltest doesn't let
you know if the test failed or not, so when run-ptest moved away from
using all.tcl[1] we were always marking the tests as passing.

So, revert that commit and use all.tcl as a test runner. This is more
noisy, but importantly will let us know if a test failed.

Remove our un-upstreamable tweaks to the interp tests and instead skip
the test that is known to be fragile, so we don't have to carry a patch
forever.

Don't install another copy of the entire Tcl library for the tests, as
there is no real point.  This does then expose a bug in the tests where
clock-59.2 assumes that it is running in a source tree and behaves
differently if the system tzdata is being used.  This is being worked on
upstream[2], for now skip this test.

Clean up musl overriding so it's more resiliant.

Exit 1 if a test fails.

[1] oe-core 9c41887f2a ("tcl: improve test execution loop")
[2] 
https://core.tcl-lang.org/tcl/tktview/51aa53616067cb63900b17ca1d71f07b094ffa1a

Signed-off-by: Ross Burton <[email protected]>
---
 .../recipes-devtools/tcltk8/tcl8/interp.patch | 40 -------------------
 meta/recipes-devtools/tcltk8/tcl8/run-ptest   | 32 ++++++++++-----
 meta/recipes-devtools/tcltk8/tcl8_8.6.17.bb   |  5 +--
 3 files changed, 23 insertions(+), 54 deletions(-)
 delete mode 100644 meta/recipes-devtools/tcltk8/tcl8/interp.patch

diff --git a/meta/recipes-devtools/tcltk8/tcl8/interp.patch 
b/meta/recipes-devtools/tcltk8/tcl8/interp.patch
deleted file mode 100644
index c6412e7775..0000000000
--- a/meta/recipes-devtools/tcltk8/tcl8/interp.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 2d959d1fdfbd7e020f5177b1a7ff6a08809536ca Mon Sep 17 00:00:00 2001
-From: Ross Burton <[email protected]>
-Date: Mon, 12 Jul 2021 14:50:13 +0100
-Subject: [PATCH] tcl: fix race in interp.test
-
-The interp-36.7 patch has race conditions and is missing cleanup.  This patch 
by
-a Tcl maintainer should improve matters.
-
-Upstream-Status: Inappropriate [tcl 8.x is obsolete; upstream submission 
should be for 9.x patches]
-Signed-off-by: Ross Burton <[email protected]>
----
- tests/interp.test | 7 ++++---
- 1 file changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/tests/interp.test b/tests/interp.test
-index d64fdd4..9931dd1 100644
---- a/tests/interp.test
-+++ b/tests/interp.test
-@@ -3651,17 +3651,18 @@ test interp-36.7 {ChildBgerror sets error handler of 
child [1999035]} -setup {
-         variable result
-         set result [lindex $args 0]
-     }
-+    set tout [after 5000 {set result timeout}]
- } -body {
-     child eval {
-         variable done {}
-         after 0 error foo
--        after 10 [list ::set [namespace which -variable done] {}]
--        vwait [namespace which -variable done]
-     }
-+    vwait result
-     set result
- } -cleanup {
-+    after cancel $tout
-     variable result {}
--    unset -nocomplain result
-+    unset -nocomplain result tout
-     interp delete child
- } -result foo
- 
diff --git a/meta/recipes-devtools/tcltk8/tcl8/run-ptest 
b/meta/recipes-devtools/tcltk8/tcl8/run-ptest
index 0422e28a9d..dc61d66cc1 100644
--- a/meta/recipes-devtools/tcltk8/tcl8/run-ptest
+++ b/meta/recipes-devtools/tcltk8/tcl8/run-ptest
@@ -1,16 +1,19 @@
 #!/bin/sh
 
-# clock.test needs a timezone to be set
-export TZ="Europe/London"
-export TCL_LIBRARY=@libdir@/tcl8/ptest/library
+set -u
+
+export LANG=en-US.UTF-8
+
+# Tell all.tcl to exit with an error code if there are failing tests
 export ERROR_ON_FAILURES=1
-export LC_ALL=en_US.UTF-8
-export LANG=en_US.UTF-8
 
 # Some tests are overly strict with timings and fail on loaded systems.
 SKIP=""
 # 15321
 SKIP="$SKIP async-\* event-\*"
+# This test behaves differently when using a system tzdata, skip until fixed 
upstream
+# 
https://core.tcl-lang.org/tcl/tktview/51aa53616067cb63900b17ca1d71f07b094ffa1a
+SKIP="$SKIP clock-59.2\*"
 # 14882
 SKIP="$SKIP cmdMZ-6.6"
 # 15081
@@ -19,6 +22,8 @@ SKIP="$SKIP exit-1.\*"
 SKIP="$SKIP \*io-46.1"
 # io-13.6 explicitly says it can fail on slow/loaded machines
 SKIP="$SKIP \*io-13.6"
+# Has race conditions and is missing cleanup
+SKIP="$SKIP interp-36.7"
 # The socket tests seem to be problematic with tight timing conditions, skip 
them all.
 # 14825 15495
 SKIP="$SKIP socket-\* socket_inet\* socket_inet6\*"
@@ -28,12 +33,19 @@ SKIP="$SKIP http11-\*"
 # tries to access google.com
 SKIP="$SKIP httpProxy-\*"
 
-for i in tests/*.test; do
-    i=$(basename $i)
-    ./tcltest tests/all.tcl -file $i -skip "$SKIP"
+# Run all tests in tests/*.test unless tests are specified as arguments
+TESTS=${*:-tests/*.test}
+
+exitcode=0
+for name in $TESTS; do
+    ./tcltest tests/all.tcl -file $(basename $name) -tmpdir /tmp -skip "$SKIP"
     if [ $? -eq 0 ]; then
-        echo "PASS: $i"
+        echo "PASS: $name"
     else
-        echo "FAIL: $i"
+        echo "FAIL: $name"
+        exitcode=1
     fi
+    echo
 done
+
+exit $exitcode
diff --git a/meta/recipes-devtools/tcltk8/tcl8_8.6.17.bb 
b/meta/recipes-devtools/tcltk8/tcl8_8.6.17.bb
index b97b20abd5..0f829a9d1b 100644
--- a/meta/recipes-devtools/tcltk8/tcl8_8.6.17.bb
+++ b/meta/recipes-devtools/tcltk8/tcl8_8.6.17.bb
@@ -21,7 +21,6 @@ SRC_URI = "${BASE_SRC_URI} \
            file://fix_non_native_build_issue.patch \
            file://tcl-remove-hardcoded-install-path.patch \
            file://alter-includedir.patch \
-           file://interp.patch \
            file://run-ptest \
            
file://0001-generic-tcl.h-use-Tcl_WideInt-for-seconds-in-Tcl_Tim.patch \
            "
@@ -84,14 +83,12 @@ do_compile_ptest() {
 
 do_install_ptest() {
        cp ${B}/tcltest ${D}${PTEST_PATH}
-       cp -r ${S}/library ${D}${PTEST_PATH}
        cp -r ${S}/tests ${D}${PTEST_PATH}
-       sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest
 }
 
 do_install_ptest:append:libc-musl () {
        # Assumes locales other than provided by musl-locales
-       sed -i '/SKIP="$SKIP socket.*$/a # unixInit-3* is suppressed due to 
hardcoded locale assumptions\nSKIP="$SKIP unixInit-3\\\*"' 
${D}${PTEST_PATH}/run-ptest
+       sed -i '/SKIP="$SKIP.*$/a # unixInit-3* is suppressed due to hardcoded 
locale assumptions\nSKIP="$SKIP unixInit-3\\\*"' ${D}${PTEST_PATH}/run-ptest
 }
 
 # Fix some paths that might be used by Tcl extensions
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#232331): 
https://lists.openembedded.org/g/openembedded-core/message/232331
Mute This Topic: https://lists.openembedded.org/mt/118117353/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to