Fossil SCM

Fix previous commit: Just fixing amend breaks subsequent tests. As tests should not need input, move the code to the test/tester.tcl.

preben 2023-11-26 19:07 test-fixes-2.24
Commit 3b37f7d97b4505a168bd744b560055ca342a4f9679380b292c8be8a4c2cdd2f5
--- test/amend.test
+++ test/amend.test
@@ -45,20 +45,10 @@
4545
}
4646
4747
# Make sure we are not in an open repository and initialize new repository
4848
test_setup
4949
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
-
6050
########################################
6151
# Setup: Add file and commit #
6252
########################################
6353
6454
if {![uuid_from_checkout HASHINIT]} {
@@ -410,8 +400,5 @@
410400
test amend-null-uuid {$CODE && [string first "no such check-in" $RESULT] != -1}
411401
412402
###############################################################################
413403
414404
test_cleanup
415
-
416
-# Clean up the file descriptor
417
-close $possibly_fd0
418405
--- test/amend.test
+++ test/amend.test
@@ -45,20 +45,10 @@
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
64 if {![uuid_from_checkout HASHINIT]} {
@@ -410,8 +400,5 @@
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
--- test/amend.test
+++ test/amend.test
@@ -45,20 +45,10 @@
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
54 if {![uuid_from_checkout HASHINIT]} {
@@ -410,8 +400,5 @@
400 test amend-null-uuid {$CODE && [string first "no such check-in" $RESULT] != -1}
401
402 ###############################################################################
403
404 test_cleanup
 
 
 
405
--- test/tester.tcl
+++ test/tester.tcl
@@ -1086,10 +1086,19 @@
10861086
please set TEMP variable in environment, error: $error"
10871087
}
10881088
10891089
set tempHomePath [file join $tempPath home_[pid]]
10901090
1091
+# Close stdin to avoid errors on wrapped text for narrow terminals.
1092
+# Closing stdin means that terminal detection returns 0 width, in turn
1093
+# causing the relvant strings to be printed on a single line.
1094
+# However, closing stdin makes file descriptor 0 avaailable on some systems
1095
+# and/or TCL implementations, which triggers fossil to complain about opening
1096
+# databases using fd 0. Avoid this by opening the script, consuming fd 0.
1097
+close stdin
1098
+set possibly_fd0 [open [info script] r]
1099
+
10911100
if {[catch {
10921101
file mkdir $tempHomePath
10931102
} error] != 0} {
10941103
error "Could not make directory \"$tempHomePath\",\
10951104
please set TEMP variable in environment, error: $error"
@@ -1108,10 +1117,14 @@
11081117
test test-framework-$testfile 1
11091118
}
11101119
protOut "***** End of $testfile: [llength $bad_test] errors so far ******"
11111120
}
11121121
unset ::tempKeepHome; delete_temporary_home
1122
+
1123
+# Clean up the file descriptor
1124
+close $possibly_fd0
1125
+
11131126
set nErr [llength $bad_test]
11141127
if {$nErr>0 || !$::QUIET} {
11151128
protOut "***** Final results: $nErr errors out of $test_count tests" 1
11161129
}
11171130
if {$nErr>0} {
11181131
--- test/tester.tcl
+++ test/tester.tcl
@@ -1086,10 +1086,19 @@
1086 please set TEMP variable in environment, error: $error"
1087 }
1088
1089 set tempHomePath [file join $tempPath home_[pid]]
1090
 
 
 
 
 
 
 
 
 
1091 if {[catch {
1092 file mkdir $tempHomePath
1093 } error] != 0} {
1094 error "Could not make directory \"$tempHomePath\",\
1095 please set TEMP variable in environment, error: $error"
@@ -1108,10 +1117,14 @@
1108 test test-framework-$testfile 1
1109 }
1110 protOut "***** End of $testfile: [llength $bad_test] errors so far ******"
1111 }
1112 unset ::tempKeepHome; delete_temporary_home
 
 
 
 
1113 set nErr [llength $bad_test]
1114 if {$nErr>0 || !$::QUIET} {
1115 protOut "***** Final results: $nErr errors out of $test_count tests" 1
1116 }
1117 if {$nErr>0} {
1118
--- test/tester.tcl
+++ test/tester.tcl
@@ -1086,10 +1086,19 @@
1086 please set TEMP variable in environment, error: $error"
1087 }
1088
1089 set tempHomePath [file join $tempPath home_[pid]]
1090
1091 # Close stdin to avoid errors on wrapped text for narrow terminals.
1092 # Closing stdin means that terminal detection returns 0 width, in turn
1093 # causing the relvant strings to be printed on a single line.
1094 # However, closing stdin makes file descriptor 0 avaailable on some systems
1095 # and/or TCL implementations, which triggers fossil to complain about opening
1096 # databases using fd 0. Avoid this by opening the script, consuming fd 0.
1097 close stdin
1098 set possibly_fd0 [open [info script] r]
1099
1100 if {[catch {
1101 file mkdir $tempHomePath
1102 } error] != 0} {
1103 error "Could not make directory \"$tempHomePath\",\
1104 please set TEMP variable in environment, error: $error"
@@ -1108,10 +1117,14 @@
1117 test test-framework-$testfile 1
1118 }
1119 protOut "***** End of $testfile: [llength $bad_test] errors so far ******"
1120 }
1121 unset ::tempKeepHome; delete_temporary_home
1122
1123 # Clean up the file descriptor
1124 close $possibly_fd0
1125
1126 set nErr [llength $bad_test]
1127 if {$nErr>0 || !$::QUIET} {
1128 protOut "***** Final results: $nErr errors out of $test_count tests" 1
1129 }
1130 if {$nErr>0} {
1131

Keyboard Shortcuts

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