Fossil SCM

The amend tests may fail on narrow terminals on systems where the terminal size can be determined when tclsh is running (for me, all but Windows). Closing stdin causes fossil not to wrap output. To avoid fossil complaining about file descriptor zero (which is now used on some systems), temproarily open the script readonly.

preben 2023-11-26 18:18 test-fixes-2.24
Commit 1cb0d57db1dad9db428e80019c3bacc3591cdffd814f76aa29a7d221ae701129
1 file changed +13
--- test/amend.test
+++ test/amend.test
@@ -44,10 +44,20 @@
4444
regexp {checkout:\s+([0-9a-f]{40})[0-9a-f]*} $RESULT m HASH
4545
}
4646
4747
# Make sure we are not in an open repository and initialize new repository
4848
test_setup
49
+
50
+# Close stdin to avoid errors on wrapped text for narrow terminals.
51
+# Closing stdin means that terminal detection returns 0 width, in turn
52
+# causing the relvant strings to be printed on a single line.
53
+close stdin
54
+
55
+# However, closing stdin makes file descriptor 0 avaailable on some systems
56
+# and/or TCL implementations, which triggers fossil to complain about opening
57
+# databases using fd 0. Avoid this by opening the script, consuming fd 0.
58
+set possibly_fd0 [open [info script] r]
4959
5060
########################################
5161
# Setup: Add file and commit #
5262
########################################
5363
@@ -400,5 +410,8 @@
400410
test amend-null-uuid {$CODE && [string first "no such check-in" $RESULT] != -1}
401411
402412
###############################################################################
403413
404414
test_cleanup
415
+
416
+# Clean up the file descriptor
417
+close $possibly_fd0
405418
--- test/amend.test
+++ test/amend.test
@@ -44,10 +44,20 @@
44 regexp {checkout:\s+([0-9a-f]{40})[0-9a-f]*} $RESULT m HASH
45 }
46
47 # Make sure we are not in an open repository and initialize new repository
48 test_setup
 
 
 
 
 
 
 
 
 
 
49
50 ########################################
51 # Setup: Add file and commit #
52 ########################################
53
@@ -400,5 +410,8 @@
400 test amend-null-uuid {$CODE && [string first "no such check-in" $RESULT] != -1}
401
402 ###############################################################################
403
404 test_cleanup
 
 
 
405
--- test/amend.test
+++ test/amend.test
@@ -44,10 +44,20 @@
44 regexp {checkout:\s+([0-9a-f]{40})[0-9a-f]*} $RESULT m HASH
45 }
46
47 # Make sure we are not in an open repository and initialize new repository
48 test_setup
49
50 # Close stdin to avoid errors on wrapped text for narrow terminals.
51 # Closing stdin means that terminal detection returns 0 width, in turn
52 # causing the relvant strings to be printed on a single line.
53 close stdin
54
55 # However, closing stdin makes file descriptor 0 avaailable on some systems
56 # and/or TCL implementations, which triggers fossil to complain about opening
57 # databases using fd 0. Avoid this by opening the script, consuming fd 0.
58 set possibly_fd0 [open [info script] r]
59
60 ########################################
61 # Setup: Add file and commit #
62 ########################################
63
@@ -400,5 +410,8 @@
410 test amend-null-uuid {$CODE && [string first "no such check-in" $RESULT] != -1}
411
412 ###############################################################################
413
414 test_cleanup
415
416 # Clean up the file descriptor
417 close $possibly_fd0
418

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button