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.
Commit
3b37f7d97b4505a168bd744b560055ca342a4f9679380b292c8be8a4c2cdd2f5
Parent
1cb0d57db1dad9d…
2 files changed
-13
+13
-13
| --- test/amend.test | ||
| +++ test/amend.test | ||
| @@ -45,20 +45,10 @@ | ||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | # Make sure we are not in an open repository and initialize new repository |
| 48 | 48 | test_setup |
| 49 | 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 | 50 | ######################################## |
| 61 | 51 | # Setup: Add file and commit # |
| 62 | 52 | ######################################## |
| 63 | 53 | |
| 64 | 54 | if {![uuid_from_checkout HASHINIT]} { |
| @@ -410,8 +400,5 @@ | ||
| 410 | 400 | test amend-null-uuid {$CODE && [string first "no such check-in" $RESULT] != -1} |
| 411 | 401 | |
| 412 | 402 | ############################################################################### |
| 413 | 403 | |
| 414 | 404 | test_cleanup |
| 415 | - | |
| 416 | -# Clean up the file descriptor | |
| 417 | -close $possibly_fd0 | |
| 418 | 405 |
| --- 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 |
+13
| --- test/tester.tcl | ||
| +++ test/tester.tcl | ||
| @@ -1086,10 +1086,19 @@ | ||
| 1086 | 1086 | please set TEMP variable in environment, error: $error" |
| 1087 | 1087 | } |
| 1088 | 1088 | |
| 1089 | 1089 | set tempHomePath [file join $tempPath home_[pid]] |
| 1090 | 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 | + | |
| 1091 | 1100 | if {[catch { |
| 1092 | 1101 | file mkdir $tempHomePath |
| 1093 | 1102 | } error] != 0} { |
| 1094 | 1103 | error "Could not make directory \"$tempHomePath\",\ |
| 1095 | 1104 | please set TEMP variable in environment, error: $error" |
| @@ -1108,10 +1117,14 @@ | ||
| 1108 | 1117 | test test-framework-$testfile 1 |
| 1109 | 1118 | } |
| 1110 | 1119 | protOut "***** End of $testfile: [llength $bad_test] errors so far ******" |
| 1111 | 1120 | } |
| 1112 | 1121 | unset ::tempKeepHome; delete_temporary_home |
| 1122 | + | |
| 1123 | +# Clean up the file descriptor | |
| 1124 | +close $possibly_fd0 | |
| 1125 | + | |
| 1113 | 1126 | set nErr [llength $bad_test] |
| 1114 | 1127 | if {$nErr>0 || !$::QUIET} { |
| 1115 | 1128 | protOut "***** Final results: $nErr errors out of $test_count tests" 1 |
| 1116 | 1129 | } |
| 1117 | 1130 | if {$nErr>0} { |
| 1118 | 1131 |
| --- 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 |