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.
Commit
1cb0d57db1dad9db428e80019c3bacc3591cdffd814f76aa29a7d221ae701129
Parent
f04443763459083…
1 file changed
+13
+13
| --- test/amend.test | ||
| +++ test/amend.test | ||
| @@ -44,10 +44,20 @@ | ||
| 44 | 44 | regexp {checkout:\s+([0-9a-f]{40})[0-9a-f]*} $RESULT m HASH |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | # Make sure we are not in an open repository and initialize new repository |
| 48 | 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] | |
| 49 | 59 | |
| 50 | 60 | ######################################## |
| 51 | 61 | # Setup: Add file and commit # |
| 52 | 62 | ######################################## |
| 53 | 63 | |
| @@ -400,5 +410,8 @@ | ||
| 400 | 410 | test amend-null-uuid {$CODE && [string first "no such check-in" $RESULT] != -1} |
| 401 | 411 | |
| 402 | 412 | ############################################################################### |
| 403 | 413 | |
| 404 | 414 | test_cleanup |
| 415 | + | |
| 416 | +# Clean up the file descriptor | |
| 417 | +close $possibly_fd0 | |
| 405 | 418 |
| --- 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 |