Fossil SCM
Cleanup, modularize, and robustify all test setup and cleanup.
Commit
fa5922169348382d82571233252606a77f6f2234
Parent
93f514ca2c4532e…
28 files changed
+14
-4
+14
-4
+7
-3
+5
-1
+6
+8
+6
+6
+5
-1
+6
+10
-4
+6
+6
+6
+6
+5
-9
+5
-1
+9
-9
+6
-8
+8
-9
+15
-16
+202
-30
+15
-5
+12
-4
+6
-8
+11
-6
+6
-2
+6
~
src/main.mk
~
src/makemake.tcl
~
test/amend.test
~
test/clean.test
~
test/cmdline.test
~
test/comment.test
~
test/contains-selector.test
~
test/delta1.test
~
test/file1.test
~
test/glob.test
~
test/json.test
~
test/merge1.test
~
test/merge2.test
~
test/merge3.test
~
test/merge4.test
~
test/merge5.test
~
test/merge6.test
~
test/merge_renames.test
~
test/mv-rm.test
~
test/revert.test
~
test/stash.test
~
test/tester.tcl
~
test/th1-docs.test
~
test/th1-hooks.test
~
test/th1-repo.test
~
test/th1-tcl.test
~
test/th1.test
~
test/utf.test
+14
-4
| --- src/main.mk | ||
| +++ src/main.mk | ||
| @@ -459,15 +459,25 @@ | ||
| 459 | 459 | $(BCC) -o $(OBJDIR)/mkversion $(SRCDIR)/mkversion.c |
| 460 | 460 | |
| 461 | 461 | $(OBJDIR)/codecheck1: $(SRCDIR)/codecheck1.c |
| 462 | 462 | $(BCC) -o $(OBJDIR)/codecheck1 $(SRCDIR)/codecheck1.c |
| 463 | 463 | |
| 464 | -# WARNING. DANGER. Running the test suite modifies the repository the | |
| 465 | -# build is done from, i.e. the checkout belongs to. Do not sync/push | |
| 466 | -# the repository after running the tests. | |
| 464 | +# Run the test suite. | |
| 465 | +# Other flags that can be included in TESTFLAGS are: | |
| 466 | +# | |
| 467 | +# -halt Stop testing after the first failed test | |
| 468 | +# -keep Keep the temporary workspace for debugging | |
| 469 | +# -prot Write a detailed log of the tests to the file ./prot | |
| 470 | +# -verbose Include even more details in the output | |
| 471 | +# -quiet Hide most output from the terminal | |
| 472 | +# -strict Treat known bugs as failures | |
| 473 | +# | |
| 474 | +# TESTFLAGS can also include names of specific test files to limit | |
| 475 | +# the run to just those test cases. | |
| 476 | +# | |
| 467 | 477 | test: $(OBJDIR) $(APPNAME) |
| 468 | - $(TCLSH) $(SRCDIR)/../test/tester.tcl $(APPNAME) | |
| 478 | + $(TCLSH) $(SRCDIR)/../test/tester.tcl $(APPNAME) -quiet $(TESTFLAGS) | |
| 469 | 479 | |
| 470 | 480 | $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION $(OBJDIR)/mkversion |
| 471 | 481 | $(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h |
| 472 | 482 | |
| 473 | 483 | # Setup the options used to compile the included SQLite library. |
| 474 | 484 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -459,15 +459,25 @@ | |
| 459 | $(BCC) -o $(OBJDIR)/mkversion $(SRCDIR)/mkversion.c |
| 460 | |
| 461 | $(OBJDIR)/codecheck1: $(SRCDIR)/codecheck1.c |
| 462 | $(BCC) -o $(OBJDIR)/codecheck1 $(SRCDIR)/codecheck1.c |
| 463 | |
| 464 | # WARNING. DANGER. Running the test suite modifies the repository the |
| 465 | # build is done from, i.e. the checkout belongs to. Do not sync/push |
| 466 | # the repository after running the tests. |
| 467 | test: $(OBJDIR) $(APPNAME) |
| 468 | $(TCLSH) $(SRCDIR)/../test/tester.tcl $(APPNAME) |
| 469 | |
| 470 | $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION $(OBJDIR)/mkversion |
| 471 | $(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h |
| 472 | |
| 473 | # Setup the options used to compile the included SQLite library. |
| 474 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -459,15 +459,25 @@ | |
| 459 | $(BCC) -o $(OBJDIR)/mkversion $(SRCDIR)/mkversion.c |
| 460 | |
| 461 | $(OBJDIR)/codecheck1: $(SRCDIR)/codecheck1.c |
| 462 | $(BCC) -o $(OBJDIR)/codecheck1 $(SRCDIR)/codecheck1.c |
| 463 | |
| 464 | # Run the test suite. |
| 465 | # Other flags that can be included in TESTFLAGS are: |
| 466 | # |
| 467 | # -halt Stop testing after the first failed test |
| 468 | # -keep Keep the temporary workspace for debugging |
| 469 | # -prot Write a detailed log of the tests to the file ./prot |
| 470 | # -verbose Include even more details in the output |
| 471 | # -quiet Hide most output from the terminal |
| 472 | # -strict Treat known bugs as failures |
| 473 | # |
| 474 | # TESTFLAGS can also include names of specific test files to limit |
| 475 | # the run to just those test cases. |
| 476 | # |
| 477 | test: $(OBJDIR) $(APPNAME) |
| 478 | $(TCLSH) $(SRCDIR)/../test/tester.tcl $(APPNAME) -quiet $(TESTFLAGS) |
| 479 | |
| 480 | $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION $(OBJDIR)/mkversion |
| 481 | $(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h |
| 482 | |
| 483 | # Setup the options used to compile the included SQLite library. |
| 484 |
+14
-4
| --- src/makemake.tcl | ||
| +++ src/makemake.tcl | ||
| @@ -303,15 +303,25 @@ | ||
| 303 | 303 | $(BCC) -o $(OBJDIR)/mkversion $(SRCDIR)/mkversion.c |
| 304 | 304 | |
| 305 | 305 | $(OBJDIR)/codecheck1: $(SRCDIR)/codecheck1.c |
| 306 | 306 | $(BCC) -o $(OBJDIR)/codecheck1 $(SRCDIR)/codecheck1.c |
| 307 | 307 | |
| 308 | -# WARNING. DANGER. Running the test suite modifies the repository the | |
| 309 | -# build is done from, i.e. the checkout belongs to. Do not sync/push | |
| 310 | -# the repository after running the tests. | |
| 308 | +# Run the test suite. | |
| 309 | +# Other flags that can be included in TESTFLAGS are: | |
| 310 | +# | |
| 311 | +# -halt Stop testing after the first failed test | |
| 312 | +# -keep Keep the temporary workspace for debugging | |
| 313 | +# -prot Write a detailed log of the tests to the file ./prot | |
| 314 | +# -verbose Include even more details in the output | |
| 315 | +# -quiet Hide most output from the terminal | |
| 316 | +# -strict Treat known bugs as failures | |
| 317 | +# | |
| 318 | +# TESTFLAGS can also include names of specific test files to limit | |
| 319 | +# the run to just those test cases. | |
| 320 | +# | |
| 311 | 321 | test: $(OBJDIR) $(APPNAME) |
| 312 | - $(TCLSH) $(SRCDIR)/../test/tester.tcl $(APPNAME) | |
| 322 | + $(TCLSH) $(SRCDIR)/../test/tester.tcl $(APPNAME) -quiet $(TESTFLAGS) | |
| 313 | 323 | |
| 314 | 324 | $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION $(OBJDIR)/mkversion |
| 315 | 325 | $(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid \ |
| 316 | 326 | $(SRCDIR)/../manifest \ |
| 317 | 327 | $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h |
| 318 | 328 |
| --- src/makemake.tcl | |
| +++ src/makemake.tcl | |
| @@ -303,15 +303,25 @@ | |
| 303 | $(BCC) -o $(OBJDIR)/mkversion $(SRCDIR)/mkversion.c |
| 304 | |
| 305 | $(OBJDIR)/codecheck1: $(SRCDIR)/codecheck1.c |
| 306 | $(BCC) -o $(OBJDIR)/codecheck1 $(SRCDIR)/codecheck1.c |
| 307 | |
| 308 | # WARNING. DANGER. Running the test suite modifies the repository the |
| 309 | # build is done from, i.e. the checkout belongs to. Do not sync/push |
| 310 | # the repository after running the tests. |
| 311 | test: $(OBJDIR) $(APPNAME) |
| 312 | $(TCLSH) $(SRCDIR)/../test/tester.tcl $(APPNAME) |
| 313 | |
| 314 | $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION $(OBJDIR)/mkversion |
| 315 | $(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid \ |
| 316 | $(SRCDIR)/../manifest \ |
| 317 | $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h |
| 318 |
| --- src/makemake.tcl | |
| +++ src/makemake.tcl | |
| @@ -303,15 +303,25 @@ | |
| 303 | $(BCC) -o $(OBJDIR)/mkversion $(SRCDIR)/mkversion.c |
| 304 | |
| 305 | $(OBJDIR)/codecheck1: $(SRCDIR)/codecheck1.c |
| 306 | $(BCC) -o $(OBJDIR)/codecheck1 $(SRCDIR)/codecheck1.c |
| 307 | |
| 308 | # Run the test suite. |
| 309 | # Other flags that can be included in TESTFLAGS are: |
| 310 | # |
| 311 | # -halt Stop testing after the first failed test |
| 312 | # -keep Keep the temporary workspace for debugging |
| 313 | # -prot Write a detailed log of the tests to the file ./prot |
| 314 | # -verbose Include even more details in the output |
| 315 | # -quiet Hide most output from the terminal |
| 316 | # -strict Treat known bugs as failures |
| 317 | # |
| 318 | # TESTFLAGS can also include names of specific test files to limit |
| 319 | # the run to just those test cases. |
| 320 | # |
| 321 | test: $(OBJDIR) $(APPNAME) |
| 322 | $(TCLSH) $(SRCDIR)/../test/tester.tcl $(APPNAME) -quiet $(TESTFLAGS) |
| 323 | |
| 324 | $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION $(OBJDIR)/mkversion |
| 325 | $(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid \ |
| 326 | $(SRCDIR)/../manifest \ |
| 327 | $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h |
| 328 |
+7
-3
| --- test/amend.test | ||
| +++ test/amend.test | ||
| @@ -47,26 +47,26 @@ | ||
| 47 | 47 | fossil status |
| 48 | 48 | regexp {checkout:\s+([0-9a-f]{40})} $RESULT m UUID |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | # Make sure we are not in an open repository and initialize new repository |
| 52 | -repo_init | |
| 52 | +test_setup | |
| 53 | 53 | |
| 54 | 54 | ######################################## |
| 55 | 55 | # Setup: Add file and commit # |
| 56 | 56 | ######################################## |
| 57 | 57 | |
| 58 | 58 | if {![uuid_from_checkout UUIDINIT]} { |
| 59 | 59 | test amend-checkout-failure false |
| 60 | - return | |
| 60 | + test_cleanup_then_return | |
| 61 | 61 | } |
| 62 | 62 | write_file datafile "data" |
| 63 | 63 | fossil add datafile |
| 64 | 64 | fossil commit -m "c1" |
| 65 | 65 | if {![uuid_from_commit $RESULT UUID]} { |
| 66 | 66 | test amend-setup-failure false |
| 67 | - return | |
| 67 | + test_cleanup_then_return | |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | ######################################## |
| 71 | 71 | # Test: -branch # |
| 72 | 72 | ######################################## |
| @@ -401,5 +401,9 @@ | ||
| 401 | 401 | ######################################## |
| 402 | 402 | # Test: NULL UUID # |
| 403 | 403 | ######################################## |
| 404 | 404 | fossil amend {} -close -expectError |
| 405 | 405 | test amend-null-uuid {$CODE && [string first "no such check-in" $RESULT] != -1} |
| 406 | + | |
| 407 | +############################################################################### | |
| 408 | + | |
| 409 | +test_cleanup | |
| 406 | 410 |
| --- test/amend.test | |
| +++ test/amend.test | |
| @@ -47,26 +47,26 @@ | |
| 47 | fossil status |
| 48 | regexp {checkout:\s+([0-9a-f]{40})} $RESULT m UUID |
| 49 | } |
| 50 | |
| 51 | # Make sure we are not in an open repository and initialize new repository |
| 52 | repo_init |
| 53 | |
| 54 | ######################################## |
| 55 | # Setup: Add file and commit # |
| 56 | ######################################## |
| 57 | |
| 58 | if {![uuid_from_checkout UUIDINIT]} { |
| 59 | test amend-checkout-failure false |
| 60 | return |
| 61 | } |
| 62 | write_file datafile "data" |
| 63 | fossil add datafile |
| 64 | fossil commit -m "c1" |
| 65 | if {![uuid_from_commit $RESULT UUID]} { |
| 66 | test amend-setup-failure false |
| 67 | return |
| 68 | } |
| 69 | |
| 70 | ######################################## |
| 71 | # Test: -branch # |
| 72 | ######################################## |
| @@ -401,5 +401,9 @@ | |
| 401 | ######################################## |
| 402 | # Test: NULL UUID # |
| 403 | ######################################## |
| 404 | fossil amend {} -close -expectError |
| 405 | test amend-null-uuid {$CODE && [string first "no such check-in" $RESULT] != -1} |
| 406 |
| --- test/amend.test | |
| +++ test/amend.test | |
| @@ -47,26 +47,26 @@ | |
| 47 | fossil status |
| 48 | regexp {checkout:\s+([0-9a-f]{40})} $RESULT m UUID |
| 49 | } |
| 50 | |
| 51 | # Make sure we are not in an open repository and initialize new repository |
| 52 | test_setup |
| 53 | |
| 54 | ######################################## |
| 55 | # Setup: Add file and commit # |
| 56 | ######################################## |
| 57 | |
| 58 | if {![uuid_from_checkout UUIDINIT]} { |
| 59 | test amend-checkout-failure false |
| 60 | test_cleanup_then_return |
| 61 | } |
| 62 | write_file datafile "data" |
| 63 | fossil add datafile |
| 64 | fossil commit -m "c1" |
| 65 | if {![uuid_from_commit $RESULT UUID]} { |
| 66 | test amend-setup-failure false |
| 67 | test_cleanup_then_return |
| 68 | } |
| 69 | |
| 70 | ######################################## |
| 71 | # Test: -branch # |
| 72 | ######################################## |
| @@ -401,5 +401,9 @@ | |
| 401 | ######################################## |
| 402 | # Test: NULL UUID # |
| 403 | ######################################## |
| 404 | fossil amend {} -close -expectError |
| 405 | test amend-null-uuid {$CODE && [string first "no such check-in" $RESULT] != -1} |
| 406 | |
| 407 | ############################################################################### |
| 408 | |
| 409 | test_cleanup |
| 410 |
+5
-1
| --- test/clean.test | ||
| +++ test/clean.test | ||
| @@ -16,11 +16,11 @@ | ||
| 16 | 16 | ############################################################################ |
| 17 | 17 | # |
| 18 | 18 | # Tests of the "clean" command, including the ability to undo it. |
| 19 | 19 | # |
| 20 | 20 | |
| 21 | -repo_init | |
| 21 | +test_setup | |
| 22 | 22 | |
| 23 | 23 | ############################################################################### |
| 24 | 24 | |
| 25 | 25 | fossil extra |
| 26 | 26 | test clean-0 {[normalize_result] eq {}} |
| @@ -185,5 +185,9 @@ | ||
| 185 | 185 | |
| 186 | 186 | ############################################################################### |
| 187 | 187 | |
| 188 | 188 | fossil extra |
| 189 | 189 | test clean-31 {[normalize_result] eq {}} |
| 190 | + | |
| 191 | +############################################################################### | |
| 192 | + | |
| 193 | +test_cleanup | |
| 190 | 194 |
| --- test/clean.test | |
| +++ test/clean.test | |
| @@ -16,11 +16,11 @@ | |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Tests of the "clean" command, including the ability to undo it. |
| 19 | # |
| 20 | |
| 21 | repo_init |
| 22 | |
| 23 | ############################################################################### |
| 24 | |
| 25 | fossil extra |
| 26 | test clean-0 {[normalize_result] eq {}} |
| @@ -185,5 +185,9 @@ | |
| 185 | |
| 186 | ############################################################################### |
| 187 | |
| 188 | fossil extra |
| 189 | test clean-31 {[normalize_result] eq {}} |
| 190 |
| --- test/clean.test | |
| +++ test/clean.test | |
| @@ -16,11 +16,11 @@ | |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Tests of the "clean" command, including the ability to undo it. |
| 19 | # |
| 20 | |
| 21 | test_setup |
| 22 | |
| 23 | ############################################################################### |
| 24 | |
| 25 | fossil extra |
| 26 | test clean-0 {[normalize_result] eq {}} |
| @@ -185,5 +185,9 @@ | |
| 185 | |
| 186 | ############################################################################### |
| 187 | |
| 188 | fossil extra |
| 189 | test clean-31 {[normalize_result] eq {}} |
| 190 | |
| 191 | ############################################################################### |
| 192 | |
| 193 | test_cleanup |
| 194 |
+6
| --- test/cmdline.test | ||
| +++ test/cmdline.test | ||
| @@ -15,10 +15,12 @@ | ||
| 15 | 15 | # |
| 16 | 16 | ############################################################################ |
| 17 | 17 | # |
| 18 | 18 | # Test command line parsing |
| 19 | 19 | # |
| 20 | + | |
| 21 | +test_setup "" | |
| 20 | 22 | |
| 21 | 23 | proc cmd-line {testname args} { |
| 22 | 24 | set i 1 |
| 23 | 25 | foreach {cmdline result} $args { |
| 24 | 26 | fossil test-echo $cmdline |
| @@ -26,5 +28,9 @@ | ||
| 26 | 28 | incr i |
| 27 | 29 | } |
| 28 | 30 | } |
| 29 | 31 | cmd-line 100 abc abc a\"bc a\"bc \"abc\" \"abc\" |
| 30 | 32 | cmd-line 101 * * *.* *.* |
| 33 | + | |
| 34 | +############################################################################### | |
| 35 | + | |
| 36 | +test_cleanup | |
| 31 | 37 |
| --- test/cmdline.test | |
| +++ test/cmdline.test | |
| @@ -15,10 +15,12 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Test command line parsing |
| 19 | # |
| 20 | |
| 21 | proc cmd-line {testname args} { |
| 22 | set i 1 |
| 23 | foreach {cmdline result} $args { |
| 24 | fossil test-echo $cmdline |
| @@ -26,5 +28,9 @@ | |
| 26 | incr i |
| 27 | } |
| 28 | } |
| 29 | cmd-line 100 abc abc a\"bc a\"bc \"abc\" \"abc\" |
| 30 | cmd-line 101 * * *.* *.* |
| 31 |
| --- test/cmdline.test | |
| +++ test/cmdline.test | |
| @@ -15,10 +15,12 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Test command line parsing |
| 19 | # |
| 20 | |
| 21 | test_setup "" |
| 22 | |
| 23 | proc cmd-line {testname args} { |
| 24 | set i 1 |
| 25 | foreach {cmdline result} $args { |
| 26 | fossil test-echo $cmdline |
| @@ -26,5 +28,9 @@ | |
| 28 | incr i |
| 29 | } |
| 30 | } |
| 31 | cmd-line 100 abc abc a\"bc a\"bc \"abc\" \"abc\" |
| 32 | cmd-line 101 * * *.* *.* |
| 33 | |
| 34 | ############################################################################### |
| 35 | |
| 36 | test_cleanup |
| 37 |
+8
| --- test/comment.test | ||
| +++ test/comment.test | ||
| @@ -16,10 +16,14 @@ | ||
| 16 | 16 | ############################################################################ |
| 17 | 17 | # |
| 18 | 18 | # Test comment formatting and printing. |
| 19 | 19 | # |
| 20 | 20 | |
| 21 | +test_setup "" | |
| 22 | + | |
| 23 | +############################################################################### | |
| 24 | + | |
| 21 | 25 | fossil test-comment-format "" "" |
| 22 | 26 | test comment-1 {$RESULT eq "\n(1 lines output)"} |
| 23 | 27 | |
| 24 | 28 | ############################################################################### |
| 25 | 29 | |
| @@ -314,5 +318,9 @@ | ||
| 314 | 318 | |
| 315 | 319 | ############################################################################### |
| 316 | 320 | |
| 317 | 321 | fossil test-comment-format --width 81 --indent 9 --decode --trimcrlf --origbreak "00:00:00 " "\[0000000000\] *CURRENT* $orig" $orig |
| 318 | 322 | test comment-60 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \n xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(6 lines output)"} |
| 323 | + | |
| 324 | +############################################################################### | |
| 325 | + | |
| 326 | +test_cleanup | |
| 319 | 327 |
| --- test/comment.test | |
| +++ test/comment.test | |
| @@ -16,10 +16,14 @@ | |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Test comment formatting and printing. |
| 19 | # |
| 20 | |
| 21 | fossil test-comment-format "" "" |
| 22 | test comment-1 {$RESULT eq "\n(1 lines output)"} |
| 23 | |
| 24 | ############################################################################### |
| 25 | |
| @@ -314,5 +318,9 @@ | |
| 314 | |
| 315 | ############################################################################### |
| 316 | |
| 317 | fossil test-comment-format --width 81 --indent 9 --decode --trimcrlf --origbreak "00:00:00 " "\[0000000000\] *CURRENT* $orig" $orig |
| 318 | test comment-60 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \n xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(6 lines output)"} |
| 319 |
| --- test/comment.test | |
| +++ test/comment.test | |
| @@ -16,10 +16,14 @@ | |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Test comment formatting and printing. |
| 19 | # |
| 20 | |
| 21 | test_setup "" |
| 22 | |
| 23 | ############################################################################### |
| 24 | |
| 25 | fossil test-comment-format "" "" |
| 26 | test comment-1 {$RESULT eq "\n(1 lines output)"} |
| 27 | |
| 28 | ############################################################################### |
| 29 | |
| @@ -314,5 +318,9 @@ | |
| 318 | |
| 319 | ############################################################################### |
| 320 | |
| 321 | fossil test-comment-format --width 81 --indent 9 --decode --trimcrlf --origbreak "00:00:00 " "\[0000000000\] *CURRENT* $orig" $orig |
| 322 | test comment-60 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \n xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(6 lines output)"} |
| 323 | |
| 324 | ############################################################################### |
| 325 | |
| 326 | test_cleanup |
| 327 |
| --- test/contains-selector.test | ||
| +++ test/contains-selector.test | ||
| @@ -15,10 +15,12 @@ | ||
| 15 | 15 | # |
| 16 | 16 | ############################################################################ |
| 17 | 17 | # |
| 18 | 18 | # Test containsSelector() function in src/style.c |
| 19 | 19 | # |
| 20 | + | |
| 21 | +test_setup "" | |
| 20 | 22 | |
| 21 | 23 | proc contains-selector {testId css selectorResultMap} { |
| 22 | 24 | set css [string trim $css] |
| 23 | 25 | set filename [file join $::tempPath compare-selector.css] |
| 24 | 26 | set fh [open $filename w] |
| @@ -45,5 +47,9 @@ | ||
| 45 | 47 | .d 0 |
| 46 | 48 | {.c.d} 0 |
| 47 | 49 | {.c .d} 1 |
| 48 | 50 | .e 1 |
| 49 | 51 | } |
| 52 | + | |
| 53 | +############################################################################### | |
| 54 | + | |
| 55 | +test_cleanup | |
| 50 | 56 |
| --- test/contains-selector.test | |
| +++ test/contains-selector.test | |
| @@ -15,10 +15,12 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Test containsSelector() function in src/style.c |
| 19 | # |
| 20 | |
| 21 | proc contains-selector {testId css selectorResultMap} { |
| 22 | set css [string trim $css] |
| 23 | set filename [file join $::tempPath compare-selector.css] |
| 24 | set fh [open $filename w] |
| @@ -45,5 +47,9 @@ | |
| 45 | .d 0 |
| 46 | {.c.d} 0 |
| 47 | {.c .d} 1 |
| 48 | .e 1 |
| 49 | } |
| 50 |
| --- test/contains-selector.test | |
| +++ test/contains-selector.test | |
| @@ -15,10 +15,12 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Test containsSelector() function in src/style.c |
| 19 | # |
| 20 | |
| 21 | test_setup "" |
| 22 | |
| 23 | proc contains-selector {testId css selectorResultMap} { |
| 24 | set css [string trim $css] |
| 25 | set filename [file join $::tempPath compare-selector.css] |
| 26 | set fh [open $filename w] |
| @@ -45,5 +47,9 @@ | |
| 47 | .d 0 |
| 48 | {.c.d} 0 |
| 49 | {.c .d} 1 |
| 50 | .e 1 |
| 51 | } |
| 52 | |
| 53 | ############################################################################### |
| 54 | |
| 55 | test_cleanup |
| 56 |
+6
| --- test/delta1.test | ||
| +++ test/delta1.test | ||
| @@ -15,10 +15,12 @@ | ||
| 15 | 15 | # |
| 16 | 16 | ############################################################################ |
| 17 | 17 | # |
| 18 | 18 | # Tests of the delta mechanism. |
| 19 | 19 | # |
| 20 | + | |
| 21 | +test_setup "" | |
| 20 | 22 | |
| 21 | 23 | # Use test script files as the basis for this test. |
| 22 | 24 | # |
| 23 | 25 | # For each test, copy the file intact to "./t1". Make |
| 24 | 26 | # some random changes in "./t2". Then call test-delta on the |
| @@ -41,5 +43,9 @@ | ||
| 41 | 43 | write_file t2 [random_changes $f1 1 1 0 0.4] |
| 42 | 44 | fossil test-delta t1 t2 |
| 43 | 45 | test delta-$base-$i-3 {$RESULT=="ok"} |
| 44 | 46 | } |
| 45 | 47 | } |
| 48 | + | |
| 49 | +############################################################################### | |
| 50 | + | |
| 51 | +test_cleanup | |
| 46 | 52 |
| --- test/delta1.test | |
| +++ test/delta1.test | |
| @@ -15,10 +15,12 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Tests of the delta mechanism. |
| 19 | # |
| 20 | |
| 21 | # Use test script files as the basis for this test. |
| 22 | # |
| 23 | # For each test, copy the file intact to "./t1". Make |
| 24 | # some random changes in "./t2". Then call test-delta on the |
| @@ -41,5 +43,9 @@ | |
| 41 | write_file t2 [random_changes $f1 1 1 0 0.4] |
| 42 | fossil test-delta t1 t2 |
| 43 | test delta-$base-$i-3 {$RESULT=="ok"} |
| 44 | } |
| 45 | } |
| 46 |
| --- test/delta1.test | |
| +++ test/delta1.test | |
| @@ -15,10 +15,12 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Tests of the delta mechanism. |
| 19 | # |
| 20 | |
| 21 | test_setup "" |
| 22 | |
| 23 | # Use test script files as the basis for this test. |
| 24 | # |
| 25 | # For each test, copy the file intact to "./t1". Make |
| 26 | # some random changes in "./t2". Then call test-delta on the |
| @@ -41,5 +43,9 @@ | |
| 43 | write_file t2 [random_changes $f1 1 1 0 0.4] |
| 44 | fossil test-delta t1 t2 |
| 45 | test delta-$base-$i-3 {$RESULT=="ok"} |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | ############################################################################### |
| 50 | |
| 51 | test_cleanup |
| 52 |
+5
-1
| --- test/file1.test | ||
| +++ test/file1.test | ||
| @@ -16,11 +16,11 @@ | ||
| 16 | 16 | ############################################################################ |
| 17 | 17 | # |
| 18 | 18 | # File utilities |
| 19 | 19 | # |
| 20 | 20 | |
| 21 | -repo_init | |
| 21 | +test_setup | |
| 22 | 22 | |
| 23 | 23 | proc simplify-name {testname args} { |
| 24 | 24 | set i 1 |
| 25 | 25 | foreach {path result} $args { |
| 26 | 26 | fossil test-simplify-name $path |
| @@ -96,5 +96,9 @@ | ||
| 96 | 96 | |
| 97 | 97 | catch {file delete test1/test2} |
| 98 | 98 | catch {file delete test1} |
| 99 | 99 | |
| 100 | 100 | if {[info exists savedPwd]} {cd $savedPwd; unset savedPwd} |
| 101 | + | |
| 102 | +############################################################################### | |
| 103 | + | |
| 104 | +test_cleanup | |
| 101 | 105 |
| --- test/file1.test | |
| +++ test/file1.test | |
| @@ -16,11 +16,11 @@ | |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # File utilities |
| 19 | # |
| 20 | |
| 21 | repo_init |
| 22 | |
| 23 | proc simplify-name {testname args} { |
| 24 | set i 1 |
| 25 | foreach {path result} $args { |
| 26 | fossil test-simplify-name $path |
| @@ -96,5 +96,9 @@ | |
| 96 | |
| 97 | catch {file delete test1/test2} |
| 98 | catch {file delete test1} |
| 99 | |
| 100 | if {[info exists savedPwd]} {cd $savedPwd; unset savedPwd} |
| 101 |
| --- test/file1.test | |
| +++ test/file1.test | |
| @@ -16,11 +16,11 @@ | |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # File utilities |
| 19 | # |
| 20 | |
| 21 | test_setup |
| 22 | |
| 23 | proc simplify-name {testname args} { |
| 24 | set i 1 |
| 25 | foreach {path result} $args { |
| 26 | fossil test-simplify-name $path |
| @@ -96,5 +96,9 @@ | |
| 96 | |
| 97 | catch {file delete test1/test2} |
| 98 | catch {file delete test1} |
| 99 | |
| 100 | if {[info exists savedPwd]} {cd $savedPwd; unset savedPwd} |
| 101 | |
| 102 | ############################################################################### |
| 103 | |
| 104 | test_cleanup |
| 105 |
+6
| --- test/glob.test | ||
| +++ test/glob.test | ||
| @@ -15,10 +15,12 @@ | ||
| 15 | 15 | # |
| 16 | 16 | ############################################################################ |
| 17 | 17 | # |
| 18 | 18 | # Test glob pattern parsing |
| 19 | 19 | # |
| 20 | + | |
| 21 | +test_setup "" | |
| 20 | 22 | |
| 21 | 23 | proc glob-parse {testname args} { |
| 22 | 24 | set i 1 |
| 23 | 25 | foreach {pattern string result} $args { |
| 24 | 26 | fossil test-glob $pattern $string |
| @@ -180,5 +182,9 @@ | ||
| 180 | 182 | glob-parse 119 "'o*,two three,four'" "one,two three,four" \ |
| 181 | 183 | [string map [list \r\n \n] \ |
| 182 | 184 | {SQL expression: (x GLOB 'o*,two three,four') |
| 183 | 185 | pattern[0] = [o*,two three,four] |
| 184 | 186 | 1 one,two three,four}] |
| 187 | + | |
| 188 | +############################################################################### | |
| 189 | + | |
| 190 | +test_cleanup | |
| 185 | 191 |
| --- test/glob.test | |
| +++ test/glob.test | |
| @@ -15,10 +15,12 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Test glob pattern parsing |
| 19 | # |
| 20 | |
| 21 | proc glob-parse {testname args} { |
| 22 | set i 1 |
| 23 | foreach {pattern string result} $args { |
| 24 | fossil test-glob $pattern $string |
| @@ -180,5 +182,9 @@ | |
| 180 | glob-parse 119 "'o*,two three,four'" "one,two three,four" \ |
| 181 | [string map [list \r\n \n] \ |
| 182 | {SQL expression: (x GLOB 'o*,two three,four') |
| 183 | pattern[0] = [o*,two three,four] |
| 184 | 1 one,two three,four}] |
| 185 |
| --- test/glob.test | |
| +++ test/glob.test | |
| @@ -15,10 +15,12 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Test glob pattern parsing |
| 19 | # |
| 20 | |
| 21 | test_setup "" |
| 22 | |
| 23 | proc glob-parse {testname args} { |
| 24 | set i 1 |
| 25 | foreach {pattern string result} $args { |
| 26 | fossil test-glob $pattern $string |
| @@ -180,5 +182,9 @@ | |
| 182 | glob-parse 119 "'o*,two three,four'" "one,two three,four" \ |
| 183 | [string map [list \r\n \n] \ |
| 184 | {SQL expression: (x GLOB 'o*,two three,four') |
| 185 | pattern[0] = [o*,two three,four] |
| 186 | 1 one,two three,four}] |
| 187 | |
| 188 | ############################################################################### |
| 189 | |
| 190 | test_cleanup |
| 191 |
+10
-4
| --- test/json.test | ||
| +++ test/json.test | ||
| @@ -24,11 +24,12 @@ | ||
| 24 | 24 | # not configured. If that changes, these conditions might not prevent |
| 25 | 25 | # the rest of this file from running. |
| 26 | 26 | fossil test-th-eval "hasfeature json" |
| 27 | 27 | |
| 28 | 28 | if {$::RESULT ne "1"} then { |
| 29 | - puts "Fossil was not compiled with JSON support."; return | |
| 29 | + puts "Fossil was not compiled with JSON support." | |
| 30 | + test_cleanup_then_return | |
| 30 | 31 | } |
| 31 | 32 | |
| 32 | 33 | # We need a JSON parser to effectively test the JSON produced by |
| 33 | 34 | # fossil. It looks like the one from tcllib is exactly what we need. |
| 34 | 35 | # On ActiveTcl, add it with teacup. On other platforms, YMMV. |
| @@ -47,11 +48,12 @@ | ||
| 47 | 48 | |
| 48 | 49 | # and that the json itself smells ok and has the expected API error code in it |
| 49 | 50 | fossil json -expectError |
| 50 | 51 | set JR [json2dict $RESULT] |
| 51 | 52 | if {$JR eq ""} { |
| 52 | - puts "Fossil was not compiled with JSON support (bad JSON)."; return | |
| 53 | + puts "Fossil was not compiled with JSON support (bad JSON)." | |
| 54 | + test_cleanup_then_return | |
| 53 | 55 | } |
| 54 | 56 | test json-1 {[dict exists $JR resultCode] |
| 55 | 57 | && [dict get $JR resultCode] eq "FOSSIL-4102"} |
| 56 | 58 | |
| 57 | 59 | # Use the CLI interface to execute a JSON command. Sets the global |
| @@ -163,11 +165,11 @@ | ||
| 163 | 165 | } |
| 164 | 166 | |
| 165 | 167 | #### VERSION AKA HAI |
| 166 | 168 | |
| 167 | 169 | # The JSON API generally assumes we have a respository, so let it have one. |
| 168 | -repo_init | |
| 170 | +test_setup | |
| 169 | 171 | |
| 170 | 172 | # Check for basic envelope fields in the result with an error |
| 171 | 173 | fossil_json -expectError |
| 172 | 174 | test_json_envelope json-enverr [concat resultCode fossil timestamp \ |
| 173 | 175 | resultText command procTimeUs procTimeMs] {} |
| @@ -666,11 +668,11 @@ | ||
| 666 | 668 | # is not writable" error comes back as HTML. i don't know if the |
| 667 | 669 | # error happens before we have made the determination that the app is |
| 668 | 670 | # in JSON mode or if the error handling is incorrectly not |
| 669 | 671 | # recognizing JSON mode. |
| 670 | 672 | # |
| 671 | -#repo_init x.fossil | |
| 673 | +#test_setup x.fossil | |
| 672 | 674 | #catch {exec chmod 444 .rep.fossil}; # Unix. What about Win? |
| 673 | 675 | fossil_http_json /json/timeline/checkin $U1Cookie |
| 674 | 676 | test json-ROrepo-1-1 {$CODE == 0} |
| 675 | 677 | test json-ROrepo-1-2 {[regexp {\}\s*$} $RESULT]} |
| 676 | 678 | test json-ROrepo-1-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]} |
| @@ -845,5 +847,9 @@ | ||
| 845 | 847 | # Fossil repository db file is not valid. |
| 846 | 848 | write_file nope.fossil { |
| 847 | 849 | This is not a fossil repo. It ought to be a SQLite db with a well-known schema, |
| 848 | 850 | but it is actually just a block of text. |
| 849 | 851 | } |
| 852 | + | |
| 853 | +############################################################################### | |
| 854 | + | |
| 855 | +test_cleanup | |
| 850 | 856 |
| --- test/json.test | |
| +++ test/json.test | |
| @@ -24,11 +24,12 @@ | |
| 24 | # not configured. If that changes, these conditions might not prevent |
| 25 | # the rest of this file from running. |
| 26 | fossil test-th-eval "hasfeature json" |
| 27 | |
| 28 | if {$::RESULT ne "1"} then { |
| 29 | puts "Fossil was not compiled with JSON support."; return |
| 30 | } |
| 31 | |
| 32 | # We need a JSON parser to effectively test the JSON produced by |
| 33 | # fossil. It looks like the one from tcllib is exactly what we need. |
| 34 | # On ActiveTcl, add it with teacup. On other platforms, YMMV. |
| @@ -47,11 +48,12 @@ | |
| 47 | |
| 48 | # and that the json itself smells ok and has the expected API error code in it |
| 49 | fossil json -expectError |
| 50 | set JR [json2dict $RESULT] |
| 51 | if {$JR eq ""} { |
| 52 | puts "Fossil was not compiled with JSON support (bad JSON)."; return |
| 53 | } |
| 54 | test json-1 {[dict exists $JR resultCode] |
| 55 | && [dict get $JR resultCode] eq "FOSSIL-4102"} |
| 56 | |
| 57 | # Use the CLI interface to execute a JSON command. Sets the global |
| @@ -163,11 +165,11 @@ | |
| 163 | } |
| 164 | |
| 165 | #### VERSION AKA HAI |
| 166 | |
| 167 | # The JSON API generally assumes we have a respository, so let it have one. |
| 168 | repo_init |
| 169 | |
| 170 | # Check for basic envelope fields in the result with an error |
| 171 | fossil_json -expectError |
| 172 | test_json_envelope json-enverr [concat resultCode fossil timestamp \ |
| 173 | resultText command procTimeUs procTimeMs] {} |
| @@ -666,11 +668,11 @@ | |
| 666 | # is not writable" error comes back as HTML. i don't know if the |
| 667 | # error happens before we have made the determination that the app is |
| 668 | # in JSON mode or if the error handling is incorrectly not |
| 669 | # recognizing JSON mode. |
| 670 | # |
| 671 | #repo_init x.fossil |
| 672 | #catch {exec chmod 444 .rep.fossil}; # Unix. What about Win? |
| 673 | fossil_http_json /json/timeline/checkin $U1Cookie |
| 674 | test json-ROrepo-1-1 {$CODE == 0} |
| 675 | test json-ROrepo-1-2 {[regexp {\}\s*$} $RESULT]} |
| 676 | test json-ROrepo-1-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]} |
| @@ -845,5 +847,9 @@ | |
| 845 | # Fossil repository db file is not valid. |
| 846 | write_file nope.fossil { |
| 847 | This is not a fossil repo. It ought to be a SQLite db with a well-known schema, |
| 848 | but it is actually just a block of text. |
| 849 | } |
| 850 |
| --- test/json.test | |
| +++ test/json.test | |
| @@ -24,11 +24,12 @@ | |
| 24 | # not configured. If that changes, these conditions might not prevent |
| 25 | # the rest of this file from running. |
| 26 | fossil test-th-eval "hasfeature json" |
| 27 | |
| 28 | if {$::RESULT ne "1"} then { |
| 29 | puts "Fossil was not compiled with JSON support." |
| 30 | test_cleanup_then_return |
| 31 | } |
| 32 | |
| 33 | # We need a JSON parser to effectively test the JSON produced by |
| 34 | # fossil. It looks like the one from tcllib is exactly what we need. |
| 35 | # On ActiveTcl, add it with teacup. On other platforms, YMMV. |
| @@ -47,11 +48,12 @@ | |
| 48 | |
| 49 | # and that the json itself smells ok and has the expected API error code in it |
| 50 | fossil json -expectError |
| 51 | set JR [json2dict $RESULT] |
| 52 | if {$JR eq ""} { |
| 53 | puts "Fossil was not compiled with JSON support (bad JSON)." |
| 54 | test_cleanup_then_return |
| 55 | } |
| 56 | test json-1 {[dict exists $JR resultCode] |
| 57 | && [dict get $JR resultCode] eq "FOSSIL-4102"} |
| 58 | |
| 59 | # Use the CLI interface to execute a JSON command. Sets the global |
| @@ -163,11 +165,11 @@ | |
| 165 | } |
| 166 | |
| 167 | #### VERSION AKA HAI |
| 168 | |
| 169 | # The JSON API generally assumes we have a respository, so let it have one. |
| 170 | test_setup |
| 171 | |
| 172 | # Check for basic envelope fields in the result with an error |
| 173 | fossil_json -expectError |
| 174 | test_json_envelope json-enverr [concat resultCode fossil timestamp \ |
| 175 | resultText command procTimeUs procTimeMs] {} |
| @@ -666,11 +668,11 @@ | |
| 668 | # is not writable" error comes back as HTML. i don't know if the |
| 669 | # error happens before we have made the determination that the app is |
| 670 | # in JSON mode or if the error handling is incorrectly not |
| 671 | # recognizing JSON mode. |
| 672 | # |
| 673 | #test_setup x.fossil |
| 674 | #catch {exec chmod 444 .rep.fossil}; # Unix. What about Win? |
| 675 | fossil_http_json /json/timeline/checkin $U1Cookie |
| 676 | test json-ROrepo-1-1 {$CODE == 0} |
| 677 | test json-ROrepo-1-2 {[regexp {\}\s*$} $RESULT]} |
| 678 | test json-ROrepo-1-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]} |
| @@ -845,5 +847,9 @@ | |
| 847 | # Fossil repository db file is not valid. |
| 848 | write_file nope.fossil { |
| 849 | This is not a fossil repo. It ought to be a SQLite db with a well-known schema, |
| 850 | but it is actually just a block of text. |
| 851 | } |
| 852 | |
| 853 | ############################################################################### |
| 854 | |
| 855 | test_cleanup |
| 856 |
+6
| --- test/merge1.test | ||
| +++ test/merge1.test | ||
| @@ -15,10 +15,12 @@ | ||
| 15 | 15 | # |
| 16 | 16 | ############################################################################ |
| 17 | 17 | # |
| 18 | 18 | # Tests of the 3-way merge |
| 19 | 19 | # |
| 20 | + | |
| 21 | +test_setup "" | |
| 20 | 22 | |
| 21 | 23 | write_file_indented t1 { |
| 22 | 24 | 111 - This is line one of the demo program - 1111 |
| 23 | 25 | 222 - The second line program line in code - 2222 |
| 24 | 26 | 333 - This is a test of the merging algohm - 3333 |
| @@ -398,5 +400,9 @@ | ||
| 398 | 400 | STUV |
| 399 | 401 | XYZ. |
| 400 | 402 | } |
| 401 | 403 | fossil 3-way-merge t1 t2 t3 a23 |
| 402 | 404 | test merge1-7.2 {[same_file t23 a23]} |
| 405 | + | |
| 406 | +############################################################################### | |
| 407 | + | |
| 408 | +test_cleanup | |
| 403 | 409 |
| --- test/merge1.test | |
| +++ test/merge1.test | |
| @@ -15,10 +15,12 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Tests of the 3-way merge |
| 19 | # |
| 20 | |
| 21 | write_file_indented t1 { |
| 22 | 111 - This is line one of the demo program - 1111 |
| 23 | 222 - The second line program line in code - 2222 |
| 24 | 333 - This is a test of the merging algohm - 3333 |
| @@ -398,5 +400,9 @@ | |
| 398 | STUV |
| 399 | XYZ. |
| 400 | } |
| 401 | fossil 3-way-merge t1 t2 t3 a23 |
| 402 | test merge1-7.2 {[same_file t23 a23]} |
| 403 |
| --- test/merge1.test | |
| +++ test/merge1.test | |
| @@ -15,10 +15,12 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Tests of the 3-way merge |
| 19 | # |
| 20 | |
| 21 | test_setup "" |
| 22 | |
| 23 | write_file_indented t1 { |
| 24 | 111 - This is line one of the demo program - 1111 |
| 25 | 222 - The second line program line in code - 2222 |
| 26 | 333 - This is a test of the merging algohm - 3333 |
| @@ -398,5 +400,9 @@ | |
| 400 | STUV |
| 401 | XYZ. |
| 402 | } |
| 403 | fossil 3-way-merge t1 t2 t3 a23 |
| 404 | test merge1-7.2 {[same_file t23 a23]} |
| 405 | |
| 406 | ############################################################################### |
| 407 | |
| 408 | test_cleanup |
| 409 |
+6
| --- test/merge2.test | ||
| +++ test/merge2.test | ||
| @@ -15,10 +15,12 @@ | ||
| 15 | 15 | # |
| 16 | 16 | ############################################################################ |
| 17 | 17 | # |
| 18 | 18 | # Tests of the delta mechanism. |
| 19 | 19 | # |
| 20 | + | |
| 21 | +test_setup "" | |
| 20 | 22 | |
| 21 | 23 | set filelist [glob $testdir/*] |
| 22 | 24 | foreach f $filelist { |
| 23 | 25 | if {[file isdir $f]} continue |
| 24 | 26 | set base [file root [file tail $f]] |
| @@ -38,5 +40,9 @@ | ||
| 38 | 40 | test merge-$base-$i-23 {[same_file a23 t23]} |
| 39 | 41 | fossil 3-way-merge t1 t3 t2 a32 |
| 40 | 42 | test merge-$base-$i-32 {[same_file a32 t32]} |
| 41 | 43 | } |
| 42 | 44 | } |
| 45 | + | |
| 46 | +############################################################################### | |
| 47 | + | |
| 48 | +test_cleanup | |
| 43 | 49 |
| --- test/merge2.test | |
| +++ test/merge2.test | |
| @@ -15,10 +15,12 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Tests of the delta mechanism. |
| 19 | # |
| 20 | |
| 21 | set filelist [glob $testdir/*] |
| 22 | foreach f $filelist { |
| 23 | if {[file isdir $f]} continue |
| 24 | set base [file root [file tail $f]] |
| @@ -38,5 +40,9 @@ | |
| 38 | test merge-$base-$i-23 {[same_file a23 t23]} |
| 39 | fossil 3-way-merge t1 t3 t2 a32 |
| 40 | test merge-$base-$i-32 {[same_file a32 t32]} |
| 41 | } |
| 42 | } |
| 43 |
| --- test/merge2.test | |
| +++ test/merge2.test | |
| @@ -15,10 +15,12 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Tests of the delta mechanism. |
| 19 | # |
| 20 | |
| 21 | test_setup "" |
| 22 | |
| 23 | set filelist [glob $testdir/*] |
| 24 | foreach f $filelist { |
| 25 | if {[file isdir $f]} continue |
| 26 | set base [file root [file tail $f]] |
| @@ -38,5 +40,9 @@ | |
| 40 | test merge-$base-$i-23 {[same_file a23 t23]} |
| 41 | fossil 3-way-merge t1 t3 t2 a32 |
| 42 | test merge-$base-$i-32 {[same_file a32 t32]} |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | ############################################################################### |
| 47 | |
| 48 | test_cleanup |
| 49 |
+6
| --- test/merge3.test | ||
| +++ test/merge3.test | ||
| @@ -15,10 +15,12 @@ | ||
| 15 | 15 | # |
| 16 | 16 | ############################################################################ |
| 17 | 17 | # |
| 18 | 18 | # Tests of the 3-way merge |
| 19 | 19 | # |
| 20 | + | |
| 21 | +test_setup "" | |
| 20 | 22 | |
| 21 | 23 | proc merge-test {testid basis v1 v2 result} { |
| 22 | 24 | write_file t1 [join [string trim $basis] \n]\n |
| 23 | 25 | write_file t2 [join [string trim $v1] \n]\n |
| 24 | 26 | write_file t3 [join [string trim $v2] \n]\n |
| @@ -633,5 +635,9 @@ | ||
| 633 | 635 | } { |
| 634 | 636 | 1 2 3 4 5 7 8 9b |
| 635 | 637 | } { |
| 636 | 638 | 1 2 3 4 5 7 8 MINE: 9b a b c d e COM: 9 YOURS: 9b END |
| 637 | 639 | } |
| 640 | + | |
| 641 | +############################################################################### | |
| 642 | + | |
| 643 | +test_cleanup | |
| 638 | 644 |
| --- test/merge3.test | |
| +++ test/merge3.test | |
| @@ -15,10 +15,12 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Tests of the 3-way merge |
| 19 | # |
| 20 | |
| 21 | proc merge-test {testid basis v1 v2 result} { |
| 22 | write_file t1 [join [string trim $basis] \n]\n |
| 23 | write_file t2 [join [string trim $v1] \n]\n |
| 24 | write_file t3 [join [string trim $v2] \n]\n |
| @@ -633,5 +635,9 @@ | |
| 633 | } { |
| 634 | 1 2 3 4 5 7 8 9b |
| 635 | } { |
| 636 | 1 2 3 4 5 7 8 MINE: 9b a b c d e COM: 9 YOURS: 9b END |
| 637 | } |
| 638 |
| --- test/merge3.test | |
| +++ test/merge3.test | |
| @@ -15,10 +15,12 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Tests of the 3-way merge |
| 19 | # |
| 20 | |
| 21 | test_setup "" |
| 22 | |
| 23 | proc merge-test {testid basis v1 v2 result} { |
| 24 | write_file t1 [join [string trim $basis] \n]\n |
| 25 | write_file t2 [join [string trim $v1] \n]\n |
| 26 | write_file t3 [join [string trim $v2] \n]\n |
| @@ -633,5 +635,9 @@ | |
| 635 | } { |
| 636 | 1 2 3 4 5 7 8 9b |
| 637 | } { |
| 638 | 1 2 3 4 5 7 8 MINE: 9b a b c d e COM: 9 YOURS: 9b END |
| 639 | } |
| 640 | |
| 641 | ############################################################################### |
| 642 | |
| 643 | test_cleanup |
| 644 |
+6
| --- test/merge4.test | ||
| +++ test/merge4.test | ||
| @@ -15,10 +15,12 @@ | ||
| 15 | 15 | # |
| 16 | 16 | ############################################################################ |
| 17 | 17 | # |
| 18 | 18 | # Tests of the 3-way merge |
| 19 | 19 | # |
| 20 | + | |
| 21 | +test_setup "" | |
| 20 | 22 | |
| 21 | 23 | proc merge-test {testid basis v1 v2 result1 result2} { |
| 22 | 24 | write_file t1 [join [string trim $basis] \n]\n |
| 23 | 25 | write_file t2 [join [string trim $v1] \n]\n |
| 24 | 26 | write_file t3 [join [string trim $v2] \n]\n |
| @@ -93,5 +95,9 @@ | ||
| 93 | 95 | } { |
| 94 | 96 | 2b 3b 4c 5c 6c 7b 8b |
| 95 | 97 | } { |
| 96 | 98 | 2b 3b 4c 5c 6c 7b 8b |
| 97 | 99 | } |
| 100 | + | |
| 101 | +############################################################################### | |
| 102 | + | |
| 103 | +test_cleanup | |
| 98 | 104 |
| --- test/merge4.test | |
| +++ test/merge4.test | |
| @@ -15,10 +15,12 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Tests of the 3-way merge |
| 19 | # |
| 20 | |
| 21 | proc merge-test {testid basis v1 v2 result1 result2} { |
| 22 | write_file t1 [join [string trim $basis] \n]\n |
| 23 | write_file t2 [join [string trim $v1] \n]\n |
| 24 | write_file t3 [join [string trim $v2] \n]\n |
| @@ -93,5 +95,9 @@ | |
| 93 | } { |
| 94 | 2b 3b 4c 5c 6c 7b 8b |
| 95 | } { |
| 96 | 2b 3b 4c 5c 6c 7b 8b |
| 97 | } |
| 98 |
| --- test/merge4.test | |
| +++ test/merge4.test | |
| @@ -15,10 +15,12 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Tests of the 3-way merge |
| 19 | # |
| 20 | |
| 21 | test_setup "" |
| 22 | |
| 23 | proc merge-test {testid basis v1 v2 result1 result2} { |
| 24 | write_file t1 [join [string trim $basis] \n]\n |
| 25 | write_file t2 [join [string trim $v1] \n]\n |
| 26 | write_file t3 [join [string trim $v2] \n]\n |
| @@ -93,5 +95,9 @@ | |
| 95 | } { |
| 96 | 2b 3b 4c 5c 6c 7b 8b |
| 97 | } { |
| 98 | 2b 3b 4c 5c 6c 7b 8b |
| 99 | } |
| 100 | |
| 101 | ############################################################################### |
| 102 | |
| 103 | test_cleanup |
| 104 |
+5
-9
| --- test/merge5.test | ||
| +++ test/merge5.test | ||
| @@ -36,19 +36,11 @@ | ||
| 36 | 36 | } else { |
| 37 | 37 | test merge5-$testid 1 |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | -catch {exec $::fossilexe info} res | |
| 42 | -if {![regexp {use --repository} $res]} { | |
| 43 | - puts stderr "Cannot run this test within an open checkout" | |
| 44 | - return | |
| 45 | -} | |
| 46 | -# | |
| 47 | -# Fossil will write data on $HOME, running 'fossil open' here. | |
| 48 | -# We need not to clutter the $HOME of the test caller. | |
| 49 | -set env(HOME) [pwd] | |
| 41 | +require_no_open_checkout; test_setup "" | |
| 50 | 42 | |
| 51 | 43 | # Construct a test repository |
| 52 | 44 | # |
| 53 | 45 | exec $::fossilexe sqlite3 --no-repository m5.fossil <$testdir/${testfile}_repo.sql |
| 54 | 46 | fossil rebuild m5.fossil |
| @@ -309,5 +301,9 @@ | ||
| 309 | 301 | checkout-test 142 { |
| 310 | 302 | 7eaf64a2c9141277b4c24259c7766d6a77047af7 one.txt |
| 311 | 303 | 98e47f99bb9fed4fdcd407f553615ca7f15a38a2 three.txt |
| 312 | 304 | e58c5da3e6007d0e30600ea31611813093ad180f two-rename.txt |
| 313 | 305 | } |
| 306 | + | |
| 307 | +############################################################################### | |
| 308 | + | |
| 309 | +test_cleanup | |
| 314 | 310 |
| --- test/merge5.test | |
| +++ test/merge5.test | |
| @@ -36,19 +36,11 @@ | |
| 36 | } else { |
| 37 | test merge5-$testid 1 |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | catch {exec $::fossilexe info} res |
| 42 | if {![regexp {use --repository} $res]} { |
| 43 | puts stderr "Cannot run this test within an open checkout" |
| 44 | return |
| 45 | } |
| 46 | # |
| 47 | # Fossil will write data on $HOME, running 'fossil open' here. |
| 48 | # We need not to clutter the $HOME of the test caller. |
| 49 | set env(HOME) [pwd] |
| 50 | |
| 51 | # Construct a test repository |
| 52 | # |
| 53 | exec $::fossilexe sqlite3 --no-repository m5.fossil <$testdir/${testfile}_repo.sql |
| 54 | fossil rebuild m5.fossil |
| @@ -309,5 +301,9 @@ | |
| 309 | checkout-test 142 { |
| 310 | 7eaf64a2c9141277b4c24259c7766d6a77047af7 one.txt |
| 311 | 98e47f99bb9fed4fdcd407f553615ca7f15a38a2 three.txt |
| 312 | e58c5da3e6007d0e30600ea31611813093ad180f two-rename.txt |
| 313 | } |
| 314 |
| --- test/merge5.test | |
| +++ test/merge5.test | |
| @@ -36,19 +36,11 @@ | |
| 36 | } else { |
| 37 | test merge5-$testid 1 |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | require_no_open_checkout; test_setup "" |
| 42 | |
| 43 | # Construct a test repository |
| 44 | # |
| 45 | exec $::fossilexe sqlite3 --no-repository m5.fossil <$testdir/${testfile}_repo.sql |
| 46 | fossil rebuild m5.fossil |
| @@ -309,5 +301,9 @@ | |
| 301 | checkout-test 142 { |
| 302 | 7eaf64a2c9141277b4c24259c7766d6a77047af7 one.txt |
| 303 | 98e47f99bb9fed4fdcd407f553615ca7f15a38a2 three.txt |
| 304 | e58c5da3e6007d0e30600ea31611813093ad180f two-rename.txt |
| 305 | } |
| 306 | |
| 307 | ############################################################################### |
| 308 | |
| 309 | test_cleanup |
| 310 |
+5
-1
| --- test/merge6.test | ||
| +++ test/merge6.test | ||
| @@ -20,11 +20,11 @@ | ||
| 20 | 20 | |
| 21 | 21 | #################################################################### |
| 22 | 22 | # TEST 1: Handle multiple merges each with one or more ADDED files # |
| 23 | 23 | #################################################################### |
| 24 | 24 | |
| 25 | -repo_init | |
| 25 | +test_setup | |
| 26 | 26 | fossil ls |
| 27 | 27 | |
| 28 | 28 | test merge_multi-0 {[normalize_result] eq {}} |
| 29 | 29 | |
| 30 | 30 | write_file f1 "f1 line" |
| @@ -63,5 +63,9 @@ | ||
| 63 | 63 | |
| 64 | 64 | test merge_multi-4 {[normalize_result] eq {f1 |
| 65 | 65 | f2 |
| 66 | 66 | f3 |
| 67 | 67 | f4}} knownBug |
| 68 | + | |
| 69 | +############################################################################### | |
| 70 | + | |
| 71 | +test_cleanup | |
| 68 | 72 |
| --- test/merge6.test | |
| +++ test/merge6.test | |
| @@ -20,11 +20,11 @@ | |
| 20 | |
| 21 | #################################################################### |
| 22 | # TEST 1: Handle multiple merges each with one or more ADDED files # |
| 23 | #################################################################### |
| 24 | |
| 25 | repo_init |
| 26 | fossil ls |
| 27 | |
| 28 | test merge_multi-0 {[normalize_result] eq {}} |
| 29 | |
| 30 | write_file f1 "f1 line" |
| @@ -63,5 +63,9 @@ | |
| 63 | |
| 64 | test merge_multi-4 {[normalize_result] eq {f1 |
| 65 | f2 |
| 66 | f3 |
| 67 | f4}} knownBug |
| 68 |
| --- test/merge6.test | |
| +++ test/merge6.test | |
| @@ -20,11 +20,11 @@ | |
| 20 | |
| 21 | #################################################################### |
| 22 | # TEST 1: Handle multiple merges each with one or more ADDED files # |
| 23 | #################################################################### |
| 24 | |
| 25 | test_setup |
| 26 | fossil ls |
| 27 | |
| 28 | test merge_multi-0 {[normalize_result] eq {}} |
| 29 | |
| 30 | write_file f1 "f1 line" |
| @@ -63,5 +63,9 @@ | |
| 63 | |
| 64 | test merge_multi-4 {[normalize_result] eq {f1 |
| 65 | f2 |
| 66 | f3 |
| 67 | f4}} knownBug |
| 68 | |
| 69 | ############################################################################### |
| 70 | |
| 71 | test_cleanup |
| 72 |
+9
-9
| --- test/merge_renames.test | ||
| +++ test/merge_renames.test | ||
| @@ -1,22 +1,18 @@ | ||
| 1 | 1 | # |
| 2 | 2 | # Tests for merging with renames |
| 3 | 3 | # |
| 4 | 4 | # |
| 5 | 5 | |
| 6 | -catch {exec $::fossilexe info} res | |
| 7 | -if {![regexp {use --repository} $res]} { | |
| 8 | - puts stderr "Cannot run this test within an open checkout" | |
| 9 | - return | |
| 10 | -} | |
| 6 | +require_no_open_checkout | |
| 11 | 7 | |
| 12 | 8 | ###################################### |
| 13 | 9 | # Test 1 # |
| 14 | 10 | # Reported: Ticket [554f44ee74e3d] # |
| 15 | 11 | ###################################### |
| 16 | 12 | |
| 17 | -repo_init | |
| 13 | +test_setup | |
| 18 | 14 | |
| 19 | 15 | write_file f1 "line" |
| 20 | 16 | fossil add f1 |
| 21 | 17 | fossil commit -m "c1" |
| 22 | 18 | fossil tag add pivot current |
| @@ -70,11 +66,11 @@ | ||
| 70 | 66 | ###################################### |
| 71 | 67 | # Test 2 # |
| 72 | 68 | # Reported: Ticket [74413366fe5067] # |
| 73 | 69 | ###################################### |
| 74 | 70 | |
| 75 | -repo_init | |
| 71 | +test_setup | |
| 76 | 72 | |
| 77 | 73 | write_file f1 "line" |
| 78 | 74 | fossil add f1 |
| 79 | 75 | fossil commit -m "base file" |
| 80 | 76 | fossil tag add pivot current |
| @@ -118,11 +114,11 @@ | ||
| 118 | 114 | ###################################### |
| 119 | 115 | # Test 3 # |
| 120 | 116 | # Reported: Ticket [30b28cf351] # |
| 121 | 117 | ###################################### |
| 122 | 118 | |
| 123 | -repo_init | |
| 119 | +test_setup | |
| 124 | 120 | |
| 125 | 121 | write_file f1 "line" |
| 126 | 122 | fossil add f1 |
| 127 | 123 | fossil commit -m "base file" |
| 128 | 124 | fossil tag add pivot current |
| @@ -173,11 +169,11 @@ | ||
| 173 | 169 | ###################################### |
| 174 | 170 | # Test 5 # |
| 175 | 171 | # Handle Rename/Add via Merge # |
| 176 | 172 | ###################################### |
| 177 | 173 | |
| 178 | -repo_init | |
| 174 | +test_setup | |
| 179 | 175 | |
| 180 | 176 | write_file f1 "old f1 line" |
| 181 | 177 | fossil add f1 |
| 182 | 178 | fossil commit -m "base file" |
| 183 | 179 | |
| @@ -207,5 +203,9 @@ | ||
| 207 | 203 | # Tests for troubles not specifically linked with renames but that I'd like to |
| 208 | 204 | # write: |
| 209 | 205 | # [c26c63eb1b] - 'merge --backout' does not handle conflicts properly |
| 210 | 206 | # [953031915f] - Lack of warning when overwriting extra files |
| 211 | 207 | # [4df5f38f1e] - Troubles merging a file delete with a file change |
| 208 | + | |
| 209 | +############################################################################### | |
| 210 | + | |
| 211 | +test_cleanup | |
| 212 | 212 |
| --- test/merge_renames.test | |
| +++ test/merge_renames.test | |
| @@ -1,22 +1,18 @@ | |
| 1 | # |
| 2 | # Tests for merging with renames |
| 3 | # |
| 4 | # |
| 5 | |
| 6 | catch {exec $::fossilexe info} res |
| 7 | if {![regexp {use --repository} $res]} { |
| 8 | puts stderr "Cannot run this test within an open checkout" |
| 9 | return |
| 10 | } |
| 11 | |
| 12 | ###################################### |
| 13 | # Test 1 # |
| 14 | # Reported: Ticket [554f44ee74e3d] # |
| 15 | ###################################### |
| 16 | |
| 17 | repo_init |
| 18 | |
| 19 | write_file f1 "line" |
| 20 | fossil add f1 |
| 21 | fossil commit -m "c1" |
| 22 | fossil tag add pivot current |
| @@ -70,11 +66,11 @@ | |
| 70 | ###################################### |
| 71 | # Test 2 # |
| 72 | # Reported: Ticket [74413366fe5067] # |
| 73 | ###################################### |
| 74 | |
| 75 | repo_init |
| 76 | |
| 77 | write_file f1 "line" |
| 78 | fossil add f1 |
| 79 | fossil commit -m "base file" |
| 80 | fossil tag add pivot current |
| @@ -118,11 +114,11 @@ | |
| 118 | ###################################### |
| 119 | # Test 3 # |
| 120 | # Reported: Ticket [30b28cf351] # |
| 121 | ###################################### |
| 122 | |
| 123 | repo_init |
| 124 | |
| 125 | write_file f1 "line" |
| 126 | fossil add f1 |
| 127 | fossil commit -m "base file" |
| 128 | fossil tag add pivot current |
| @@ -173,11 +169,11 @@ | |
| 173 | ###################################### |
| 174 | # Test 5 # |
| 175 | # Handle Rename/Add via Merge # |
| 176 | ###################################### |
| 177 | |
| 178 | repo_init |
| 179 | |
| 180 | write_file f1 "old f1 line" |
| 181 | fossil add f1 |
| 182 | fossil commit -m "base file" |
| 183 | |
| @@ -207,5 +203,9 @@ | |
| 207 | # Tests for troubles not specifically linked with renames but that I'd like to |
| 208 | # write: |
| 209 | # [c26c63eb1b] - 'merge --backout' does not handle conflicts properly |
| 210 | # [953031915f] - Lack of warning when overwriting extra files |
| 211 | # [4df5f38f1e] - Troubles merging a file delete with a file change |
| 212 |
| --- test/merge_renames.test | |
| +++ test/merge_renames.test | |
| @@ -1,22 +1,18 @@ | |
| 1 | # |
| 2 | # Tests for merging with renames |
| 3 | # |
| 4 | # |
| 5 | |
| 6 | require_no_open_checkout |
| 7 | |
| 8 | ###################################### |
| 9 | # Test 1 # |
| 10 | # Reported: Ticket [554f44ee74e3d] # |
| 11 | ###################################### |
| 12 | |
| 13 | test_setup |
| 14 | |
| 15 | write_file f1 "line" |
| 16 | fossil add f1 |
| 17 | fossil commit -m "c1" |
| 18 | fossil tag add pivot current |
| @@ -70,11 +66,11 @@ | |
| 66 | ###################################### |
| 67 | # Test 2 # |
| 68 | # Reported: Ticket [74413366fe5067] # |
| 69 | ###################################### |
| 70 | |
| 71 | test_setup |
| 72 | |
| 73 | write_file f1 "line" |
| 74 | fossil add f1 |
| 75 | fossil commit -m "base file" |
| 76 | fossil tag add pivot current |
| @@ -118,11 +114,11 @@ | |
| 114 | ###################################### |
| 115 | # Test 3 # |
| 116 | # Reported: Ticket [30b28cf351] # |
| 117 | ###################################### |
| 118 | |
| 119 | test_setup |
| 120 | |
| 121 | write_file f1 "line" |
| 122 | fossil add f1 |
| 123 | fossil commit -m "base file" |
| 124 | fossil tag add pivot current |
| @@ -173,11 +169,11 @@ | |
| 169 | ###################################### |
| 170 | # Test 5 # |
| 171 | # Handle Rename/Add via Merge # |
| 172 | ###################################### |
| 173 | |
| 174 | test_setup |
| 175 | |
| 176 | write_file f1 "old f1 line" |
| 177 | fossil add f1 |
| 178 | fossil commit -m "base file" |
| 179 | |
| @@ -207,5 +203,9 @@ | |
| 203 | # Tests for troubles not specifically linked with renames but that I'd like to |
| 204 | # write: |
| 205 | # [c26c63eb1b] - 'merge --backout' does not handle conflicts properly |
| 206 | # [953031915f] - Lack of warning when overwriting extra files |
| 207 | # [4df5f38f1e] - Troubles merging a file delete with a file change |
| 208 | |
| 209 | ############################################################################### |
| 210 | |
| 211 | test_cleanup |
| 212 |
+6
-8
| --- test/mv-rm.test | ||
| +++ test/mv-rm.test | ||
| @@ -16,28 +16,22 @@ | ||
| 16 | 16 | ############################################################################ |
| 17 | 17 | # |
| 18 | 18 | # MV / RM Commands |
| 19 | 19 | # |
| 20 | 20 | |
| 21 | -catch {exec $::fossilexe info} res | |
| 22 | -if {![regexp {use --repository} $res]} { | |
| 23 | - puts stderr "Cannot run this test within an open checkout" | |
| 24 | - return | |
| 25 | -} | |
| 21 | +require_no_open_checkout | |
| 26 | 22 | |
| 27 | 23 | ######################################## |
| 28 | 24 | # Setup: Add Files and Commit # |
| 29 | 25 | ######################################## |
| 30 | 26 | |
| 31 | -set rootDir [file normalize [pwd]] | |
| 27 | +test_setup; set rootDir [file normalize [pwd]] | |
| 32 | 28 | |
| 33 | 29 | set undoMsg "\n \"fossil undo\" is\ |
| 34 | 30 | available to undo changes to the\ |
| 35 | 31 | working checkout." |
| 36 | 32 | |
| 37 | -repo_init | |
| 38 | - | |
| 39 | 33 | write_file f1 "f1" |
| 40 | 34 | write_file f2 "f2" |
| 41 | 35 | write_file f3 "f3" |
| 42 | 36 | write_file f4 "f4" |
| 43 | 37 | write_file f5 "f5" |
| @@ -387,5 +381,9 @@ | ||
| 387 | 381 | test rm-hard-absolute-6 { |
| 388 | 382 | [normalize_result] eq "REVERT f8${undoMsg}" |
| 389 | 383 | } |
| 390 | 384 | |
| 391 | 385 | cd $rootDir |
| 386 | + | |
| 387 | +############################################################################### | |
| 388 | + | |
| 389 | +test_cleanup | |
| 392 | 390 |
| --- test/mv-rm.test | |
| +++ test/mv-rm.test | |
| @@ -16,28 +16,22 @@ | |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # MV / RM Commands |
| 19 | # |
| 20 | |
| 21 | catch {exec $::fossilexe info} res |
| 22 | if {![regexp {use --repository} $res]} { |
| 23 | puts stderr "Cannot run this test within an open checkout" |
| 24 | return |
| 25 | } |
| 26 | |
| 27 | ######################################## |
| 28 | # Setup: Add Files and Commit # |
| 29 | ######################################## |
| 30 | |
| 31 | set rootDir [file normalize [pwd]] |
| 32 | |
| 33 | set undoMsg "\n \"fossil undo\" is\ |
| 34 | available to undo changes to the\ |
| 35 | working checkout." |
| 36 | |
| 37 | repo_init |
| 38 | |
| 39 | write_file f1 "f1" |
| 40 | write_file f2 "f2" |
| 41 | write_file f3 "f3" |
| 42 | write_file f4 "f4" |
| 43 | write_file f5 "f5" |
| @@ -387,5 +381,9 @@ | |
| 387 | test rm-hard-absolute-6 { |
| 388 | [normalize_result] eq "REVERT f8${undoMsg}" |
| 389 | } |
| 390 | |
| 391 | cd $rootDir |
| 392 |
| --- test/mv-rm.test | |
| +++ test/mv-rm.test | |
| @@ -16,28 +16,22 @@ | |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # MV / RM Commands |
| 19 | # |
| 20 | |
| 21 | require_no_open_checkout |
| 22 | |
| 23 | ######################################## |
| 24 | # Setup: Add Files and Commit # |
| 25 | ######################################## |
| 26 | |
| 27 | test_setup; set rootDir [file normalize [pwd]] |
| 28 | |
| 29 | set undoMsg "\n \"fossil undo\" is\ |
| 30 | available to undo changes to the\ |
| 31 | working checkout." |
| 32 | |
| 33 | write_file f1 "f1" |
| 34 | write_file f2 "f2" |
| 35 | write_file f3 "f3" |
| 36 | write_file f4 "f4" |
| 37 | write_file f5 "f5" |
| @@ -387,5 +381,9 @@ | |
| 381 | test rm-hard-absolute-6 { |
| 382 | [normalize_result] eq "REVERT f8${undoMsg}" |
| 383 | } |
| 384 | |
| 385 | cd $rootDir |
| 386 | |
| 387 | ############################################################################### |
| 388 | |
| 389 | test_cleanup |
| 390 |
+8
-9
| --- test/revert.test | ||
| +++ test/revert.test | ||
| @@ -54,17 +54,12 @@ | ||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | fossil undo |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | -catch {exec $::fossilexe info} res | |
| 60 | -if {![regexp {use --repository} $res]} { | |
| 61 | - puts stderr "Cannot run this test within an open checkout" | |
| 62 | - return | |
| 63 | -} | |
| 64 | - | |
| 65 | -repo_init | |
| 59 | +require_no_open_checkout | |
| 60 | +test_setup | |
| 66 | 61 | |
| 67 | 62 | # Prepare first commit |
| 68 | 63 | # |
| 69 | 64 | write_file f1 "f1" |
| 70 | 65 | write_file f2 "f2" |
| @@ -162,11 +157,11 @@ | ||
| 162 | 157 | |
| 163 | 158 | |
| 164 | 159 | # Test reverting the combination of a renamed file and an added file that |
| 165 | 160 | # uses the renamed file's original filename. |
| 166 | 161 | # |
| 167 | -repo_init | |
| 162 | +test_setup | |
| 168 | 163 | write_file f1 "f1" |
| 169 | 164 | fossil add f1 |
| 170 | 165 | fossil commit -m "add f1" |
| 171 | 166 | |
| 172 | 167 | write_file f1n "f1n" |
| @@ -180,11 +175,11 @@ | ||
| 180 | 175 | } -exists {f1} -notexists {f1n} |
| 181 | 176 | |
| 182 | 177 | |
| 183 | 178 | # Test reverting a rename in the repo but not completed in the file |
| 184 | 179 | # system |
| 185 | -repo_init | |
| 180 | +test_setup | |
| 186 | 181 | write_file f1 "f1" |
| 187 | 182 | fossil add f1 |
| 188 | 183 | fossil commit -m "add f1" |
| 189 | 184 | fossil mv --soft f1 f1new |
| 190 | 185 | test 3-mv-1 {[file exists f1]} |
| @@ -191,5 +186,9 @@ | ||
| 191 | 186 | test 3-mv-2 {![file exists f1new]} |
| 192 | 187 | revert-test 3-1 {} { |
| 193 | 188 | REVERT f1 |
| 194 | 189 | DELETE f1new |
| 195 | 190 | } -exists {f1} -notexists {f1n} |
| 191 | + | |
| 192 | +############################################################################### | |
| 193 | + | |
| 194 | +test_cleanup | |
| 196 | 195 |
| --- test/revert.test | |
| +++ test/revert.test | |
| @@ -54,17 +54,12 @@ | |
| 54 | } |
| 55 | |
| 56 | fossil undo |
| 57 | } |
| 58 | |
| 59 | catch {exec $::fossilexe info} res |
| 60 | if {![regexp {use --repository} $res]} { |
| 61 | puts stderr "Cannot run this test within an open checkout" |
| 62 | return |
| 63 | } |
| 64 | |
| 65 | repo_init |
| 66 | |
| 67 | # Prepare first commit |
| 68 | # |
| 69 | write_file f1 "f1" |
| 70 | write_file f2 "f2" |
| @@ -162,11 +157,11 @@ | |
| 162 | |
| 163 | |
| 164 | # Test reverting the combination of a renamed file and an added file that |
| 165 | # uses the renamed file's original filename. |
| 166 | # |
| 167 | repo_init |
| 168 | write_file f1 "f1" |
| 169 | fossil add f1 |
| 170 | fossil commit -m "add f1" |
| 171 | |
| 172 | write_file f1n "f1n" |
| @@ -180,11 +175,11 @@ | |
| 180 | } -exists {f1} -notexists {f1n} |
| 181 | |
| 182 | |
| 183 | # Test reverting a rename in the repo but not completed in the file |
| 184 | # system |
| 185 | repo_init |
| 186 | write_file f1 "f1" |
| 187 | fossil add f1 |
| 188 | fossil commit -m "add f1" |
| 189 | fossil mv --soft f1 f1new |
| 190 | test 3-mv-1 {[file exists f1]} |
| @@ -191,5 +186,9 @@ | |
| 191 | test 3-mv-2 {![file exists f1new]} |
| 192 | revert-test 3-1 {} { |
| 193 | REVERT f1 |
| 194 | DELETE f1new |
| 195 | } -exists {f1} -notexists {f1n} |
| 196 |
| --- test/revert.test | |
| +++ test/revert.test | |
| @@ -54,17 +54,12 @@ | |
| 54 | } |
| 55 | |
| 56 | fossil undo |
| 57 | } |
| 58 | |
| 59 | require_no_open_checkout |
| 60 | test_setup |
| 61 | |
| 62 | # Prepare first commit |
| 63 | # |
| 64 | write_file f1 "f1" |
| 65 | write_file f2 "f2" |
| @@ -162,11 +157,11 @@ | |
| 157 | |
| 158 | |
| 159 | # Test reverting the combination of a renamed file and an added file that |
| 160 | # uses the renamed file's original filename. |
| 161 | # |
| 162 | test_setup |
| 163 | write_file f1 "f1" |
| 164 | fossil add f1 |
| 165 | fossil commit -m "add f1" |
| 166 | |
| 167 | write_file f1n "f1n" |
| @@ -180,11 +175,11 @@ | |
| 175 | } -exists {f1} -notexists {f1n} |
| 176 | |
| 177 | |
| 178 | # Test reverting a rename in the repo but not completed in the file |
| 179 | # system |
| 180 | test_setup |
| 181 | write_file f1 "f1" |
| 182 | fossil add f1 |
| 183 | fossil commit -m "add f1" |
| 184 | fossil mv --soft f1 f1new |
| 185 | test 3-mv-1 {[file exists f1]} |
| @@ -191,5 +186,9 @@ | |
| 186 | test 3-mv-2 {![file exists f1new]} |
| 187 | revert-test 3-1 {} { |
| 188 | REVERT f1 |
| 189 | DELETE f1new |
| 190 | } -exists {f1} -notexists {f1n} |
| 191 | |
| 192 | ############################################################################### |
| 193 | |
| 194 | test_cleanup |
| 195 |
+15
-16
| --- test/stash.test | ||
| +++ test/stash.test | ||
| @@ -90,17 +90,12 @@ | ||
| 90 | 90 | proc stash-test {testid stashArgs expectedStashOutput args} { |
| 91 | 91 | fossil stash {*}$stashArgs |
| 92 | 92 | return [test_result_state stash-$testid "stash $stashArgs" $expectedStashOutput {*}$args] |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | -catch {exec $::fossilexe info} res | |
| 96 | -if {![regexp {use --repository} $res]} { | |
| 97 | - puts stderr "Cannot run this test within an open checkout" | |
| 98 | - return | |
| 99 | -} | |
| 100 | - | |
| 101 | -repo_init | |
| 95 | +require_no_open_checkout | |
| 96 | +test_setup | |
| 102 | 97 | |
| 103 | 98 | # Prepare first commit |
| 104 | 99 | # |
| 105 | 100 | write_file f1 "f1" |
| 106 | 101 | write_file f2 "f2" |
| @@ -231,11 +226,11 @@ | ||
| 231 | 226 | # uses the renamed file's original filename. I expect to see the same |
| 232 | 227 | # behavior as fossil revert: calmly back out both the rename and the |
| 233 | 228 | # add, and presumably stash the content of the added file before it |
| 234 | 229 | # is replaced by the revert. |
| 235 | 230 | # |
| 236 | -repo_init | |
| 231 | +test_setup | |
| 237 | 232 | write_file f1 "f1" |
| 238 | 233 | fossil add f1 |
| 239 | 234 | fossil commit -m "add f1" |
| 240 | 235 | |
| 241 | 236 | write_file f1n "f1n" |
| @@ -254,11 +249,11 @@ | ||
| 254 | 249 | |
| 255 | 250 | # Test stashing a newly added (but never committed) file. As with |
| 256 | 251 | # fossil revert, fossil stash save unmanages the new file, but |
| 257 | 252 | # leaves the copy present on disk. This is undocumented, but |
| 258 | 253 | # probably sensible. |
| 259 | -repo_init | |
| 254 | +test_setup | |
| 260 | 255 | write_file f1 "f1" |
| 261 | 256 | write_file f2 "f2" |
| 262 | 257 | fossil add f1 f2 |
| 263 | 258 | fossil commit -m "baseline" |
| 264 | 259 | |
| @@ -288,21 +283,21 @@ | ||
| 288 | 283 | |
| 289 | 284 | |
| 290 | 285 | # Test stashing a rename of one file with at least one file |
| 291 | 286 | # unchanged. This should stash (and revert) just the rename |
| 292 | 287 | # operation. Instead it also stores and touches the unchanged file. |
| 293 | -repo_init | |
| 288 | +test_setup | |
| 294 | 289 | write_file f1 "f1" |
| 295 | 290 | write_file f2 "f2" |
| 296 | 291 | fossil add f1 f2 |
| 297 | 292 | fossil commit -m "baseline" |
| 298 | 293 | |
| 299 | 294 | fossil mv --hard f2 f2n |
| 300 | -test_result_state stash-3-4-mv "mv --hard f2 f2n" { | |
| 295 | +test_result_state stash-3-2-mv "mv --hard f2 f2n" [concat { | |
| 301 | 296 | RENAME f2 f2n |
| 302 | - MOVED_FILE f2 | |
| 303 | -} -changes { | |
| 297 | + MOVED_FILE} [file normalize f2] { | |
| 298 | +}] -changes { | |
| 304 | 299 | RENAMED f2n |
| 305 | 300 | } -addremove { |
| 306 | 301 | } -exists {f1 f2n} -notexists {f2} |
| 307 | 302 | |
| 308 | 303 | stash-test 3-2 {save -m f2n} { |
| @@ -325,11 +320,11 @@ | ||
| 325 | 320 | |
| 326 | 321 | |
| 327 | 322 | ######## |
| 328 | 323 | # fossil stash snapshot ?-m|--comment COMMENT? ?FILES...? |
| 329 | 324 | |
| 330 | -repo_init | |
| 325 | +test_setup | |
| 331 | 326 | write_file f1 "f1" |
| 332 | 327 | write_file f2 "f2" |
| 333 | 328 | write_file f3 "f3" |
| 334 | 329 | fossil add f1 f2 f3 |
| 335 | 330 | fossil commit -m "c1" --tag c1 |
| @@ -362,11 +357,11 @@ | ||
| 362 | 357 | DELETED f1 |
| 363 | 358 | EDITED f2 |
| 364 | 359 | } -addremove { |
| 365 | 360 | } -exists {f0 f2 f3} -notexists {f1} |
| 366 | 361 | fossil stash diff |
| 367 | -test stash-4-2-diff-CODE {!$::CODE} ;# knownBug | |
| 362 | +test stash-4-2-diff-CODE {!$::CODE} knownBug | |
| 368 | 363 | fossil stash show |
| 369 | 364 | test stash-4-2-show-1 {[regexp {DELETE f1} $RESULT]} |
| 370 | 365 | test stash-4-2-show-2 {[regexp {CHANGED f2} $RESULT]} |
| 371 | 366 | test stash-4-2-show-3 {[regexp {ADDED f0} $RESULT]} |
| 372 | 367 | |
| @@ -381,11 +376,11 @@ | ||
| 381 | 376 | EDITED f2 |
| 382 | 377 | RENAMED f3n |
| 383 | 378 | } -addremove { |
| 384 | 379 | } -exists {f0 f2 f3n} -notexists {f1 f3} |
| 385 | 380 | fossil stash diff |
| 386 | -test stash-4-3-diff-CODE {!$::CODE} ;# knownBug | |
| 381 | +test stash-4-3-diff-CODE {!$::CODE} knownBug | |
| 387 | 382 | fossil stash show |
| 388 | 383 | test stash-4-3-show-1 {[regexp {DELETE f1} $RESULT]} |
| 389 | 384 | test stash-4-3-show-2 {[regexp {CHANGED f2} $RESULT]} |
| 390 | 385 | test stash-4-3-show-2 {[regexp {CHANGED f3n} $RESULT]} |
| 391 | 386 | test stash-4-3-show-3 {[regexp {ADDED f0} $RESULT]} |
| @@ -394,5 +389,9 @@ | ||
| 394 | 389 | # fossil stash goto ?STASHID? |
| 395 | 390 | # fossil stash rm|drop ?STASHID? ?-a|--all? |
| 396 | 391 | |
| 397 | 392 | #fossil checkout --force c1 |
| 398 | 393 | #fossil clean |
| 394 | + | |
| 395 | +############################################################################### | |
| 396 | + | |
| 397 | +test_cleanup | |
| 399 | 398 |
| --- test/stash.test | |
| +++ test/stash.test | |
| @@ -90,17 +90,12 @@ | |
| 90 | proc stash-test {testid stashArgs expectedStashOutput args} { |
| 91 | fossil stash {*}$stashArgs |
| 92 | return [test_result_state stash-$testid "stash $stashArgs" $expectedStashOutput {*}$args] |
| 93 | } |
| 94 | |
| 95 | catch {exec $::fossilexe info} res |
| 96 | if {![regexp {use --repository} $res]} { |
| 97 | puts stderr "Cannot run this test within an open checkout" |
| 98 | return |
| 99 | } |
| 100 | |
| 101 | repo_init |
| 102 | |
| 103 | # Prepare first commit |
| 104 | # |
| 105 | write_file f1 "f1" |
| 106 | write_file f2 "f2" |
| @@ -231,11 +226,11 @@ | |
| 231 | # uses the renamed file's original filename. I expect to see the same |
| 232 | # behavior as fossil revert: calmly back out both the rename and the |
| 233 | # add, and presumably stash the content of the added file before it |
| 234 | # is replaced by the revert. |
| 235 | # |
| 236 | repo_init |
| 237 | write_file f1 "f1" |
| 238 | fossil add f1 |
| 239 | fossil commit -m "add f1" |
| 240 | |
| 241 | write_file f1n "f1n" |
| @@ -254,11 +249,11 @@ | |
| 254 | |
| 255 | # Test stashing a newly added (but never committed) file. As with |
| 256 | # fossil revert, fossil stash save unmanages the new file, but |
| 257 | # leaves the copy present on disk. This is undocumented, but |
| 258 | # probably sensible. |
| 259 | repo_init |
| 260 | write_file f1 "f1" |
| 261 | write_file f2 "f2" |
| 262 | fossil add f1 f2 |
| 263 | fossil commit -m "baseline" |
| 264 | |
| @@ -288,21 +283,21 @@ | |
| 288 | |
| 289 | |
| 290 | # Test stashing a rename of one file with at least one file |
| 291 | # unchanged. This should stash (and revert) just the rename |
| 292 | # operation. Instead it also stores and touches the unchanged file. |
| 293 | repo_init |
| 294 | write_file f1 "f1" |
| 295 | write_file f2 "f2" |
| 296 | fossil add f1 f2 |
| 297 | fossil commit -m "baseline" |
| 298 | |
| 299 | fossil mv --hard f2 f2n |
| 300 | test_result_state stash-3-4-mv "mv --hard f2 f2n" { |
| 301 | RENAME f2 f2n |
| 302 | MOVED_FILE f2 |
| 303 | } -changes { |
| 304 | RENAMED f2n |
| 305 | } -addremove { |
| 306 | } -exists {f1 f2n} -notexists {f2} |
| 307 | |
| 308 | stash-test 3-2 {save -m f2n} { |
| @@ -325,11 +320,11 @@ | |
| 325 | |
| 326 | |
| 327 | ######## |
| 328 | # fossil stash snapshot ?-m|--comment COMMENT? ?FILES...? |
| 329 | |
| 330 | repo_init |
| 331 | write_file f1 "f1" |
| 332 | write_file f2 "f2" |
| 333 | write_file f3 "f3" |
| 334 | fossil add f1 f2 f3 |
| 335 | fossil commit -m "c1" --tag c1 |
| @@ -362,11 +357,11 @@ | |
| 362 | DELETED f1 |
| 363 | EDITED f2 |
| 364 | } -addremove { |
| 365 | } -exists {f0 f2 f3} -notexists {f1} |
| 366 | fossil stash diff |
| 367 | test stash-4-2-diff-CODE {!$::CODE} ;# knownBug |
| 368 | fossil stash show |
| 369 | test stash-4-2-show-1 {[regexp {DELETE f1} $RESULT]} |
| 370 | test stash-4-2-show-2 {[regexp {CHANGED f2} $RESULT]} |
| 371 | test stash-4-2-show-3 {[regexp {ADDED f0} $RESULT]} |
| 372 | |
| @@ -381,11 +376,11 @@ | |
| 381 | EDITED f2 |
| 382 | RENAMED f3n |
| 383 | } -addremove { |
| 384 | } -exists {f0 f2 f3n} -notexists {f1 f3} |
| 385 | fossil stash diff |
| 386 | test stash-4-3-diff-CODE {!$::CODE} ;# knownBug |
| 387 | fossil stash show |
| 388 | test stash-4-3-show-1 {[regexp {DELETE f1} $RESULT]} |
| 389 | test stash-4-3-show-2 {[regexp {CHANGED f2} $RESULT]} |
| 390 | test stash-4-3-show-2 {[regexp {CHANGED f3n} $RESULT]} |
| 391 | test stash-4-3-show-3 {[regexp {ADDED f0} $RESULT]} |
| @@ -394,5 +389,9 @@ | |
| 394 | # fossil stash goto ?STASHID? |
| 395 | # fossil stash rm|drop ?STASHID? ?-a|--all? |
| 396 | |
| 397 | #fossil checkout --force c1 |
| 398 | #fossil clean |
| 399 |
| --- test/stash.test | |
| +++ test/stash.test | |
| @@ -90,17 +90,12 @@ | |
| 90 | proc stash-test {testid stashArgs expectedStashOutput args} { |
| 91 | fossil stash {*}$stashArgs |
| 92 | return [test_result_state stash-$testid "stash $stashArgs" $expectedStashOutput {*}$args] |
| 93 | } |
| 94 | |
| 95 | require_no_open_checkout |
| 96 | test_setup |
| 97 | |
| 98 | # Prepare first commit |
| 99 | # |
| 100 | write_file f1 "f1" |
| 101 | write_file f2 "f2" |
| @@ -231,11 +226,11 @@ | |
| 226 | # uses the renamed file's original filename. I expect to see the same |
| 227 | # behavior as fossil revert: calmly back out both the rename and the |
| 228 | # add, and presumably stash the content of the added file before it |
| 229 | # is replaced by the revert. |
| 230 | # |
| 231 | test_setup |
| 232 | write_file f1 "f1" |
| 233 | fossil add f1 |
| 234 | fossil commit -m "add f1" |
| 235 | |
| 236 | write_file f1n "f1n" |
| @@ -254,11 +249,11 @@ | |
| 249 | |
| 250 | # Test stashing a newly added (but never committed) file. As with |
| 251 | # fossil revert, fossil stash save unmanages the new file, but |
| 252 | # leaves the copy present on disk. This is undocumented, but |
| 253 | # probably sensible. |
| 254 | test_setup |
| 255 | write_file f1 "f1" |
| 256 | write_file f2 "f2" |
| 257 | fossil add f1 f2 |
| 258 | fossil commit -m "baseline" |
| 259 | |
| @@ -288,21 +283,21 @@ | |
| 283 | |
| 284 | |
| 285 | # Test stashing a rename of one file with at least one file |
| 286 | # unchanged. This should stash (and revert) just the rename |
| 287 | # operation. Instead it also stores and touches the unchanged file. |
| 288 | test_setup |
| 289 | write_file f1 "f1" |
| 290 | write_file f2 "f2" |
| 291 | fossil add f1 f2 |
| 292 | fossil commit -m "baseline" |
| 293 | |
| 294 | fossil mv --hard f2 f2n |
| 295 | test_result_state stash-3-2-mv "mv --hard f2 f2n" [concat { |
| 296 | RENAME f2 f2n |
| 297 | MOVED_FILE} [file normalize f2] { |
| 298 | }] -changes { |
| 299 | RENAMED f2n |
| 300 | } -addremove { |
| 301 | } -exists {f1 f2n} -notexists {f2} |
| 302 | |
| 303 | stash-test 3-2 {save -m f2n} { |
| @@ -325,11 +320,11 @@ | |
| 320 | |
| 321 | |
| 322 | ######## |
| 323 | # fossil stash snapshot ?-m|--comment COMMENT? ?FILES...? |
| 324 | |
| 325 | test_setup |
| 326 | write_file f1 "f1" |
| 327 | write_file f2 "f2" |
| 328 | write_file f3 "f3" |
| 329 | fossil add f1 f2 f3 |
| 330 | fossil commit -m "c1" --tag c1 |
| @@ -362,11 +357,11 @@ | |
| 357 | DELETED f1 |
| 358 | EDITED f2 |
| 359 | } -addremove { |
| 360 | } -exists {f0 f2 f3} -notexists {f1} |
| 361 | fossil stash diff |
| 362 | test stash-4-2-diff-CODE {!$::CODE} knownBug |
| 363 | fossil stash show |
| 364 | test stash-4-2-show-1 {[regexp {DELETE f1} $RESULT]} |
| 365 | test stash-4-2-show-2 {[regexp {CHANGED f2} $RESULT]} |
| 366 | test stash-4-2-show-3 {[regexp {ADDED f0} $RESULT]} |
| 367 | |
| @@ -381,11 +376,11 @@ | |
| 376 | EDITED f2 |
| 377 | RENAMED f3n |
| 378 | } -addremove { |
| 379 | } -exists {f0 f2 f3n} -notexists {f1 f3} |
| 380 | fossil stash diff |
| 381 | test stash-4-3-diff-CODE {!$::CODE} knownBug |
| 382 | fossil stash show |
| 383 | test stash-4-3-show-1 {[regexp {DELETE f1} $RESULT]} |
| 384 | test stash-4-3-show-2 {[regexp {CHANGED f2} $RESULT]} |
| 385 | test stash-4-3-show-2 {[regexp {CHANGED f3n} $RESULT]} |
| 386 | test stash-4-3-show-3 {[regexp {ADDED f0} $RESULT]} |
| @@ -394,5 +389,9 @@ | |
| 389 | # fossil stash goto ?STASHID? |
| 390 | # fossil stash rm|drop ?STASHID? ?-a|--all? |
| 391 | |
| 392 | #fossil checkout --force c1 |
| 393 | #fossil clean |
| 394 | |
| 395 | ############################################################################### |
| 396 | |
| 397 | test_cleanup |
| 398 |
+202
-30
| --- test/tester.tcl | ||
| +++ test/tester.tcl | ||
| @@ -32,10 +32,18 @@ | ||
| 32 | 32 | [string length [file extension $fossilexe]] == 0} { |
| 33 | 33 | append fossilexe .exe |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | set argv [lrange $argv 1 end] |
| 37 | + | |
| 38 | +set i [lsearch $argv -keep] | |
| 39 | +if {$i>=0} { | |
| 40 | + set KEEP 1 | |
| 41 | + set argv [lreplace $argv $i $i] | |
| 42 | +} else { | |
| 43 | + set KEEP 0 | |
| 44 | +} | |
| 37 | 45 | |
| 38 | 46 | set i [lsearch $argv -halt] |
| 39 | 47 | if {$i>=0} { |
| 40 | 48 | set HALT 1 |
| 41 | 49 | set argv [lreplace $argv $i $i] |
| @@ -189,30 +197,134 @@ | ||
| 189 | 197 | set y [read_file $b] |
| 190 | 198 | regsub -all { +\n} $y \n y |
| 191 | 199 | return [expr {$x==$y}] |
| 192 | 200 | } |
| 193 | 201 | |
| 202 | +proc require_no_open_checkout {} { | |
| 203 | + if {[info exists ::env(FOSSIL_TEST_DANGEROUS_IGNORE_OPEN_CHECKOUT)] && \ | |
| 204 | + $::env(FOSSIL_TEST_DANGEROUS_IGNORE_OPEN_CHECKOUT) eq "YES_DO_IT"} { | |
| 205 | + return | |
| 206 | + } | |
| 207 | + catch {exec $::fossilexe info} res | |
| 208 | + if {![regexp {use --repository} $res]} { | |
| 209 | + set projectName <unknown> | |
| 210 | + set localRoot <unknown> | |
| 211 | + regexp -line -- {^project-name: (.*)$} $res dummy projectName | |
| 212 | + set projectName [string trim $projectName] | |
| 213 | + regexp -line -- {^local-root: (.*)$} $res dummy localRoot | |
| 214 | + set localRoot [string trim $localRoot] | |
| 215 | + error "Detected an open checkout of project \"$projectName\",\ | |
| 216 | +rooted at \"$localRoot\", testing halted." | |
| 217 | + } | |
| 218 | +} | |
| 219 | + | |
| 220 | +proc get_script_or_fail {} { | |
| 221 | + set fileName [file normalize [info script]] | |
| 222 | + if {[string length $fileName] == 0 || ![file exists $fileName]} { | |
| 223 | + error "Failed to obtain the file name of the test being run." | |
| 224 | + } | |
| 225 | + return $fileName | |
| 226 | +} | |
| 227 | + | |
| 228 | +proc robust_delete { path {force ""} } { | |
| 229 | + set error "unknown error" | |
| 230 | + for {set try 0} {$try < 10} {incr try} { | |
| 231 | + if {$force eq "YES_DO_IT"} { | |
| 232 | + if {[catch {file delete -force $path} error] == 0} { | |
| 233 | + return | |
| 234 | + } | |
| 235 | + } else { | |
| 236 | + if {[catch {file delete $path} error] == 0} { | |
| 237 | + return | |
| 238 | + } | |
| 239 | + } | |
| 240 | + after [expr {$try * 100}] | |
| 241 | + } | |
| 242 | + error "Could not delete \"$path\", error: $error" | |
| 243 | +} | |
| 244 | + | |
| 245 | +proc test_cleanup_then_return {} { | |
| 246 | + uplevel 1 [list test_cleanup] | |
| 247 | + return -code return | |
| 248 | +} | |
| 249 | + | |
| 250 | +proc test_cleanup {} { | |
| 251 | + if {$::KEEP} {return}; # All cleanup disabled? | |
| 252 | + if {![info exists ::tempRepoPath]} {return} | |
| 253 | + if {![file exists $::tempRepoPath]} {return} | |
| 254 | + if {![file isdirectory $::tempRepoPath]} {return} | |
| 255 | + set tempPathEnd [expr {[string length $::tempPath] - 1}] | |
| 256 | + if {[string length $::tempPath] == 0 || \ | |
| 257 | + [string range $::tempRepoPath 0 $tempPathEnd] ne $::tempPath} { | |
| 258 | + error "Temporary repository path has wrong parent during cleanup." | |
| 259 | + } | |
| 260 | + if {[info exists ::tempSavedPwd]} {cd $::tempSavedPwd; unset ::tempSavedPwd} | |
| 261 | + # First, attempt to delete the specific temporary repository directories | |
| 262 | + # for this test file. | |
| 263 | + set scriptName [file tail [get_script_or_fail]] | |
| 264 | + foreach repoSeed $::tempRepoSeeds { | |
| 265 | + set repoPath [file join $::tempRepoPath $repoSeed $scriptName] | |
| 266 | + robust_delete $repoPath YES_DO_IT; # FORCE, arbitrary children. | |
| 267 | + set seedPath [file join $::tempRepoPath $repoSeed] | |
| 268 | + robust_delete $seedPath; # NO FORCE. | |
| 269 | + } | |
| 270 | + # Next, attempt to gracefully delete the temporary repository directory | |
| 271 | + # for this process. | |
| 272 | + robust_delete $::tempRepoPath | |
| 273 | + # Finally, attempt to gracefully delete the temporary home directory, | |
| 274 | + # unless forbidden by external forces. | |
| 275 | + if {![info exists ::tempKeepHome]} {delete_temporary_home} | |
| 276 | +} | |
| 277 | + | |
| 278 | +proc delete_temporary_home {} { | |
| 279 | + if {$::KEEP} {return}; # All cleanup disabled? | |
| 280 | + if {$::tcl_platform(platform) eq "windows"} { | |
| 281 | + robust_delete [file join $::tempHomePath _fossil] | |
| 282 | + } else { | |
| 283 | + robust_delete [file join $::tempHomePath .fossil] | |
| 284 | + } | |
| 285 | + robust_delete $::tempHomePath | |
| 286 | +} | |
| 287 | + | |
| 288 | +proc is_home_elsewhere {} { | |
| 289 | + return [expr {[info exists ::env(FOSSIL_HOME)] && \ | |
| 290 | + $::env(FOSSIL_HOME) eq $::tempHomePath}] | |
| 291 | +} | |
| 292 | + | |
| 293 | +proc set_home_to_elsewhere {} { | |
| 294 | + # | |
| 295 | + # Fossil will write data on $HOME (or $FOSSIL_HOME). We need not | |
| 296 | + # to clutter the real $HOME (or $FOSSIL_HOME) of the test caller. | |
| 297 | + # | |
| 298 | + if {[is_home_elsewhere]} {return} | |
| 299 | + set ::env(FOSSIL_HOME) $::tempHomePath | |
| 300 | +} | |
| 301 | + | |
| 302 | +# | |
| 194 | 303 | # Create and open a new Fossil repository and clean the checkout |
| 195 | 304 | # |
| 196 | -proc repo_init {{filename ".rep.fossil"}} { | |
| 197 | - if {$::env(HOME) ne [pwd]} { | |
| 198 | - catch {exec $::fossilexe info} res | |
| 199 | - if {![regexp {use --repository} $res]} { | |
| 200 | - error "In an open checkout: cannot initialize a new repository here." | |
| 201 | - } | |
| 202 | - # Fossil will write data on $FOSSIL_HOME, running 'fossil new' here. | |
| 203 | - # We need not to clutter the $HOME of the test caller. | |
| 204 | - # | |
| 205 | - set ::env(FOSSIL_HOME) [pwd] | |
| 206 | - set ::env(HOME) [pwd] | |
| 207 | - } | |
| 208 | - catch {exec $::fossilexe close -f} | |
| 209 | - file delete $filename | |
| 210 | - exec $::fossilexe new $filename | |
| 211 | - exec $::fossilexe open $filename | |
| 212 | - exec $::fossilexe clean -f | |
| 213 | - exec $::fossilexe set mtime-changes off | |
| 305 | +proc test_setup {{filename ".rep.fossil"}} { | |
| 306 | + set_home_to_elsewhere | |
| 307 | + if {![info exists ::tempRepoPath]} { | |
| 308 | + set ::tempRepoPath [file join $::tempPath repo_[pid]] | |
| 309 | + } | |
| 310 | + set repoSeed [appendArgs [string trim [clock seconds] -] _ [getSeqNo]] | |
| 311 | + lappend ::tempRepoSeeds $repoSeed | |
| 312 | + set repoPath [file join \ | |
| 313 | + $::tempRepoPath $repoSeed [file tail [get_script_or_fail]]] | |
| 314 | + if {[catch { | |
| 315 | + file mkdir $repoPath | |
| 316 | + } error] != 0} { | |
| 317 | + error "Could not make directory \"$repoPath\",\ | |
| 318 | +please set TEMP variable in environment, error: $error" | |
| 319 | + } | |
| 320 | + if {![info exists ::tempSavedPwd]} {set ::tempSavedPwd [pwd]}; cd $repoPath | |
| 321 | + if {[string length $filename] > 0} { | |
| 322 | + exec $::fossilexe new $filename | |
| 323 | + exec $::fossilexe open $filename | |
| 324 | + exec $::fossilexe set mtime-changes off | |
| 325 | + } | |
| 214 | 326 | } |
| 215 | 327 | |
| 216 | 328 | # This procedure only returns non-zero if the Tcl integration feature was |
| 217 | 329 | # enabled at compile-time and is now enabled at runtime. |
| 218 | 330 | proc is_tcl_usable_by_fossil {} { |
| @@ -284,10 +396,67 @@ | ||
| 284 | 396 | # Append all arguments into a single value and then returns it. |
| 285 | 397 | # |
| 286 | 398 | proc appendArgs {args} { |
| 287 | 399 | eval append result $args |
| 288 | 400 | } |
| 401 | + | |
| 402 | +# Returns the value of the specified environment variable -OR- any empty | |
| 403 | +# string if it does not exist. | |
| 404 | +# | |
| 405 | +proc getEnvironmentVariable { name } { | |
| 406 | + return [expr {[info exists ::env($name)] ? $::env($name) : ""}] | |
| 407 | +} | |
| 408 | + | |
| 409 | +# Returns a usable temporary directory -OR- fails the testing process. | |
| 410 | +# | |
| 411 | +proc getTemporaryPath {} { | |
| 412 | + # | |
| 413 | + # NOTE: Build the list of "temporary directory" environment variables | |
| 414 | + # to check, including all reasonable "cases" of the environment | |
| 415 | + # variable names. | |
| 416 | + # | |
| 417 | + set names [list] | |
| 418 | + | |
| 419 | + # | |
| 420 | + # TODO: Add more here, if necessary. | |
| 421 | + # | |
| 422 | + foreach name [list FOSSIL_TEST_TEMP FOSSIL_TEMP TEMP TMP] { | |
| 423 | + lappend names [string toupper $name] [string tolower $name] \ | |
| 424 | + [string totitle $name] | |
| 425 | + } | |
| 426 | + | |
| 427 | + # | |
| 428 | + # NOTE: Check if we can use any of the environment variables. | |
| 429 | + # | |
| 430 | + foreach name $names { | |
| 431 | + set value [getEnvironmentVariable $name] | |
| 432 | + | |
| 433 | + if {[string length $value] > 0} then { | |
| 434 | + set value [file normalize $value] | |
| 435 | + | |
| 436 | + if {[file exists $value] && [file isdirectory $value]} then { | |
| 437 | + return $value | |
| 438 | + } | |
| 439 | + } | |
| 440 | + } | |
| 441 | + | |
| 442 | + # | |
| 443 | + # NOTE: On non-Windows systems, fallback to /tmp if it is usable. | |
| 444 | + # | |
| 445 | + if {$::tcl_platform(platform) ne "windows"} { | |
| 446 | + set value /tmp | |
| 447 | + | |
| 448 | + if {[file exists $value] && [file isdirectory $value]} then { | |
| 449 | + return $value | |
| 450 | + } | |
| 451 | + } | |
| 452 | + | |
| 453 | + # | |
| 454 | + # NOTE: There must be a usable temporary directory to continue testing. | |
| 455 | + # | |
| 456 | + error "Cannot find a usable temporary directory, testing halted." | |
| 457 | +} | |
| 289 | 458 | |
| 290 | 459 | # Return the name of the versioned settings file containing the TH1 |
| 291 | 460 | # setup script. |
| 292 | 461 | # |
| 293 | 462 | proc getTh1SetupFileName {} { |
| @@ -498,38 +667,41 @@ | ||
| 498 | 667 | # returns the third to last line of the normalized result. |
| 499 | 668 | proc third_to_last_data_line {} { |
| 500 | 669 | return [lindex [split [normalize_result] \n] end-2] |
| 501 | 670 | } |
| 502 | 671 | |
| 503 | -set tempPath [expr {[info exists env(TEMP)] ? \ | |
| 504 | - $env(TEMP) : [file dirname [info script]]}] | |
| 672 | +set tempPath [getTemporaryPath] | |
| 505 | 673 | |
| 506 | 674 | if {$tcl_platform(platform) eq "windows"} { |
| 507 | 675 | set tempPath [string map [list \\ /] $tempPath] |
| 508 | 676 | } |
| 509 | 677 | |
| 510 | -set tempPath [file normalize $tempPath] | |
| 678 | +if {[catch { | |
| 679 | + set tempFile [file join $tempPath temporary.txt] | |
| 680 | + write_file $tempFile [clock seconds]; file delete $tempFile | |
| 681 | +} error] != 0} { | |
| 682 | + error "Could not write file \"$tempFile\" in directory \"$tempPath\",\ | |
| 683 | +please set TEMP variable in environment, error: $error" | |
| 684 | +} | |
| 685 | + | |
| 686 | +set tempHomePath [file join $tempPath home_[pid]] | |
| 511 | 687 | |
| 512 | 688 | if {[catch { |
| 513 | - write_file [file join $tempPath temporary.txt] [clock seconds] | |
| 689 | + file mkdir $tempHomePath | |
| 514 | 690 | } error] != 0} { |
| 515 | - error "could not write file to directory \"$tempPath\",\ | |
| 516 | -please set TEMP variable in environment: $error" | |
| 691 | + error "Could not make directory \"$tempHomePath\",\ | |
| 692 | +please set TEMP variable in environment, error: $error" | |
| 517 | 693 | } |
| 518 | 694 | |
| 519 | 695 | protInit $fossilexe |
| 696 | +set ::tempKeepHome 1 | |
| 520 | 697 | foreach testfile $argv { |
| 521 | - set dir [file root [file tail $testfile]] | |
| 522 | - file delete -force $dir | |
| 523 | - file mkdir $dir | |
| 524 | - set origwd [pwd] | |
| 525 | - cd $dir | |
| 526 | 698 | protOut "***** $testfile ******" |
| 527 | 699 | source $testdir/$testfile.test |
| 528 | 700 | protOut "***** End of $testfile: [llength $bad_test] errors so far ******" |
| 529 | - cd $origwd | |
| 530 | 701 | } |
| 702 | +unset ::tempKeepHome; delete_temporary_home | |
| 531 | 703 | set nErr [llength $bad_test] |
| 532 | 704 | if {$nErr>0 || !$::QUIET} { |
| 533 | 705 | protOut "***** Final results: $nErr errors out of $test_count tests" 1 |
| 534 | 706 | } |
| 535 | 707 | if {$nErr>0} { |
| 536 | 708 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -32,10 +32,18 @@ | |
| 32 | [string length [file extension $fossilexe]] == 0} { |
| 33 | append fossilexe .exe |
| 34 | } |
| 35 | |
| 36 | set argv [lrange $argv 1 end] |
| 37 | |
| 38 | set i [lsearch $argv -halt] |
| 39 | if {$i>=0} { |
| 40 | set HALT 1 |
| 41 | set argv [lreplace $argv $i $i] |
| @@ -189,30 +197,134 @@ | |
| 189 | set y [read_file $b] |
| 190 | regsub -all { +\n} $y \n y |
| 191 | return [expr {$x==$y}] |
| 192 | } |
| 193 | |
| 194 | # Create and open a new Fossil repository and clean the checkout |
| 195 | # |
| 196 | proc repo_init {{filename ".rep.fossil"}} { |
| 197 | if {$::env(HOME) ne [pwd]} { |
| 198 | catch {exec $::fossilexe info} res |
| 199 | if {![regexp {use --repository} $res]} { |
| 200 | error "In an open checkout: cannot initialize a new repository here." |
| 201 | } |
| 202 | # Fossil will write data on $FOSSIL_HOME, running 'fossil new' here. |
| 203 | # We need not to clutter the $HOME of the test caller. |
| 204 | # |
| 205 | set ::env(FOSSIL_HOME) [pwd] |
| 206 | set ::env(HOME) [pwd] |
| 207 | } |
| 208 | catch {exec $::fossilexe close -f} |
| 209 | file delete $filename |
| 210 | exec $::fossilexe new $filename |
| 211 | exec $::fossilexe open $filename |
| 212 | exec $::fossilexe clean -f |
| 213 | exec $::fossilexe set mtime-changes off |
| 214 | } |
| 215 | |
| 216 | # This procedure only returns non-zero if the Tcl integration feature was |
| 217 | # enabled at compile-time and is now enabled at runtime. |
| 218 | proc is_tcl_usable_by_fossil {} { |
| @@ -284,10 +396,67 @@ | |
| 284 | # Append all arguments into a single value and then returns it. |
| 285 | # |
| 286 | proc appendArgs {args} { |
| 287 | eval append result $args |
| 288 | } |
| 289 | |
| 290 | # Return the name of the versioned settings file containing the TH1 |
| 291 | # setup script. |
| 292 | # |
| 293 | proc getTh1SetupFileName {} { |
| @@ -498,38 +667,41 @@ | |
| 498 | # returns the third to last line of the normalized result. |
| 499 | proc third_to_last_data_line {} { |
| 500 | return [lindex [split [normalize_result] \n] end-2] |
| 501 | } |
| 502 | |
| 503 | set tempPath [expr {[info exists env(TEMP)] ? \ |
| 504 | $env(TEMP) : [file dirname [info script]]}] |
| 505 | |
| 506 | if {$tcl_platform(platform) eq "windows"} { |
| 507 | set tempPath [string map [list \\ /] $tempPath] |
| 508 | } |
| 509 | |
| 510 | set tempPath [file normalize $tempPath] |
| 511 | |
| 512 | if {[catch { |
| 513 | write_file [file join $tempPath temporary.txt] [clock seconds] |
| 514 | } error] != 0} { |
| 515 | error "could not write file to directory \"$tempPath\",\ |
| 516 | please set TEMP variable in environment: $error" |
| 517 | } |
| 518 | |
| 519 | protInit $fossilexe |
| 520 | foreach testfile $argv { |
| 521 | set dir [file root [file tail $testfile]] |
| 522 | file delete -force $dir |
| 523 | file mkdir $dir |
| 524 | set origwd [pwd] |
| 525 | cd $dir |
| 526 | protOut "***** $testfile ******" |
| 527 | source $testdir/$testfile.test |
| 528 | protOut "***** End of $testfile: [llength $bad_test] errors so far ******" |
| 529 | cd $origwd |
| 530 | } |
| 531 | set nErr [llength $bad_test] |
| 532 | if {$nErr>0 || !$::QUIET} { |
| 533 | protOut "***** Final results: $nErr errors out of $test_count tests" 1 |
| 534 | } |
| 535 | if {$nErr>0} { |
| 536 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -32,10 +32,18 @@ | |
| 32 | [string length [file extension $fossilexe]] == 0} { |
| 33 | append fossilexe .exe |
| 34 | } |
| 35 | |
| 36 | set argv [lrange $argv 1 end] |
| 37 | |
| 38 | set i [lsearch $argv -keep] |
| 39 | if {$i>=0} { |
| 40 | set KEEP 1 |
| 41 | set argv [lreplace $argv $i $i] |
| 42 | } else { |
| 43 | set KEEP 0 |
| 44 | } |
| 45 | |
| 46 | set i [lsearch $argv -halt] |
| 47 | if {$i>=0} { |
| 48 | set HALT 1 |
| 49 | set argv [lreplace $argv $i $i] |
| @@ -189,30 +197,134 @@ | |
| 197 | set y [read_file $b] |
| 198 | regsub -all { +\n} $y \n y |
| 199 | return [expr {$x==$y}] |
| 200 | } |
| 201 | |
| 202 | proc require_no_open_checkout {} { |
| 203 | if {[info exists ::env(FOSSIL_TEST_DANGEROUS_IGNORE_OPEN_CHECKOUT)] && \ |
| 204 | $::env(FOSSIL_TEST_DANGEROUS_IGNORE_OPEN_CHECKOUT) eq "YES_DO_IT"} { |
| 205 | return |
| 206 | } |
| 207 | catch {exec $::fossilexe info} res |
| 208 | if {![regexp {use --repository} $res]} { |
| 209 | set projectName <unknown> |
| 210 | set localRoot <unknown> |
| 211 | regexp -line -- {^project-name: (.*)$} $res dummy projectName |
| 212 | set projectName [string trim $projectName] |
| 213 | regexp -line -- {^local-root: (.*)$} $res dummy localRoot |
| 214 | set localRoot [string trim $localRoot] |
| 215 | error "Detected an open checkout of project \"$projectName\",\ |
| 216 | rooted at \"$localRoot\", testing halted." |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | proc get_script_or_fail {} { |
| 221 | set fileName [file normalize [info script]] |
| 222 | if {[string length $fileName] == 0 || ![file exists $fileName]} { |
| 223 | error "Failed to obtain the file name of the test being run." |
| 224 | } |
| 225 | return $fileName |
| 226 | } |
| 227 | |
| 228 | proc robust_delete { path {force ""} } { |
| 229 | set error "unknown error" |
| 230 | for {set try 0} {$try < 10} {incr try} { |
| 231 | if {$force eq "YES_DO_IT"} { |
| 232 | if {[catch {file delete -force $path} error] == 0} { |
| 233 | return |
| 234 | } |
| 235 | } else { |
| 236 | if {[catch {file delete $path} error] == 0} { |
| 237 | return |
| 238 | } |
| 239 | } |
| 240 | after [expr {$try * 100}] |
| 241 | } |
| 242 | error "Could not delete \"$path\", error: $error" |
| 243 | } |
| 244 | |
| 245 | proc test_cleanup_then_return {} { |
| 246 | uplevel 1 [list test_cleanup] |
| 247 | return -code return |
| 248 | } |
| 249 | |
| 250 | proc test_cleanup {} { |
| 251 | if {$::KEEP} {return}; # All cleanup disabled? |
| 252 | if {![info exists ::tempRepoPath]} {return} |
| 253 | if {![file exists $::tempRepoPath]} {return} |
| 254 | if {![file isdirectory $::tempRepoPath]} {return} |
| 255 | set tempPathEnd [expr {[string length $::tempPath] - 1}] |
| 256 | if {[string length $::tempPath] == 0 || \ |
| 257 | [string range $::tempRepoPath 0 $tempPathEnd] ne $::tempPath} { |
| 258 | error "Temporary repository path has wrong parent during cleanup." |
| 259 | } |
| 260 | if {[info exists ::tempSavedPwd]} {cd $::tempSavedPwd; unset ::tempSavedPwd} |
| 261 | # First, attempt to delete the specific temporary repository directories |
| 262 | # for this test file. |
| 263 | set scriptName [file tail [get_script_or_fail]] |
| 264 | foreach repoSeed $::tempRepoSeeds { |
| 265 | set repoPath [file join $::tempRepoPath $repoSeed $scriptName] |
| 266 | robust_delete $repoPath YES_DO_IT; # FORCE, arbitrary children. |
| 267 | set seedPath [file join $::tempRepoPath $repoSeed] |
| 268 | robust_delete $seedPath; # NO FORCE. |
| 269 | } |
| 270 | # Next, attempt to gracefully delete the temporary repository directory |
| 271 | # for this process. |
| 272 | robust_delete $::tempRepoPath |
| 273 | # Finally, attempt to gracefully delete the temporary home directory, |
| 274 | # unless forbidden by external forces. |
| 275 | if {![info exists ::tempKeepHome]} {delete_temporary_home} |
| 276 | } |
| 277 | |
| 278 | proc delete_temporary_home {} { |
| 279 | if {$::KEEP} {return}; # All cleanup disabled? |
| 280 | if {$::tcl_platform(platform) eq "windows"} { |
| 281 | robust_delete [file join $::tempHomePath _fossil] |
| 282 | } else { |
| 283 | robust_delete [file join $::tempHomePath .fossil] |
| 284 | } |
| 285 | robust_delete $::tempHomePath |
| 286 | } |
| 287 | |
| 288 | proc is_home_elsewhere {} { |
| 289 | return [expr {[info exists ::env(FOSSIL_HOME)] && \ |
| 290 | $::env(FOSSIL_HOME) eq $::tempHomePath}] |
| 291 | } |
| 292 | |
| 293 | proc set_home_to_elsewhere {} { |
| 294 | # |
| 295 | # Fossil will write data on $HOME (or $FOSSIL_HOME). We need not |
| 296 | # to clutter the real $HOME (or $FOSSIL_HOME) of the test caller. |
| 297 | # |
| 298 | if {[is_home_elsewhere]} {return} |
| 299 | set ::env(FOSSIL_HOME) $::tempHomePath |
| 300 | } |
| 301 | |
| 302 | # |
| 303 | # Create and open a new Fossil repository and clean the checkout |
| 304 | # |
| 305 | proc test_setup {{filename ".rep.fossil"}} { |
| 306 | set_home_to_elsewhere |
| 307 | if {![info exists ::tempRepoPath]} { |
| 308 | set ::tempRepoPath [file join $::tempPath repo_[pid]] |
| 309 | } |
| 310 | set repoSeed [appendArgs [string trim [clock seconds] -] _ [getSeqNo]] |
| 311 | lappend ::tempRepoSeeds $repoSeed |
| 312 | set repoPath [file join \ |
| 313 | $::tempRepoPath $repoSeed [file tail [get_script_or_fail]]] |
| 314 | if {[catch { |
| 315 | file mkdir $repoPath |
| 316 | } error] != 0} { |
| 317 | error "Could not make directory \"$repoPath\",\ |
| 318 | please set TEMP variable in environment, error: $error" |
| 319 | } |
| 320 | if {![info exists ::tempSavedPwd]} {set ::tempSavedPwd [pwd]}; cd $repoPath |
| 321 | if {[string length $filename] > 0} { |
| 322 | exec $::fossilexe new $filename |
| 323 | exec $::fossilexe open $filename |
| 324 | exec $::fossilexe set mtime-changes off |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | # This procedure only returns non-zero if the Tcl integration feature was |
| 329 | # enabled at compile-time and is now enabled at runtime. |
| 330 | proc is_tcl_usable_by_fossil {} { |
| @@ -284,10 +396,67 @@ | |
| 396 | # Append all arguments into a single value and then returns it. |
| 397 | # |
| 398 | proc appendArgs {args} { |
| 399 | eval append result $args |
| 400 | } |
| 401 | |
| 402 | # Returns the value of the specified environment variable -OR- any empty |
| 403 | # string if it does not exist. |
| 404 | # |
| 405 | proc getEnvironmentVariable { name } { |
| 406 | return [expr {[info exists ::env($name)] ? $::env($name) : ""}] |
| 407 | } |
| 408 | |
| 409 | # Returns a usable temporary directory -OR- fails the testing process. |
| 410 | # |
| 411 | proc getTemporaryPath {} { |
| 412 | # |
| 413 | # NOTE: Build the list of "temporary directory" environment variables |
| 414 | # to check, including all reasonable "cases" of the environment |
| 415 | # variable names. |
| 416 | # |
| 417 | set names [list] |
| 418 | |
| 419 | # |
| 420 | # TODO: Add more here, if necessary. |
| 421 | # |
| 422 | foreach name [list FOSSIL_TEST_TEMP FOSSIL_TEMP TEMP TMP] { |
| 423 | lappend names [string toupper $name] [string tolower $name] \ |
| 424 | [string totitle $name] |
| 425 | } |
| 426 | |
| 427 | # |
| 428 | # NOTE: Check if we can use any of the environment variables. |
| 429 | # |
| 430 | foreach name $names { |
| 431 | set value [getEnvironmentVariable $name] |
| 432 | |
| 433 | if {[string length $value] > 0} then { |
| 434 | set value [file normalize $value] |
| 435 | |
| 436 | if {[file exists $value] && [file isdirectory $value]} then { |
| 437 | return $value |
| 438 | } |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | # |
| 443 | # NOTE: On non-Windows systems, fallback to /tmp if it is usable. |
| 444 | # |
| 445 | if {$::tcl_platform(platform) ne "windows"} { |
| 446 | set value /tmp |
| 447 | |
| 448 | if {[file exists $value] && [file isdirectory $value]} then { |
| 449 | return $value |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | # |
| 454 | # NOTE: There must be a usable temporary directory to continue testing. |
| 455 | # |
| 456 | error "Cannot find a usable temporary directory, testing halted." |
| 457 | } |
| 458 | |
| 459 | # Return the name of the versioned settings file containing the TH1 |
| 460 | # setup script. |
| 461 | # |
| 462 | proc getTh1SetupFileName {} { |
| @@ -498,38 +667,41 @@ | |
| 667 | # returns the third to last line of the normalized result. |
| 668 | proc third_to_last_data_line {} { |
| 669 | return [lindex [split [normalize_result] \n] end-2] |
| 670 | } |
| 671 | |
| 672 | set tempPath [getTemporaryPath] |
| 673 | |
| 674 | if {$tcl_platform(platform) eq "windows"} { |
| 675 | set tempPath [string map [list \\ /] $tempPath] |
| 676 | } |
| 677 | |
| 678 | if {[catch { |
| 679 | set tempFile [file join $tempPath temporary.txt] |
| 680 | write_file $tempFile [clock seconds]; file delete $tempFile |
| 681 | } error] != 0} { |
| 682 | error "Could not write file \"$tempFile\" in directory \"$tempPath\",\ |
| 683 | please set TEMP variable in environment, error: $error" |
| 684 | } |
| 685 | |
| 686 | set tempHomePath [file join $tempPath home_[pid]] |
| 687 | |
| 688 | if {[catch { |
| 689 | file mkdir $tempHomePath |
| 690 | } error] != 0} { |
| 691 | error "Could not make directory \"$tempHomePath\",\ |
| 692 | please set TEMP variable in environment, error: $error" |
| 693 | } |
| 694 | |
| 695 | protInit $fossilexe |
| 696 | set ::tempKeepHome 1 |
| 697 | foreach testfile $argv { |
| 698 | protOut "***** $testfile ******" |
| 699 | source $testdir/$testfile.test |
| 700 | protOut "***** End of $testfile: [llength $bad_test] errors so far ******" |
| 701 | } |
| 702 | unset ::tempKeepHome; delete_temporary_home |
| 703 | set nErr [llength $bad_test] |
| 704 | if {$nErr>0 || !$::QUIET} { |
| 705 | protOut "***** Final results: $nErr errors out of $test_count tests" 1 |
| 706 | } |
| 707 | if {$nErr>0} { |
| 708 |
+15
-5
| --- test/th1-docs.test | ||
| +++ test/th1-docs.test | ||
| @@ -18,19 +18,25 @@ | ||
| 18 | 18 | # TH1 Docs |
| 19 | 19 | # |
| 20 | 20 | |
| 21 | 21 | fossil test-th-eval "hasfeature th1Docs" |
| 22 | 22 | |
| 23 | -if {$::RESULT ne "1"} then { | |
| 24 | - puts "Fossil was not compiled with TH1 docs support."; return | |
| 23 | +if {$::RESULT ne "1"} { | |
| 24 | + puts "Fossil was not compiled with TH1 docs support." | |
| 25 | + test_cleanup_then_return | |
| 25 | 26 | } |
| 26 | 27 | |
| 27 | 28 | fossil test-th-eval "hasfeature tcl" |
| 28 | 29 | |
| 29 | -if {$::RESULT ne "1"} then { | |
| 30 | - puts "Fossil was not compiled with Tcl support."; return | |
| 30 | +if {$::RESULT ne "1"} { | |
| 31 | + puts "Fossil was not compiled with Tcl support." | |
| 32 | + test_cleanup_then_return | |
| 31 | 33 | } |
| 34 | + | |
| 35 | +############################################################################### | |
| 36 | + | |
| 37 | +test_setup "" | |
| 32 | 38 | |
| 33 | 39 | ############################################################################### |
| 34 | 40 | |
| 35 | 41 | set env(TH1_ENABLE_DOCS) 1; # TH1 docs must be enabled for this test. |
| 36 | 42 | set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test. |
| @@ -41,11 +47,11 @@ | ||
| 41 | 47 | set data [fossil info] |
| 42 | 48 | } |
| 43 | 49 | |
| 44 | 50 | regexp -line -- {^repository: (.*)$} $data dummy repository |
| 45 | 51 | |
| 46 | -if {[string length $repository] == 0 || ![file exists $repository]} then { | |
| 52 | +if {[string length $repository] == 0 || ![file exists $repository]} { | |
| 47 | 53 | error "unable to locate repository" |
| 48 | 54 | } |
| 49 | 55 | |
| 50 | 56 | set dataFileName [file join $::testdir th1-docs-input.txt] |
| 51 | 57 | |
| @@ -57,5 +63,9 @@ | ||
| 57 | 63 | } |
| 58 | 64 | |
| 59 | 65 | test th1-docs-1a {[regexp {<title>Fossil: test/fileStat.th1</title>} $RESULT]} |
| 60 | 66 | test th1-docs-1b {[regexp {>\[[0-9a-f]{40}\]<} $RESULT]} |
| 61 | 67 | test th1-docs-1c {[regexp { contains \d+ files\.} $RESULT]} |
| 68 | + | |
| 69 | +############################################################################### | |
| 70 | + | |
| 71 | +test_cleanup | |
| 62 | 72 |
| --- test/th1-docs.test | |
| +++ test/th1-docs.test | |
| @@ -18,19 +18,25 @@ | |
| 18 | # TH1 Docs |
| 19 | # |
| 20 | |
| 21 | fossil test-th-eval "hasfeature th1Docs" |
| 22 | |
| 23 | if {$::RESULT ne "1"} then { |
| 24 | puts "Fossil was not compiled with TH1 docs support."; return |
| 25 | } |
| 26 | |
| 27 | fossil test-th-eval "hasfeature tcl" |
| 28 | |
| 29 | if {$::RESULT ne "1"} then { |
| 30 | puts "Fossil was not compiled with Tcl support."; return |
| 31 | } |
| 32 | |
| 33 | ############################################################################### |
| 34 | |
| 35 | set env(TH1_ENABLE_DOCS) 1; # TH1 docs must be enabled for this test. |
| 36 | set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test. |
| @@ -41,11 +47,11 @@ | |
| 41 | set data [fossil info] |
| 42 | } |
| 43 | |
| 44 | regexp -line -- {^repository: (.*)$} $data dummy repository |
| 45 | |
| 46 | if {[string length $repository] == 0 || ![file exists $repository]} then { |
| 47 | error "unable to locate repository" |
| 48 | } |
| 49 | |
| 50 | set dataFileName [file join $::testdir th1-docs-input.txt] |
| 51 | |
| @@ -57,5 +63,9 @@ | |
| 57 | } |
| 58 | |
| 59 | test th1-docs-1a {[regexp {<title>Fossil: test/fileStat.th1</title>} $RESULT]} |
| 60 | test th1-docs-1b {[regexp {>\[[0-9a-f]{40}\]<} $RESULT]} |
| 61 | test th1-docs-1c {[regexp { contains \d+ files\.} $RESULT]} |
| 62 |
| --- test/th1-docs.test | |
| +++ test/th1-docs.test | |
| @@ -18,19 +18,25 @@ | |
| 18 | # TH1 Docs |
| 19 | # |
| 20 | |
| 21 | fossil test-th-eval "hasfeature th1Docs" |
| 22 | |
| 23 | if {$::RESULT ne "1"} { |
| 24 | puts "Fossil was not compiled with TH1 docs support." |
| 25 | test_cleanup_then_return |
| 26 | } |
| 27 | |
| 28 | fossil test-th-eval "hasfeature tcl" |
| 29 | |
| 30 | if {$::RESULT ne "1"} { |
| 31 | puts "Fossil was not compiled with Tcl support." |
| 32 | test_cleanup_then_return |
| 33 | } |
| 34 | |
| 35 | ############################################################################### |
| 36 | |
| 37 | test_setup "" |
| 38 | |
| 39 | ############################################################################### |
| 40 | |
| 41 | set env(TH1_ENABLE_DOCS) 1; # TH1 docs must be enabled for this test. |
| 42 | set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test. |
| @@ -41,11 +47,11 @@ | |
| 47 | set data [fossil info] |
| 48 | } |
| 49 | |
| 50 | regexp -line -- {^repository: (.*)$} $data dummy repository |
| 51 | |
| 52 | if {[string length $repository] == 0 || ![file exists $repository]} { |
| 53 | error "unable to locate repository" |
| 54 | } |
| 55 | |
| 56 | set dataFileName [file join $::testdir th1-docs-input.txt] |
| 57 | |
| @@ -57,5 +63,9 @@ | |
| 63 | } |
| 64 | |
| 65 | test th1-docs-1a {[regexp {<title>Fossil: test/fileStat.th1</title>} $RESULT]} |
| 66 | test th1-docs-1b {[regexp {>\[[0-9a-f]{40}\]<} $RESULT]} |
| 67 | test th1-docs-1c {[regexp { contains \d+ files\.} $RESULT]} |
| 68 | |
| 69 | ############################################################################### |
| 70 | |
| 71 | test_cleanup |
| 72 |
+12
-4
| --- test/th1-hooks.test | ||
| +++ test/th1-hooks.test | ||
| @@ -18,17 +18,21 @@ | ||
| 18 | 18 | # TH1 Hooks |
| 19 | 19 | # |
| 20 | 20 | |
| 21 | 21 | fossil test-th-eval "hasfeature th1Hooks" |
| 22 | 22 | |
| 23 | -if {$::RESULT ne "1"} then { | |
| 24 | - puts "Fossil was not compiled with TH1 hooks support."; return | |
| 23 | +if {$::RESULT ne "1"} { | |
| 24 | + puts "Fossil was not compiled with TH1 hooks support." | |
| 25 | + test_cleanup_then_return | |
| 25 | 26 | } |
| 26 | 27 | |
| 27 | 28 | ############################################################################### |
| 28 | 29 | |
| 29 | -repo_init | |
| 30 | +test_setup | |
| 31 | + | |
| 32 | +############################################################################### | |
| 33 | + | |
| 30 | 34 | write_file f1 "f1"; fossil add f1; fossil commit -m "c1" |
| 31 | 35 | |
| 32 | 36 | ############################################################################### |
| 33 | 37 | |
| 34 | 38 | set env(TH1_ENABLE_HOOKS) 1; # TH1 hooks must be enabled for this test. |
| @@ -106,11 +110,11 @@ | ||
| 106 | 110 | ############################################################################### |
| 107 | 111 | |
| 108 | 112 | set data [fossil info] |
| 109 | 113 | regexp -line -- {^repository: (.*)$} $data dummy repository |
| 110 | 114 | |
| 111 | -if {[string length $repository] == 0 || ![file exists $repository]} then { | |
| 115 | +if {[string length $repository] == 0 || ![file exists $repository]} { | |
| 112 | 116 | error "unable to locate repository" |
| 113 | 117 | } |
| 114 | 118 | |
| 115 | 119 | set dataFileName [file join $::testdir th1-hooks-input.txt] |
| 116 | 120 | |
| @@ -195,5 +199,9 @@ | ||
| 195 | 199 | {<h1><b>command_hook http webpage_hook test1 webpage_notify test1</b></h1>}} |
| 196 | 200 | |
| 197 | 201 | ############################################################################### |
| 198 | 202 | |
| 199 | 203 | restoreTh1SetupFile |
| 204 | + | |
| 205 | +############################################################################### | |
| 206 | + | |
| 207 | +test_cleanup | |
| 200 | 208 |
| --- test/th1-hooks.test | |
| +++ test/th1-hooks.test | |
| @@ -18,17 +18,21 @@ | |
| 18 | # TH1 Hooks |
| 19 | # |
| 20 | |
| 21 | fossil test-th-eval "hasfeature th1Hooks" |
| 22 | |
| 23 | if {$::RESULT ne "1"} then { |
| 24 | puts "Fossil was not compiled with TH1 hooks support."; return |
| 25 | } |
| 26 | |
| 27 | ############################################################################### |
| 28 | |
| 29 | repo_init |
| 30 | write_file f1 "f1"; fossil add f1; fossil commit -m "c1" |
| 31 | |
| 32 | ############################################################################### |
| 33 | |
| 34 | set env(TH1_ENABLE_HOOKS) 1; # TH1 hooks must be enabled for this test. |
| @@ -106,11 +110,11 @@ | |
| 106 | ############################################################################### |
| 107 | |
| 108 | set data [fossil info] |
| 109 | regexp -line -- {^repository: (.*)$} $data dummy repository |
| 110 | |
| 111 | if {[string length $repository] == 0 || ![file exists $repository]} then { |
| 112 | error "unable to locate repository" |
| 113 | } |
| 114 | |
| 115 | set dataFileName [file join $::testdir th1-hooks-input.txt] |
| 116 | |
| @@ -195,5 +199,9 @@ | |
| 195 | {<h1><b>command_hook http webpage_hook test1 webpage_notify test1</b></h1>}} |
| 196 | |
| 197 | ############################################################################### |
| 198 | |
| 199 | restoreTh1SetupFile |
| 200 |
| --- test/th1-hooks.test | |
| +++ test/th1-hooks.test | |
| @@ -18,17 +18,21 @@ | |
| 18 | # TH1 Hooks |
| 19 | # |
| 20 | |
| 21 | fossil test-th-eval "hasfeature th1Hooks" |
| 22 | |
| 23 | if {$::RESULT ne "1"} { |
| 24 | puts "Fossil was not compiled with TH1 hooks support." |
| 25 | test_cleanup_then_return |
| 26 | } |
| 27 | |
| 28 | ############################################################################### |
| 29 | |
| 30 | test_setup |
| 31 | |
| 32 | ############################################################################### |
| 33 | |
| 34 | write_file f1 "f1"; fossil add f1; fossil commit -m "c1" |
| 35 | |
| 36 | ############################################################################### |
| 37 | |
| 38 | set env(TH1_ENABLE_HOOKS) 1; # TH1 hooks must be enabled for this test. |
| @@ -106,11 +110,11 @@ | |
| 110 | ############################################################################### |
| 111 | |
| 112 | set data [fossil info] |
| 113 | regexp -line -- {^repository: (.*)$} $data dummy repository |
| 114 | |
| 115 | if {[string length $repository] == 0 || ![file exists $repository]} { |
| 116 | error "unable to locate repository" |
| 117 | } |
| 118 | |
| 119 | set dataFileName [file join $::testdir th1-hooks-input.txt] |
| 120 | |
| @@ -195,5 +199,9 @@ | |
| 199 | {<h1><b>command_hook http webpage_hook test1 webpage_notify test1</b></h1>}} |
| 200 | |
| 201 | ############################################################################### |
| 202 | |
| 203 | restoreTh1SetupFile |
| 204 | |
| 205 | ############################################################################### |
| 206 | |
| 207 | test_cleanup |
| 208 |
+6
-8
| --- test/th1-repo.test | ||
| +++ test/th1-repo.test | ||
| @@ -19,23 +19,17 @@ | ||
| 19 | 19 | ############################################################################ |
| 20 | 20 | # |
| 21 | 21 | # TH1 tests that may modify the repository |
| 22 | 22 | # |
| 23 | 23 | |
| 24 | -catch {exec $::fossilexe info} res | |
| 25 | -if {![regexp {use --repository} $res]} { | |
| 26 | - puts stderr "Cannot run this test within an open checkout" | |
| 27 | - return | |
| 28 | -} | |
| 24 | +require_no_open_checkout | |
| 29 | 25 | |
| 30 | 26 | ######################################## |
| 31 | 27 | # Setup: Add Files and Commit # |
| 32 | 28 | ######################################## |
| 33 | 29 | |
| 34 | -set rootDir [file normalize [pwd]] | |
| 35 | - | |
| 36 | -repo_init | |
| 30 | +test_setup; set rootDir [file normalize [pwd]] | |
| 37 | 31 | |
| 38 | 32 | write_file f1.md "f1" |
| 39 | 33 | write_file f2.md "f2" |
| 40 | 34 | write_file f3.txt "f3" |
| 41 | 35 | write_file f4.md "f4" |
| @@ -86,5 +80,9 @@ | ||
| 86 | 80 | test th1-dir-3.8 {[lindex [lindex $RESULT 2] 1] == 2} |
| 87 | 81 | test th1-dir-3.9 {[regexp -- $dateTime [lindex [lindex $RESULT 2] 2]]} |
| 88 | 82 | test th1-dir-3.10 {[lindex [lindex $RESULT 3] 0] eq "subdirC/f10.md"} |
| 89 | 83 | test th1-dir-3.11 {[lindex [lindex $RESULT 3] 1] == 3} |
| 90 | 84 | test th1-dir-3.12 {[regexp -- $dateTime [lindex [lindex $RESULT 3] 2]]} |
| 85 | + | |
| 86 | +############################################################################### | |
| 87 | + | |
| 88 | +test_cleanup | |
| 91 | 89 |
| --- test/th1-repo.test | |
| +++ test/th1-repo.test | |
| @@ -19,23 +19,17 @@ | |
| 19 | ############################################################################ |
| 20 | # |
| 21 | # TH1 tests that may modify the repository |
| 22 | # |
| 23 | |
| 24 | catch {exec $::fossilexe info} res |
| 25 | if {![regexp {use --repository} $res]} { |
| 26 | puts stderr "Cannot run this test within an open checkout" |
| 27 | return |
| 28 | } |
| 29 | |
| 30 | ######################################## |
| 31 | # Setup: Add Files and Commit # |
| 32 | ######################################## |
| 33 | |
| 34 | set rootDir [file normalize [pwd]] |
| 35 | |
| 36 | repo_init |
| 37 | |
| 38 | write_file f1.md "f1" |
| 39 | write_file f2.md "f2" |
| 40 | write_file f3.txt "f3" |
| 41 | write_file f4.md "f4" |
| @@ -86,5 +80,9 @@ | |
| 86 | test th1-dir-3.8 {[lindex [lindex $RESULT 2] 1] == 2} |
| 87 | test th1-dir-3.9 {[regexp -- $dateTime [lindex [lindex $RESULT 2] 2]]} |
| 88 | test th1-dir-3.10 {[lindex [lindex $RESULT 3] 0] eq "subdirC/f10.md"} |
| 89 | test th1-dir-3.11 {[lindex [lindex $RESULT 3] 1] == 3} |
| 90 | test th1-dir-3.12 {[regexp -- $dateTime [lindex [lindex $RESULT 3] 2]]} |
| 91 |
| --- test/th1-repo.test | |
| +++ test/th1-repo.test | |
| @@ -19,23 +19,17 @@ | |
| 19 | ############################################################################ |
| 20 | # |
| 21 | # TH1 tests that may modify the repository |
| 22 | # |
| 23 | |
| 24 | require_no_open_checkout |
| 25 | |
| 26 | ######################################## |
| 27 | # Setup: Add Files and Commit # |
| 28 | ######################################## |
| 29 | |
| 30 | test_setup; set rootDir [file normalize [pwd]] |
| 31 | |
| 32 | write_file f1.md "f1" |
| 33 | write_file f2.md "f2" |
| 34 | write_file f3.txt "f3" |
| 35 | write_file f4.md "f4" |
| @@ -86,5 +80,9 @@ | |
| 80 | test th1-dir-3.8 {[lindex [lindex $RESULT 2] 1] == 2} |
| 81 | test th1-dir-3.9 {[regexp -- $dateTime [lindex [lindex $RESULT 2] 2]]} |
| 82 | test th1-dir-3.10 {[lindex [lindex $RESULT 3] 0] eq "subdirC/f10.md"} |
| 83 | test th1-dir-3.11 {[lindex [lindex $RESULT 3] 1] == 3} |
| 84 | test th1-dir-3.12 {[regexp -- $dateTime [lindex [lindex $RESULT 3] 2]]} |
| 85 | |
| 86 | ############################################################################### |
| 87 | |
| 88 | test_cleanup |
| 89 |
+11
-6
| --- test/th1-tcl.test | ||
| +++ test/th1-tcl.test | ||
| @@ -20,19 +20,20 @@ | ||
| 20 | 20 | |
| 21 | 21 | set dir [file dirname [info script]] |
| 22 | 22 | |
| 23 | 23 | ############################################################################### |
| 24 | 24 | |
| 25 | -repo_init | |
| 26 | - | |
| 27 | -############################################################################### | |
| 28 | - | |
| 29 | 25 | fossil test-th-eval "hasfeature tcl" |
| 30 | 26 | |
| 31 | -if {$::RESULT ne "1"} then { | |
| 32 | - puts "Fossil was not compiled with Tcl support."; return | |
| 27 | +if {$::RESULT ne "1"} { | |
| 28 | + puts "Fossil was not compiled with Tcl support." | |
| 29 | + test_cleanup_then_return | |
| 33 | 30 | } |
| 31 | + | |
| 32 | +############################################################################### | |
| 33 | + | |
| 34 | +test_setup | |
| 34 | 35 | |
| 35 | 36 | ############################################################################### |
| 36 | 37 | |
| 37 | 38 | set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test. |
| 38 | 39 | |
| @@ -173,5 +174,9 @@ | ||
| 173 | 174 | |
| 174 | 175 | ############################################################################### |
| 175 | 176 | |
| 176 | 177 | fossil test-th-eval "tclMakeSafe; tclEval set x 2; tclEval info vars x" |
| 177 | 178 | test th1-tcl-17 {[normalize_result] eq {x}} |
| 179 | + | |
| 180 | +############################################################################### | |
| 181 | + | |
| 182 | +test_cleanup | |
| 178 | 183 |
| --- test/th1-tcl.test | |
| +++ test/th1-tcl.test | |
| @@ -20,19 +20,20 @@ | |
| 20 | |
| 21 | set dir [file dirname [info script]] |
| 22 | |
| 23 | ############################################################################### |
| 24 | |
| 25 | repo_init |
| 26 | |
| 27 | ############################################################################### |
| 28 | |
| 29 | fossil test-th-eval "hasfeature tcl" |
| 30 | |
| 31 | if {$::RESULT ne "1"} then { |
| 32 | puts "Fossil was not compiled with Tcl support."; return |
| 33 | } |
| 34 | |
| 35 | ############################################################################### |
| 36 | |
| 37 | set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test. |
| 38 | |
| @@ -173,5 +174,9 @@ | |
| 173 | |
| 174 | ############################################################################### |
| 175 | |
| 176 | fossil test-th-eval "tclMakeSafe; tclEval set x 2; tclEval info vars x" |
| 177 | test th1-tcl-17 {[normalize_result] eq {x}} |
| 178 |
| --- test/th1-tcl.test | |
| +++ test/th1-tcl.test | |
| @@ -20,19 +20,20 @@ | |
| 20 | |
| 21 | set dir [file dirname [info script]] |
| 22 | |
| 23 | ############################################################################### |
| 24 | |
| 25 | fossil test-th-eval "hasfeature tcl" |
| 26 | |
| 27 | if {$::RESULT ne "1"} { |
| 28 | puts "Fossil was not compiled with Tcl support." |
| 29 | test_cleanup_then_return |
| 30 | } |
| 31 | |
| 32 | ############################################################################### |
| 33 | |
| 34 | test_setup |
| 35 | |
| 36 | ############################################################################### |
| 37 | |
| 38 | set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test. |
| 39 | |
| @@ -173,5 +174,9 @@ | |
| 174 | |
| 175 | ############################################################################### |
| 176 | |
| 177 | fossil test-th-eval "tclMakeSafe; tclEval set x 2; tclEval info vars x" |
| 178 | test th1-tcl-17 {[normalize_result] eq {x}} |
| 179 | |
| 180 | ############################################################################### |
| 181 | |
| 182 | test_cleanup |
| 183 |
+6
-2
| --- test/th1.test | ||
| +++ test/th1.test | ||
| @@ -16,11 +16,11 @@ | ||
| 16 | 16 | ############################################################################ |
| 17 | 17 | # |
| 18 | 18 | # TH1 Commands |
| 19 | 19 | # |
| 20 | 20 | |
| 21 | -set dir [file dirname [info script]]; repo_init | |
| 21 | +set dir [file dirname [info script]]; test_setup | |
| 22 | 22 | |
| 23 | 23 | ############################################################################### |
| 24 | 24 | |
| 25 | 25 | set th1Tcl [is_tcl_usable_by_fossil] |
| 26 | 26 | set th1Hooks [are_th1_hooks_usable_by_fossil] |
| @@ -884,11 +884,11 @@ | ||
| 884 | 884 | fossil test-th-eval "globalState vfs" |
| 885 | 885 | test th1-globalState-14 {[string length $RESULT] == 0} |
| 886 | 886 | |
| 887 | 887 | ############################################################################### |
| 888 | 888 | |
| 889 | -if {$tcl_platform(platform) eq "windows"} then { | |
| 889 | +if {$tcl_platform(platform) eq "windows"} { | |
| 890 | 890 | set altVfs win32-longpath |
| 891 | 891 | } else { |
| 892 | 892 | set altVfs unix-dotfile |
| 893 | 893 | } |
| 894 | 894 | |
| @@ -1451,5 +1451,9 @@ | ||
| 1451 | 1451 | } |
| 1452 | 1452 | |
| 1453 | 1453 | fossil test-th-source $th1FileName |
| 1454 | 1454 | test th1-source-1 {$RESULT eq {TH_RETURN: 0 1 2 3 4 5 6 7 8 9}} |
| 1455 | 1455 | file delete $th1FileName |
| 1456 | + | |
| 1457 | +############################################################################### | |
| 1458 | + | |
| 1459 | +test_cleanup | |
| 1456 | 1460 |
| --- test/th1.test | |
| +++ test/th1.test | |
| @@ -16,11 +16,11 @@ | |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # TH1 Commands |
| 19 | # |
| 20 | |
| 21 | set dir [file dirname [info script]]; repo_init |
| 22 | |
| 23 | ############################################################################### |
| 24 | |
| 25 | set th1Tcl [is_tcl_usable_by_fossil] |
| 26 | set th1Hooks [are_th1_hooks_usable_by_fossil] |
| @@ -884,11 +884,11 @@ | |
| 884 | fossil test-th-eval "globalState vfs" |
| 885 | test th1-globalState-14 {[string length $RESULT] == 0} |
| 886 | |
| 887 | ############################################################################### |
| 888 | |
| 889 | if {$tcl_platform(platform) eq "windows"} then { |
| 890 | set altVfs win32-longpath |
| 891 | } else { |
| 892 | set altVfs unix-dotfile |
| 893 | } |
| 894 | |
| @@ -1451,5 +1451,9 @@ | |
| 1451 | } |
| 1452 | |
| 1453 | fossil test-th-source $th1FileName |
| 1454 | test th1-source-1 {$RESULT eq {TH_RETURN: 0 1 2 3 4 5 6 7 8 9}} |
| 1455 | file delete $th1FileName |
| 1456 |
| --- test/th1.test | |
| +++ test/th1.test | |
| @@ -16,11 +16,11 @@ | |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # TH1 Commands |
| 19 | # |
| 20 | |
| 21 | set dir [file dirname [info script]]; test_setup |
| 22 | |
| 23 | ############################################################################### |
| 24 | |
| 25 | set th1Tcl [is_tcl_usable_by_fossil] |
| 26 | set th1Hooks [are_th1_hooks_usable_by_fossil] |
| @@ -884,11 +884,11 @@ | |
| 884 | fossil test-th-eval "globalState vfs" |
| 885 | test th1-globalState-14 {[string length $RESULT] == 0} |
| 886 | |
| 887 | ############################################################################### |
| 888 | |
| 889 | if {$tcl_platform(platform) eq "windows"} { |
| 890 | set altVfs win32-longpath |
| 891 | } else { |
| 892 | set altVfs unix-dotfile |
| 893 | } |
| 894 | |
| @@ -1451,5 +1451,9 @@ | |
| 1451 | } |
| 1452 | |
| 1453 | fossil test-th-source $th1FileName |
| 1454 | test th1-source-1 {$RESULT eq {TH_RETURN: 0 1 2 3 4 5 6 7 8 9}} |
| 1455 | file delete $th1FileName |
| 1456 | |
| 1457 | ############################################################################### |
| 1458 | |
| 1459 | test_cleanup |
| 1460 |
+6
| --- test/utf.test | ||
| +++ test/utf.test | ||
| @@ -15,10 +15,12 @@ | ||
| 15 | 15 | # |
| 16 | 16 | ############################################################################ |
| 17 | 17 | # |
| 18 | 18 | # Test UTF-8/UTF-16 detection |
| 19 | 19 | # |
| 20 | + | |
| 21 | +test_setup "" | |
| 20 | 22 | |
| 21 | 23 | proc swap_byte_order {str} { |
| 22 | 24 | set result "" |
| 23 | 25 | for {set i 0} {$i < [string length $str]} {incr i} { |
| 24 | 26 | set c [scan [string index $str $i] %c] |
| @@ -23490,5 +23492,9 @@ | ||
| 23490 | 23492 | Has flag LOOK_SHORT: no} |
| 23491 | 23493 | |
| 23492 | 23494 | ############################ END GENERATED SECTION ############################ |
| 23493 | 23495 | |
| 23494 | 23496 | deleteTestFiles $tempPath 100 |
| 23497 | + | |
| 23498 | +############################################################################### | |
| 23499 | + | |
| 23500 | +test_cleanup | |
| 23495 | 23501 |
| --- test/utf.test | |
| +++ test/utf.test | |
| @@ -15,10 +15,12 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Test UTF-8/UTF-16 detection |
| 19 | # |
| 20 | |
| 21 | proc swap_byte_order {str} { |
| 22 | set result "" |
| 23 | for {set i 0} {$i < [string length $str]} {incr i} { |
| 24 | set c [scan [string index $str $i] %c] |
| @@ -23490,5 +23492,9 @@ | |
| 23490 | Has flag LOOK_SHORT: no} |
| 23491 | |
| 23492 | ############################ END GENERATED SECTION ############################ |
| 23493 | |
| 23494 | deleteTestFiles $tempPath 100 |
| 23495 |
| --- test/utf.test | |
| +++ test/utf.test | |
| @@ -15,10 +15,12 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Test UTF-8/UTF-16 detection |
| 19 | # |
| 20 | |
| 21 | test_setup "" |
| 22 | |
| 23 | proc swap_byte_order {str} { |
| 24 | set result "" |
| 25 | for {set i 0} {$i < [string length $str]} {incr i} { |
| 26 | set c [scan [string index $str $i] %c] |
| @@ -23490,5 +23492,9 @@ | |
| 23492 | Has flag LOOK_SHORT: no} |
| 23493 | |
| 23494 | ############################ END GENERATED SECTION ############################ |
| 23495 | |
| 23496 | deleteTestFiles $tempPath 100 |
| 23497 | |
| 23498 | ############################################################################### |
| 23499 | |
| 23500 | test_cleanup |
| 23501 |