Fossil SCM
Revert test/trunk-fixes.tcl and all its invocations.
Commit
a75ba583b7779e4c33cca69b8250ee63ee9c02d9b71ba9aa9da112acd26b4a9e
Parent
f3965e7a06ab1ea…
16 files changed
+17
-27
+6
-9
+2
-8
+5
-10
+19
-32
+8
-12
+12
-20
+1
-3
+5
-9
+4
-7
-1
+19
-26
-58
+15
-32
+1
-3
+6
-8
~
test/cgi.test
~
test/config.test
~
test/content.test
~
test/crosslink.test
~
test/import.test
~
test/login.test
~
test/name.test
~
test/purge.test
~
test/rebuild.test
~
test/regress.test
~
test/ssh.test
~
test/th1main.test
-
test/trunk-fixes.tcl
~
test/url.test
~
test/xfer-client.test
~
test/xfer-server.test
+17
-27
| --- test/cgi.test | ||
| +++ test/cgi.test | ||
| @@ -6,11 +6,10 @@ | ||
| 6 | 6 | # |
| 7 | 7 | # Plain HTTP, the same request arriving over ssh, and SCGI. |
| 8 | 8 | # |
| 9 | 9 | |
| 10 | 10 | test_setup |
| 11 | -source [file join $::testfiledir trunk-fixes.tcl] | |
| 12 | 11 | |
| 13 | 12 | write_file a.txt "an unversioned file\n" |
| 14 | 13 | fossil uv add a.txt |
| 15 | 14 | set cgiRepo [file join [pwd] .rep.fossil] |
| 16 | 15 | |
| @@ -489,31 +488,29 @@ | ||
| 489 | 488 | } |
| 490 | 489 | # A range that runs past the end of the file stops at the end. |
| 491 | 490 | set cgiReply [cgi_range bytes=15-2147483646] |
| 492 | 491 | test_eq cgi-range-past-end [reply_body $cgiReply] fghij |
| 493 | 492 | test_eq cgi-range-past-end-header [reply_header $cgiReply Content-Range] \ |
| 494 | - "bytes 15-19/20" $::trunkMark | |
| 495 | -test_eq cgi-range-past-end-length [reply_header $cgiReply Content-Length] 5 \ | |
| 496 | - $::trunkMark | |
| 493 | + "bytes 15-19/20" | |
| 494 | +test_eq cgi-range-past-end-length [reply_header $cgiReply Content-Length] 5 | |
| 497 | 495 | # A range that starts at or after the end gets 416 and no content. |
| 498 | 496 | foreach {cgiName cgiRange} {at-end bytes=20-20 after-end bytes=25-30} { |
| 499 | 497 | set cgiReply [cgi_range $cgiRange] |
| 500 | 498 | test cgi-range-unsatisfiable-$cgiName { |
| 501 | 499 | [reply_status $cgiReply] eq "HTTP/1.0 416 Range Not Satisfiable" |
| 502 | 500 | && [reply_header $cgiReply Content-Range] eq "bytes */20" |
| 503 | - && [reply_header $cgiReply Content-Length] eq "0"} $::trunkMark | |
| 501 | + && [reply_header $cgiReply Content-Length] eq "0"} | |
| 504 | 502 | } |
| 505 | 503 | # A number too large for an int is not taken as a smaller one. |
| 506 | 504 | set cgiReply [cgi_range bytes=0-4294967299] |
| 507 | -test_eq cgi-range-too-large [reply_status $cgiReply] "HTTP/1.0 200 OK" \ | |
| 508 | - $::trunkMark | |
| 505 | +test_eq cgi-range-too-large [reply_status $cgiReply] "HTTP/1.0 200 OK" | |
| 509 | 506 | # A reply other than 206 is sent whole, whatever range was asked for. |
| 510 | 507 | set cgiReply [cgi_send [request_get /uv/nosuch.css [list "Range: bytes=3-9"]] \ |
| 511 | 508 | --ipaddr 127.0.0.1] |
| 512 | 509 | test cgi-range-not-found { |
| 513 | 510 | [string match "HTTP/1.0 404 *" [reply_status $cgiReply]] |
| 514 | - && [string match "<!DOCTYPE*" [reply_body $cgiReply]]} $::trunkMark | |
| 511 | + && [string match "<!DOCTYPE*" [reply_body $cgiReply]]} | |
| 515 | 512 | |
| 516 | 513 | ############################################################################### |
| 517 | 514 | # More shapes of form data in several parts. |
| 518 | 515 | |
| 519 | 516 | proc cgi_form {body} { |
| @@ -581,11 +578,11 @@ | ||
| 581 | 578 | "[cgi_part after ok]--XB--\r\n"] ""] |
| 582 | 579 | write_file request.txt [cgi_post $cgiType $cgiBody] |
| 583 | 580 | file delete reply.txt |
| 584 | 581 | fossil_raw -seconds 15 http $cgiRepo --in request.txt --out reply.txt \ |
| 585 | 582 | --ipaddr 127.0.0.1 --localauth |
| 586 | -test cgi-multipart-lone-quote {$CODE == 0} $::trunkMark | |
| 583 | +test cgi-multipart-lone-quote {$CODE == 0} | |
| 587 | 584 | |
| 588 | 585 | # Only the first 49 words of a header line are read. |
| 589 | 586 | set cgiWords "" |
| 590 | 587 | for {set cgiI 0} {$cgiI < 30} {incr cgiI} \ |
| 591 | 588 | { append cgiWords " w$cgiI \"q$cgiI\";" } |
| @@ -602,11 +599,11 @@ | ||
| 602 | 599 | set cgiReply [cgi_form \ |
| 603 | 600 | [join [list \ |
| 604 | 601 | "--XB\r\nContent-Disposition: form-data; name= \"\r\n\r\n" \ |
| 605 | 602 | "v\r\n[cgi_part after ok]--XB--\r\n"] ""]] |
| 606 | 603 | test {cgi-multipart-quote-alone} {[reply_status $cgiReply] eq "HTTP/1.0 200 OK" |
| 607 | - && [cgi_param $cgiReply after] eq "ok"} $::trunkMark | |
| 604 | + && [cgi_param $cgiReply after] eq "ok"} | |
| 608 | 605 | |
| 609 | 606 | # Content that begins with a zero byte has no parts. |
| 610 | 607 | set cgiReply [cgi_form "\000--XB\r\n[cgi_part a v]--XB--\r\n"] |
| 611 | 608 | test cgi-multipart-zero-first {[reply_status $cgiReply] eq "HTTP/1.0 200 OK" |
| 612 | 609 | && [cgi_param $cgiReply a] eq "-"} |
| @@ -737,12 +734,11 @@ | ||
| 737 | 734 | # The user-edit page needs "login", "info", "pw" and "apply" to make a |
| 738 | 735 | # change. A request with "login" alone changes nothing. |
| 739 | 736 | set cgiBody "id=0&login=cgighost&csrf=$cgiToken" |
| 740 | 737 | cgi_admin [cgi_post_from http://x/setup_uedit /setup_uedit $cgiBody] |
| 741 | 738 | test cgi-all-needs-every-field \ |
| 742 | - {[fossil sql "SELECT count(*) FROM user WHERE login='cgighost'"] == 0} \ | |
| 743 | - $::trunkMark | |
| 739 | + {[fossil sql "SELECT count(*) FROM user WHERE login='cgighost'"] == 0} | |
| 744 | 740 | |
| 745 | 741 | ############################################################################### |
| 746 | 742 | # Request methods and the same reader over ssh. |
| 747 | 743 | |
| 748 | 744 | set ::env(SSH_CONNECTION) "127.0.0.1 5000 127.0.0.1 22" |
| @@ -973,12 +969,11 @@ | ||
| 973 | 969 | --ipaddr 127.0.0.1 --localauth --baseurl $base |
| 974 | 970 | return [read_file reply.txt] |
| 975 | 971 | } |
| 976 | 972 | set cgiReply [cgi_cookie_delete http://x] |
| 977 | 973 | test cgi-cookie-delete {[string match \ |
| 978 | - "*Set-Cookie: fossil_display_settings=null;*max-age=-1;*" $cgiReply]} \ | |
| 979 | - [sanitizer_trunk_mark] | |
| 974 | + "*Set-Cookie: fossil_display_settings=null;*max-age=-1;*" $cgiReply]} | |
| 980 | 975 | set cgiReply [cgi_cookie_delete https://x/d] |
| 981 | 976 | test cgi-cookie-delete-secure {[string match "*max-age=-1;*secure;*" $cgiReply] |
| 982 | 977 | || [string match "*max-age=-1;* secure*" $cgiReply]} |
| 983 | 978 | |
| 984 | 979 | ############################################################################### |
| @@ -1044,11 +1039,11 @@ | ||
| 1044 | 1039 | test cgi-range-ignored-no-dash {[reply_status $cgiReply] eq "HTTP/1.0 200 OK" |
| 1045 | 1040 | && [reply_header $cgiReply Content-Range] eq "-"} |
| 1046 | 1041 | set cgiReply [cgi_send [request_get /raw/$cgiArt?m=application/x-fossil \ |
| 1047 | 1042 | [list "Range: bytes=1-3"]] --ipaddr 127.0.0.1 --localauth] |
| 1048 | 1043 | test cgi-range-sync-type {[reply_status $cgiReply] eq "HTTP/1.0 200 OK" |
| 1049 | - && [reply_header $cgiReply Content-Range] eq "-"} $::trunkMark | |
| 1044 | + && [reply_header $cgiReply Content-Range] eq "-"} | |
| 1050 | 1045 | set cgiReply [cgi_send [request_get /raw/$cgiFile?m=text/plain \ |
| 1051 | 1046 | [list "Range: bytes=4-8"]] --ipaddr 9.9.9.9] |
| 1052 | 1047 | test_eq cgi-range-artifact [reply_body $cgiReply] quick |
| 1053 | 1048 | test_eq cgi-range-artifact-cache [reply_header $cgiReply Cache-Control] \ |
| 1054 | 1049 | "max-age=315360000, immutable" |
| @@ -1112,11 +1107,11 @@ | ||
| 1112 | 1107 | append cgiLogText [read_file $cgiLog] |
| 1113 | 1108 | file delete $cgiLog |
| 1114 | 1109 | } |
| 1115 | 1110 | test cgi-httptrace-post-content {[string match "*body=sent" $cgiLogText]} |
| 1116 | 1111 | test cgi-httptrace-post-header \ |
| 1117 | - {[string match "POST /test-env HTTP/1.1*" $cgiLogText]} $::trunkMark | |
| 1112 | + {[string match "POST /test-env HTTP/1.1*" $cgiLogText]} | |
| 1118 | 1113 | write_file request.txt [request_get /test-env?traced=2] |
| 1119 | 1114 | if {$::tcl_platform(platform) eq "unix"} { |
| 1120 | 1115 | set cgiHere [pwd] |
| 1121 | 1116 | file mkdir readonly |
| 1122 | 1117 | file attributes readonly -permissions 0555 |
| @@ -1385,11 +1380,11 @@ | ||
| 1385 | 1380 | if {[normalize_result] eq "1"} { |
| 1386 | 1381 | foreach {cgiName cgiBody} {not-json {not json} array {[1]} one-byte x} { |
| 1387 | 1382 | set cgiReply [cgi_admin [cgi_post application/json $cgiBody /json/version]] |
| 1388 | 1383 | test cgi-json-post-$cgiName-exit {$CODE == 0} |
| 1389 | 1384 | test cgi-json-post-$cgiName-reply \ |
| 1390 | - {[string match "*FOSSIL-1101*" $cgiReply]} $::trunkMark | |
| 1385 | + {[string match "*FOSSIL-1101*" $cgiReply]} | |
| 1391 | 1386 | } |
| 1392 | 1387 | set cgiReply [cgi_admin [cgi_post text/x-other {[1]} /json/version]] |
| 1393 | 1388 | test cgi-json-post-other-type {[reply_status $cgiReply] eq "HTTP/1.0 200 OK" |
| 1394 | 1389 | && [string match "*jsonApiVersion*" $cgiReply]} |
| 1395 | 1390 | set cgiReply [cgi_send [cgi_scgi { |
| @@ -1415,18 +1410,13 @@ | ||
| 1415 | 1410 | set cgiReply [cgi_send \ |
| 1416 | 1411 | [join [list \ |
| 1417 | 1412 | "$cgiFirst\n\nfossil\nGET /test-env?second=2 HTTP/1.1\r\n" \ |
| 1418 | 1413 | "Host: x\r\nContent-Length: 0\r\nContent-Type: text/plain\r\n" \ |
| 1419 | 1414 | "X-Fossil-Transport: ssh\r\n\r\n"] ""] --localauth] |
| 1420 | -if {$::sanitizerBuild} { | |
| 1421 | - test_skip_part "cgi-ssh-flip: a sanitizer reports a read of the\ | |
| 1422 | - Content-Length of a later request from memory that is reused" | |
| 1423 | -} else { | |
| 1424 | - test cgi-ssh-flip {[string match "test1\n*" $cgiReply] | |
| 1425 | - && [string match "*HTTP_USER_AGENT = First*first = 1*second = 2*" \ | |
| 1426 | - $cgiReply]} | |
| 1427 | -} | |
| 1415 | +test cgi-ssh-flip {[string match "test1\n*" $cgiReply] | |
| 1416 | + && [string match "*HTTP_USER_AGENT = First*first = 1*second = 2*" \ | |
| 1417 | + $cgiReply]} | |
| 1428 | 1418 | foreach {cgiName cgiMore cgiError} [list \ |
| 1429 | 1419 | cut-short "\n" "incorrect transport_flip" \ |
| 1430 | 1420 | not-blank "\nxyz\n" "transport_flip failed" \ |
| 1431 | 1421 | other-command "\n\nother\n" "transport_open failed" \ |
| 1432 | 1422 | no-request "\n\nfossil\n" "missing HTTP header" \ |
| @@ -1668,11 +1658,11 @@ | ||
| 1668 | 1658 | # The same command run from the command line, where there is no request |
| 1669 | 1659 | # to answer, is an error. |
| 1670 | 1660 | foreach {cgiName cgiUrl} {path /stat url http://other.example/x} { |
| 1671 | 1661 | fossil_raw test-th-eval "redirect $cgiUrl" |
| 1672 | 1662 | test cgi-th1-redirect-no-request-$cgiName {$CODE == 0 && [string match \ |
| 1673 | - "*redirect is only allowed in a web request*" $RESULT]} $::trunkMark | |
| 1663 | + "*redirect is only allowed in a web request*" $RESULT]} | |
| 1674 | 1664 | } |
| 1675 | 1665 | # With --http the command line makes a reply, and a redirect to a full |
| 1676 | 1666 | # URL is sent as "302". |
| 1677 | 1667 | fossil_raw test-th-eval --http "redirect http://other.example/x" |
| 1678 | 1668 | test cgi-th1-redirect-http-option {$CODE == 0 |
| @@ -1953,11 +1943,11 @@ | ||
| 1953 | 1943 | cgiPrinted cgiReply |
| 1954 | 1944 | test cgi-server-unix-$cgiName { |
| 1955 | 1945 | $cgiPrinted eq "Listening for HTTP requests on unix socket sock2" |
| 1956 | 1946 | && [reply_status $cgiReply] eq "HTTP/1.0 200 OK" |
| 1957 | 1947 | && [format %o [expr {[file attributes sock2 -permissions] & 0o777}]] |
| 1958 | - eq $cgiMode} $::trunkMark | |
| 1948 | + eq $cgiMode} | |
| 1959 | 1949 | } |
| 1960 | 1950 | fossil_raw -seconds 30 server --socket-mode rw --socket-name sock3 $cgiRepo |
| 1961 | 1951 | test cgi-server-unix-mode-not-a-number {$CODE == 1 && [string match \ |
| 1962 | 1952 | "*cannot change permissions on sock3 to \"rw\"*" $RESULT]} |
| 1963 | 1953 | } else { |
| 1964 | 1954 |
| --- test/cgi.test | |
| +++ test/cgi.test | |
| @@ -6,11 +6,10 @@ | |
| 6 | # |
| 7 | # Plain HTTP, the same request arriving over ssh, and SCGI. |
| 8 | # |
| 9 | |
| 10 | test_setup |
| 11 | source [file join $::testfiledir trunk-fixes.tcl] |
| 12 | |
| 13 | write_file a.txt "an unversioned file\n" |
| 14 | fossil uv add a.txt |
| 15 | set cgiRepo [file join [pwd] .rep.fossil] |
| 16 | |
| @@ -489,31 +488,29 @@ | |
| 489 | } |
| 490 | # A range that runs past the end of the file stops at the end. |
| 491 | set cgiReply [cgi_range bytes=15-2147483646] |
| 492 | test_eq cgi-range-past-end [reply_body $cgiReply] fghij |
| 493 | test_eq cgi-range-past-end-header [reply_header $cgiReply Content-Range] \ |
| 494 | "bytes 15-19/20" $::trunkMark |
| 495 | test_eq cgi-range-past-end-length [reply_header $cgiReply Content-Length] 5 \ |
| 496 | $::trunkMark |
| 497 | # A range that starts at or after the end gets 416 and no content. |
| 498 | foreach {cgiName cgiRange} {at-end bytes=20-20 after-end bytes=25-30} { |
| 499 | set cgiReply [cgi_range $cgiRange] |
| 500 | test cgi-range-unsatisfiable-$cgiName { |
| 501 | [reply_status $cgiReply] eq "HTTP/1.0 416 Range Not Satisfiable" |
| 502 | && [reply_header $cgiReply Content-Range] eq "bytes */20" |
| 503 | && [reply_header $cgiReply Content-Length] eq "0"} $::trunkMark |
| 504 | } |
| 505 | # A number too large for an int is not taken as a smaller one. |
| 506 | set cgiReply [cgi_range bytes=0-4294967299] |
| 507 | test_eq cgi-range-too-large [reply_status $cgiReply] "HTTP/1.0 200 OK" \ |
| 508 | $::trunkMark |
| 509 | # A reply other than 206 is sent whole, whatever range was asked for. |
| 510 | set cgiReply [cgi_send [request_get /uv/nosuch.css [list "Range: bytes=3-9"]] \ |
| 511 | --ipaddr 127.0.0.1] |
| 512 | test cgi-range-not-found { |
| 513 | [string match "HTTP/1.0 404 *" [reply_status $cgiReply]] |
| 514 | && [string match "<!DOCTYPE*" [reply_body $cgiReply]]} $::trunkMark |
| 515 | |
| 516 | ############################################################################### |
| 517 | # More shapes of form data in several parts. |
| 518 | |
| 519 | proc cgi_form {body} { |
| @@ -581,11 +578,11 @@ | |
| 581 | "[cgi_part after ok]--XB--\r\n"] ""] |
| 582 | write_file request.txt [cgi_post $cgiType $cgiBody] |
| 583 | file delete reply.txt |
| 584 | fossil_raw -seconds 15 http $cgiRepo --in request.txt --out reply.txt \ |
| 585 | --ipaddr 127.0.0.1 --localauth |
| 586 | test cgi-multipart-lone-quote {$CODE == 0} $::trunkMark |
| 587 | |
| 588 | # Only the first 49 words of a header line are read. |
| 589 | set cgiWords "" |
| 590 | for {set cgiI 0} {$cgiI < 30} {incr cgiI} \ |
| 591 | { append cgiWords " w$cgiI \"q$cgiI\";" } |
| @@ -602,11 +599,11 @@ | |
| 602 | set cgiReply [cgi_form \ |
| 603 | [join [list \ |
| 604 | "--XB\r\nContent-Disposition: form-data; name= \"\r\n\r\n" \ |
| 605 | "v\r\n[cgi_part after ok]--XB--\r\n"] ""]] |
| 606 | test {cgi-multipart-quote-alone} {[reply_status $cgiReply] eq "HTTP/1.0 200 OK" |
| 607 | && [cgi_param $cgiReply after] eq "ok"} $::trunkMark |
| 608 | |
| 609 | # Content that begins with a zero byte has no parts. |
| 610 | set cgiReply [cgi_form "\000--XB\r\n[cgi_part a v]--XB--\r\n"] |
| 611 | test cgi-multipart-zero-first {[reply_status $cgiReply] eq "HTTP/1.0 200 OK" |
| 612 | && [cgi_param $cgiReply a] eq "-"} |
| @@ -737,12 +734,11 @@ | |
| 737 | # The user-edit page needs "login", "info", "pw" and "apply" to make a |
| 738 | # change. A request with "login" alone changes nothing. |
| 739 | set cgiBody "id=0&login=cgighost&csrf=$cgiToken" |
| 740 | cgi_admin [cgi_post_from http://x/setup_uedit /setup_uedit $cgiBody] |
| 741 | test cgi-all-needs-every-field \ |
| 742 | {[fossil sql "SELECT count(*) FROM user WHERE login='cgighost'"] == 0} \ |
| 743 | $::trunkMark |
| 744 | |
| 745 | ############################################################################### |
| 746 | # Request methods and the same reader over ssh. |
| 747 | |
| 748 | set ::env(SSH_CONNECTION) "127.0.0.1 5000 127.0.0.1 22" |
| @@ -973,12 +969,11 @@ | |
| 973 | --ipaddr 127.0.0.1 --localauth --baseurl $base |
| 974 | return [read_file reply.txt] |
| 975 | } |
| 976 | set cgiReply [cgi_cookie_delete http://x] |
| 977 | test cgi-cookie-delete {[string match \ |
| 978 | "*Set-Cookie: fossil_display_settings=null;*max-age=-1;*" $cgiReply]} \ |
| 979 | [sanitizer_trunk_mark] |
| 980 | set cgiReply [cgi_cookie_delete https://x/d] |
| 981 | test cgi-cookie-delete-secure {[string match "*max-age=-1;*secure;*" $cgiReply] |
| 982 | || [string match "*max-age=-1;* secure*" $cgiReply]} |
| 983 | |
| 984 | ############################################################################### |
| @@ -1044,11 +1039,11 @@ | |
| 1044 | test cgi-range-ignored-no-dash {[reply_status $cgiReply] eq "HTTP/1.0 200 OK" |
| 1045 | && [reply_header $cgiReply Content-Range] eq "-"} |
| 1046 | set cgiReply [cgi_send [request_get /raw/$cgiArt?m=application/x-fossil \ |
| 1047 | [list "Range: bytes=1-3"]] --ipaddr 127.0.0.1 --localauth] |
| 1048 | test cgi-range-sync-type {[reply_status $cgiReply] eq "HTTP/1.0 200 OK" |
| 1049 | && [reply_header $cgiReply Content-Range] eq "-"} $::trunkMark |
| 1050 | set cgiReply [cgi_send [request_get /raw/$cgiFile?m=text/plain \ |
| 1051 | [list "Range: bytes=4-8"]] --ipaddr 9.9.9.9] |
| 1052 | test_eq cgi-range-artifact [reply_body $cgiReply] quick |
| 1053 | test_eq cgi-range-artifact-cache [reply_header $cgiReply Cache-Control] \ |
| 1054 | "max-age=315360000, immutable" |
| @@ -1112,11 +1107,11 @@ | |
| 1112 | append cgiLogText [read_file $cgiLog] |
| 1113 | file delete $cgiLog |
| 1114 | } |
| 1115 | test cgi-httptrace-post-content {[string match "*body=sent" $cgiLogText]} |
| 1116 | test cgi-httptrace-post-header \ |
| 1117 | {[string match "POST /test-env HTTP/1.1*" $cgiLogText]} $::trunkMark |
| 1118 | write_file request.txt [request_get /test-env?traced=2] |
| 1119 | if {$::tcl_platform(platform) eq "unix"} { |
| 1120 | set cgiHere [pwd] |
| 1121 | file mkdir readonly |
| 1122 | file attributes readonly -permissions 0555 |
| @@ -1385,11 +1380,11 @@ | |
| 1385 | if {[normalize_result] eq "1"} { |
| 1386 | foreach {cgiName cgiBody} {not-json {not json} array {[1]} one-byte x} { |
| 1387 | set cgiReply [cgi_admin [cgi_post application/json $cgiBody /json/version]] |
| 1388 | test cgi-json-post-$cgiName-exit {$CODE == 0} |
| 1389 | test cgi-json-post-$cgiName-reply \ |
| 1390 | {[string match "*FOSSIL-1101*" $cgiReply]} $::trunkMark |
| 1391 | } |
| 1392 | set cgiReply [cgi_admin [cgi_post text/x-other {[1]} /json/version]] |
| 1393 | test cgi-json-post-other-type {[reply_status $cgiReply] eq "HTTP/1.0 200 OK" |
| 1394 | && [string match "*jsonApiVersion*" $cgiReply]} |
| 1395 | set cgiReply [cgi_send [cgi_scgi { |
| @@ -1415,18 +1410,13 @@ | |
| 1415 | set cgiReply [cgi_send \ |
| 1416 | [join [list \ |
| 1417 | "$cgiFirst\n\nfossil\nGET /test-env?second=2 HTTP/1.1\r\n" \ |
| 1418 | "Host: x\r\nContent-Length: 0\r\nContent-Type: text/plain\r\n" \ |
| 1419 | "X-Fossil-Transport: ssh\r\n\r\n"] ""] --localauth] |
| 1420 | if {$::sanitizerBuild} { |
| 1421 | test_skip_part "cgi-ssh-flip: a sanitizer reports a read of the\ |
| 1422 | Content-Length of a later request from memory that is reused" |
| 1423 | } else { |
| 1424 | test cgi-ssh-flip {[string match "test1\n*" $cgiReply] |
| 1425 | && [string match "*HTTP_USER_AGENT = First*first = 1*second = 2*" \ |
| 1426 | $cgiReply]} |
| 1427 | } |
| 1428 | foreach {cgiName cgiMore cgiError} [list \ |
| 1429 | cut-short "\n" "incorrect transport_flip" \ |
| 1430 | not-blank "\nxyz\n" "transport_flip failed" \ |
| 1431 | other-command "\n\nother\n" "transport_open failed" \ |
| 1432 | no-request "\n\nfossil\n" "missing HTTP header" \ |
| @@ -1668,11 +1658,11 @@ | |
| 1668 | # The same command run from the command line, where there is no request |
| 1669 | # to answer, is an error. |
| 1670 | foreach {cgiName cgiUrl} {path /stat url http://other.example/x} { |
| 1671 | fossil_raw test-th-eval "redirect $cgiUrl" |
| 1672 | test cgi-th1-redirect-no-request-$cgiName {$CODE == 0 && [string match \ |
| 1673 | "*redirect is only allowed in a web request*" $RESULT]} $::trunkMark |
| 1674 | } |
| 1675 | # With --http the command line makes a reply, and a redirect to a full |
| 1676 | # URL is sent as "302". |
| 1677 | fossil_raw test-th-eval --http "redirect http://other.example/x" |
| 1678 | test cgi-th1-redirect-http-option {$CODE == 0 |
| @@ -1953,11 +1943,11 @@ | |
| 1953 | cgiPrinted cgiReply |
| 1954 | test cgi-server-unix-$cgiName { |
| 1955 | $cgiPrinted eq "Listening for HTTP requests on unix socket sock2" |
| 1956 | && [reply_status $cgiReply] eq "HTTP/1.0 200 OK" |
| 1957 | && [format %o [expr {[file attributes sock2 -permissions] & 0o777}]] |
| 1958 | eq $cgiMode} $::trunkMark |
| 1959 | } |
| 1960 | fossil_raw -seconds 30 server --socket-mode rw --socket-name sock3 $cgiRepo |
| 1961 | test cgi-server-unix-mode-not-a-number {$CODE == 1 && [string match \ |
| 1962 | "*cannot change permissions on sock3 to \"rw\"*" $RESULT]} |
| 1963 | } else { |
| 1964 |
| --- test/cgi.test | |
| +++ test/cgi.test | |
| @@ -6,11 +6,10 @@ | |
| 6 | # |
| 7 | # Plain HTTP, the same request arriving over ssh, and SCGI. |
| 8 | # |
| 9 | |
| 10 | test_setup |
| 11 | |
| 12 | write_file a.txt "an unversioned file\n" |
| 13 | fossil uv add a.txt |
| 14 | set cgiRepo [file join [pwd] .rep.fossil] |
| 15 | |
| @@ -489,31 +488,29 @@ | |
| 488 | } |
| 489 | # A range that runs past the end of the file stops at the end. |
| 490 | set cgiReply [cgi_range bytes=15-2147483646] |
| 491 | test_eq cgi-range-past-end [reply_body $cgiReply] fghij |
| 492 | test_eq cgi-range-past-end-header [reply_header $cgiReply Content-Range] \ |
| 493 | "bytes 15-19/20" |
| 494 | test_eq cgi-range-past-end-length [reply_header $cgiReply Content-Length] 5 |
| 495 | # A range that starts at or after the end gets 416 and no content. |
| 496 | foreach {cgiName cgiRange} {at-end bytes=20-20 after-end bytes=25-30} { |
| 497 | set cgiReply [cgi_range $cgiRange] |
| 498 | test cgi-range-unsatisfiable-$cgiName { |
| 499 | [reply_status $cgiReply] eq "HTTP/1.0 416 Range Not Satisfiable" |
| 500 | && [reply_header $cgiReply Content-Range] eq "bytes */20" |
| 501 | && [reply_header $cgiReply Content-Length] eq "0"} |
| 502 | } |
| 503 | # A number too large for an int is not taken as a smaller one. |
| 504 | set cgiReply [cgi_range bytes=0-4294967299] |
| 505 | test_eq cgi-range-too-large [reply_status $cgiReply] "HTTP/1.0 200 OK" |
| 506 | # A reply other than 206 is sent whole, whatever range was asked for. |
| 507 | set cgiReply [cgi_send [request_get /uv/nosuch.css [list "Range: bytes=3-9"]] \ |
| 508 | --ipaddr 127.0.0.1] |
| 509 | test cgi-range-not-found { |
| 510 | [string match "HTTP/1.0 404 *" [reply_status $cgiReply]] |
| 511 | && [string match "<!DOCTYPE*" [reply_body $cgiReply]]} |
| 512 | |
| 513 | ############################################################################### |
| 514 | # More shapes of form data in several parts. |
| 515 | |
| 516 | proc cgi_form {body} { |
| @@ -581,11 +578,11 @@ | |
| 578 | "[cgi_part after ok]--XB--\r\n"] ""] |
| 579 | write_file request.txt [cgi_post $cgiType $cgiBody] |
| 580 | file delete reply.txt |
| 581 | fossil_raw -seconds 15 http $cgiRepo --in request.txt --out reply.txt \ |
| 582 | --ipaddr 127.0.0.1 --localauth |
| 583 | test cgi-multipart-lone-quote {$CODE == 0} |
| 584 | |
| 585 | # Only the first 49 words of a header line are read. |
| 586 | set cgiWords "" |
| 587 | for {set cgiI 0} {$cgiI < 30} {incr cgiI} \ |
| 588 | { append cgiWords " w$cgiI \"q$cgiI\";" } |
| @@ -602,11 +599,11 @@ | |
| 599 | set cgiReply [cgi_form \ |
| 600 | [join [list \ |
| 601 | "--XB\r\nContent-Disposition: form-data; name= \"\r\n\r\n" \ |
| 602 | "v\r\n[cgi_part after ok]--XB--\r\n"] ""]] |
| 603 | test {cgi-multipart-quote-alone} {[reply_status $cgiReply] eq "HTTP/1.0 200 OK" |
| 604 | && [cgi_param $cgiReply after] eq "ok"} |
| 605 | |
| 606 | # Content that begins with a zero byte has no parts. |
| 607 | set cgiReply [cgi_form "\000--XB\r\n[cgi_part a v]--XB--\r\n"] |
| 608 | test cgi-multipart-zero-first {[reply_status $cgiReply] eq "HTTP/1.0 200 OK" |
| 609 | && [cgi_param $cgiReply a] eq "-"} |
| @@ -737,12 +734,11 @@ | |
| 734 | # The user-edit page needs "login", "info", "pw" and "apply" to make a |
| 735 | # change. A request with "login" alone changes nothing. |
| 736 | set cgiBody "id=0&login=cgighost&csrf=$cgiToken" |
| 737 | cgi_admin [cgi_post_from http://x/setup_uedit /setup_uedit $cgiBody] |
| 738 | test cgi-all-needs-every-field \ |
| 739 | {[fossil sql "SELECT count(*) FROM user WHERE login='cgighost'"] == 0} |
| 740 | |
| 741 | ############################################################################### |
| 742 | # Request methods and the same reader over ssh. |
| 743 | |
| 744 | set ::env(SSH_CONNECTION) "127.0.0.1 5000 127.0.0.1 22" |
| @@ -973,12 +969,11 @@ | |
| 969 | --ipaddr 127.0.0.1 --localauth --baseurl $base |
| 970 | return [read_file reply.txt] |
| 971 | } |
| 972 | set cgiReply [cgi_cookie_delete http://x] |
| 973 | test cgi-cookie-delete {[string match \ |
| 974 | "*Set-Cookie: fossil_display_settings=null;*max-age=-1;*" $cgiReply]} |
| 975 | set cgiReply [cgi_cookie_delete https://x/d] |
| 976 | test cgi-cookie-delete-secure {[string match "*max-age=-1;*secure;*" $cgiReply] |
| 977 | || [string match "*max-age=-1;* secure*" $cgiReply]} |
| 978 | |
| 979 | ############################################################################### |
| @@ -1044,11 +1039,11 @@ | |
| 1039 | test cgi-range-ignored-no-dash {[reply_status $cgiReply] eq "HTTP/1.0 200 OK" |
| 1040 | && [reply_header $cgiReply Content-Range] eq "-"} |
| 1041 | set cgiReply [cgi_send [request_get /raw/$cgiArt?m=application/x-fossil \ |
| 1042 | [list "Range: bytes=1-3"]] --ipaddr 127.0.0.1 --localauth] |
| 1043 | test cgi-range-sync-type {[reply_status $cgiReply] eq "HTTP/1.0 200 OK" |
| 1044 | && [reply_header $cgiReply Content-Range] eq "-"} |
| 1045 | set cgiReply [cgi_send [request_get /raw/$cgiFile?m=text/plain \ |
| 1046 | [list "Range: bytes=4-8"]] --ipaddr 9.9.9.9] |
| 1047 | test_eq cgi-range-artifact [reply_body $cgiReply] quick |
| 1048 | test_eq cgi-range-artifact-cache [reply_header $cgiReply Cache-Control] \ |
| 1049 | "max-age=315360000, immutable" |
| @@ -1112,11 +1107,11 @@ | |
| 1107 | append cgiLogText [read_file $cgiLog] |
| 1108 | file delete $cgiLog |
| 1109 | } |
| 1110 | test cgi-httptrace-post-content {[string match "*body=sent" $cgiLogText]} |
| 1111 | test cgi-httptrace-post-header \ |
| 1112 | {[string match "POST /test-env HTTP/1.1*" $cgiLogText]} |
| 1113 | write_file request.txt [request_get /test-env?traced=2] |
| 1114 | if {$::tcl_platform(platform) eq "unix"} { |
| 1115 | set cgiHere [pwd] |
| 1116 | file mkdir readonly |
| 1117 | file attributes readonly -permissions 0555 |
| @@ -1385,11 +1380,11 @@ | |
| 1380 | if {[normalize_result] eq "1"} { |
| 1381 | foreach {cgiName cgiBody} {not-json {not json} array {[1]} one-byte x} { |
| 1382 | set cgiReply [cgi_admin [cgi_post application/json $cgiBody /json/version]] |
| 1383 | test cgi-json-post-$cgiName-exit {$CODE == 0} |
| 1384 | test cgi-json-post-$cgiName-reply \ |
| 1385 | {[string match "*FOSSIL-1101*" $cgiReply]} |
| 1386 | } |
| 1387 | set cgiReply [cgi_admin [cgi_post text/x-other {[1]} /json/version]] |
| 1388 | test cgi-json-post-other-type {[reply_status $cgiReply] eq "HTTP/1.0 200 OK" |
| 1389 | && [string match "*jsonApiVersion*" $cgiReply]} |
| 1390 | set cgiReply [cgi_send [cgi_scgi { |
| @@ -1415,18 +1410,13 @@ | |
| 1410 | set cgiReply [cgi_send \ |
| 1411 | [join [list \ |
| 1412 | "$cgiFirst\n\nfossil\nGET /test-env?second=2 HTTP/1.1\r\n" \ |
| 1413 | "Host: x\r\nContent-Length: 0\r\nContent-Type: text/plain\r\n" \ |
| 1414 | "X-Fossil-Transport: ssh\r\n\r\n"] ""] --localauth] |
| 1415 | test cgi-ssh-flip {[string match "test1\n*" $cgiReply] |
| 1416 | && [string match "*HTTP_USER_AGENT = First*first = 1*second = 2*" \ |
| 1417 | $cgiReply]} |
| 1418 | foreach {cgiName cgiMore cgiError} [list \ |
| 1419 | cut-short "\n" "incorrect transport_flip" \ |
| 1420 | not-blank "\nxyz\n" "transport_flip failed" \ |
| 1421 | other-command "\n\nother\n" "transport_open failed" \ |
| 1422 | no-request "\n\nfossil\n" "missing HTTP header" \ |
| @@ -1668,11 +1658,11 @@ | |
| 1658 | # The same command run from the command line, where there is no request |
| 1659 | # to answer, is an error. |
| 1660 | foreach {cgiName cgiUrl} {path /stat url http://other.example/x} { |
| 1661 | fossil_raw test-th-eval "redirect $cgiUrl" |
| 1662 | test cgi-th1-redirect-no-request-$cgiName {$CODE == 0 && [string match \ |
| 1663 | "*redirect is only allowed in a web request*" $RESULT]} |
| 1664 | } |
| 1665 | # With --http the command line makes a reply, and a redirect to a full |
| 1666 | # URL is sent as "302". |
| 1667 | fossil_raw test-th-eval --http "redirect http://other.example/x" |
| 1668 | test cgi-th1-redirect-http-option {$CODE == 0 |
| @@ -1953,11 +1943,11 @@ | |
| 1943 | cgiPrinted cgiReply |
| 1944 | test cgi-server-unix-$cgiName { |
| 1945 | $cgiPrinted eq "Listening for HTTP requests on unix socket sock2" |
| 1946 | && [reply_status $cgiReply] eq "HTTP/1.0 200 OK" |
| 1947 | && [format %o [expr {[file attributes sock2 -permissions] & 0o777}]] |
| 1948 | eq $cgiMode} |
| 1949 | } |
| 1950 | fossil_raw -seconds 30 server --socket-mode rw --socket-name sock3 $cgiRepo |
| 1951 | test cgi-server-unix-mode-not-a-number {$CODE == 1 && [string match \ |
| 1952 | "*cannot change permissions on sock3 to \"rw\"*" $RESULT]} |
| 1953 | } else { |
| 1954 |
+6
-9
| --- test/config.test | ||
| +++ test/config.test | ||
| @@ -11,11 +11,10 @@ | ||
| 11 | 11 | # The first sections run at every level, and the rest need |
| 12 | 12 | # -assurance ci or stress. |
| 13 | 13 | require_no_open_checkout |
| 14 | 14 | |
| 15 | 15 | test_setup "" |
| 16 | -source [file join $::testfiledir trunk-fixes.tcl] | |
| 17 | 16 | set configDir [pwd] |
| 18 | 17 | set ::env(FOSSIL_USER) tester |
| 19 | 18 | |
| 20 | 19 | ############################################################################### |
| 21 | 20 | # Helpers. |
| @@ -505,18 +504,17 @@ | ||
| 505 | 504 | configNew r-$configArea.fossil |
| 506 | 505 | configFill r-$configArea.fossil |
| 507 | 506 | configRun configuration reset $configArea -R r-$configArea.fossil |
| 508 | 507 | test_eq config-reset-$configArea-removes \ |
| 509 | 508 | [configState r-$configArea.fossil $configArea 0 1] \ |
| 510 | - [configDefaults $configArea] $::trunkMark | |
| 509 | + [configDefaults $configArea] | |
| 511 | 510 | } |
| 512 | 511 | configNew r-all.fossil |
| 513 | 512 | configFill r-all.fossil |
| 514 | 513 | configRun configuration reset all -R r-all.fossil |
| 515 | 514 | test config-reset-all-removes-aliases {[configSql r-all.fossil "SELECT count(*) |
| 516 | - FROM config WHERE name GLOB 'walias:/*' OR name GLOB 'interwiki:*'"] == 0} \ | |
| 517 | - $::trunkMark | |
| 515 | + FROM config WHERE name GLOB 'walias:/*' OR name GLOB 'interwiki:*'"] == 0} | |
| 518 | 516 | test_eq config-reset-all-settings [configSql r-all.fossil "SELECT group_concat( |
| 519 | 517 | name) FROM (SELECT name FROM config WHERE NOT name GLOB 'walias:/*' AND |
| 520 | 518 | NOT name GLOB 'interwiki:*' ORDER BY name)"] \ |
| 521 | 519 | "aux-schema,content-schema,hash-policy,project-code,rebuilt,server-code" |
| 522 | 520 | |
| @@ -564,12 +562,11 @@ | ||
| 564 | 562 | ############################################################################### |
| 565 | 563 | # Export of changes since a time: only what changed since then is written. |
| 566 | 564 | |
| 567 | 565 | configRun configuration export project since.cfg --since 2099-01-01 \ |
| 568 | 566 | -R a.fossil |
| 569 | -test config-export-since-future {$CODE == 0 && [configKinds since.cfg] eq ""} \ | |
| 570 | - $::trunkMark | |
| 567 | +test config-export-since-future {$CODE == 0 && [configKinds since.cfg] eq ""} | |
| 571 | 568 | configRun configuration export project since2.cfg --since 2000-01-01 \ |
| 572 | 569 | -R a.fossil |
| 573 | 570 | test config-export-since-past {$CODE == 0 && |
| 574 | 571 | [configKinds since2.cfg] eq "/config"} |
| 575 | 572 | |
| @@ -1336,14 +1333,14 @@ | ||
| 1336 | 1333 | fossil_raw -input "y\n" test-var-list --unset -R w.fossil |
| 1337 | 1334 | test config-var-unset-no-pattern {[configSql w.fossil "SELECT count(*) FROM |
| 1338 | 1335 | config"] == $configCount} |
| 1339 | 1336 | fossil_raw -input "Y\n" test-var-list "a-s*" --unset -R w.fossil |
| 1340 | 1337 | test config-var-unset-capital {[configSql w.fossil "SELECT count(*) FROM config |
| 1341 | - WHERE name='a-short'"] == 0} $::trunkMark | |
| 1338 | + WHERE name='a-short'"] == 0} | |
| 1342 | 1339 | fossil_raw -input "y\n" test-var-list "a-s*" --unset -R w.fossil |
| 1343 | 1340 | test config-var-unset-yes {$CODE == 0 && [configSql w.fossil "SELECT count(*) |
| 1344 | - FROM config WHERE name='a-short'"] == 0} $::trunkMark | |
| 1341 | + FROM config WHERE name='a-short'"] == 0} | |
| 1345 | 1342 | |
| 1346 | 1343 | ############################################################################### |
| 1347 | 1344 | # The rest of the file needs a TCP connection over the loopback interface. |
| 1348 | 1345 | |
| 1349 | 1346 | if {![loopback_available]} { |
| @@ -1465,11 +1462,11 @@ | ||
| 1465 | 1462 | $configPart 1 |
| 1466 | 1463 | } |
| 1467 | 1464 | } else { |
| 1468 | 1465 | test config-push-$configLabel-$configArea-refused { |
| 1469 | 1466 | [string first "not authorized to push configuration" $RESULT] >= 0} |
| 1470 | - test config-push-refused-status {$CODE == 1} $::trunkMark | |
| 1467 | + test config-push-refused-status {$CODE == 1} | |
| 1471 | 1468 | test_eq config-push-$configLabel-$configArea-unchanged \ |
| 1472 | 1469 | [configDump cs.fossil] $configPre |
| 1473 | 1470 | } |
| 1474 | 1471 | } |
| 1475 | 1472 | test_stop_server $configStop [lindex $configServerProc 0] \ |
| 1476 | 1473 |
| --- test/config.test | |
| +++ test/config.test | |
| @@ -11,11 +11,10 @@ | |
| 11 | # The first sections run at every level, and the rest need |
| 12 | # -assurance ci or stress. |
| 13 | require_no_open_checkout |
| 14 | |
| 15 | test_setup "" |
| 16 | source [file join $::testfiledir trunk-fixes.tcl] |
| 17 | set configDir [pwd] |
| 18 | set ::env(FOSSIL_USER) tester |
| 19 | |
| 20 | ############################################################################### |
| 21 | # Helpers. |
| @@ -505,18 +504,17 @@ | |
| 505 | configNew r-$configArea.fossil |
| 506 | configFill r-$configArea.fossil |
| 507 | configRun configuration reset $configArea -R r-$configArea.fossil |
| 508 | test_eq config-reset-$configArea-removes \ |
| 509 | [configState r-$configArea.fossil $configArea 0 1] \ |
| 510 | [configDefaults $configArea] $::trunkMark |
| 511 | } |
| 512 | configNew r-all.fossil |
| 513 | configFill r-all.fossil |
| 514 | configRun configuration reset all -R r-all.fossil |
| 515 | test config-reset-all-removes-aliases {[configSql r-all.fossil "SELECT count(*) |
| 516 | FROM config WHERE name GLOB 'walias:/*' OR name GLOB 'interwiki:*'"] == 0} \ |
| 517 | $::trunkMark |
| 518 | test_eq config-reset-all-settings [configSql r-all.fossil "SELECT group_concat( |
| 519 | name) FROM (SELECT name FROM config WHERE NOT name GLOB 'walias:/*' AND |
| 520 | NOT name GLOB 'interwiki:*' ORDER BY name)"] \ |
| 521 | "aux-schema,content-schema,hash-policy,project-code,rebuilt,server-code" |
| 522 | |
| @@ -564,12 +562,11 @@ | |
| 564 | ############################################################################### |
| 565 | # Export of changes since a time: only what changed since then is written. |
| 566 | |
| 567 | configRun configuration export project since.cfg --since 2099-01-01 \ |
| 568 | -R a.fossil |
| 569 | test config-export-since-future {$CODE == 0 && [configKinds since.cfg] eq ""} \ |
| 570 | $::trunkMark |
| 571 | configRun configuration export project since2.cfg --since 2000-01-01 \ |
| 572 | -R a.fossil |
| 573 | test config-export-since-past {$CODE == 0 && |
| 574 | [configKinds since2.cfg] eq "/config"} |
| 575 | |
| @@ -1336,14 +1333,14 @@ | |
| 1336 | fossil_raw -input "y\n" test-var-list --unset -R w.fossil |
| 1337 | test config-var-unset-no-pattern {[configSql w.fossil "SELECT count(*) FROM |
| 1338 | config"] == $configCount} |
| 1339 | fossil_raw -input "Y\n" test-var-list "a-s*" --unset -R w.fossil |
| 1340 | test config-var-unset-capital {[configSql w.fossil "SELECT count(*) FROM config |
| 1341 | WHERE name='a-short'"] == 0} $::trunkMark |
| 1342 | fossil_raw -input "y\n" test-var-list "a-s*" --unset -R w.fossil |
| 1343 | test config-var-unset-yes {$CODE == 0 && [configSql w.fossil "SELECT count(*) |
| 1344 | FROM config WHERE name='a-short'"] == 0} $::trunkMark |
| 1345 | |
| 1346 | ############################################################################### |
| 1347 | # The rest of the file needs a TCP connection over the loopback interface. |
| 1348 | |
| 1349 | if {![loopback_available]} { |
| @@ -1465,11 +1462,11 @@ | |
| 1465 | $configPart 1 |
| 1466 | } |
| 1467 | } else { |
| 1468 | test config-push-$configLabel-$configArea-refused { |
| 1469 | [string first "not authorized to push configuration" $RESULT] >= 0} |
| 1470 | test config-push-refused-status {$CODE == 1} $::trunkMark |
| 1471 | test_eq config-push-$configLabel-$configArea-unchanged \ |
| 1472 | [configDump cs.fossil] $configPre |
| 1473 | } |
| 1474 | } |
| 1475 | test_stop_server $configStop [lindex $configServerProc 0] \ |
| 1476 |
| --- test/config.test | |
| +++ test/config.test | |
| @@ -11,11 +11,10 @@ | |
| 11 | # The first sections run at every level, and the rest need |
| 12 | # -assurance ci or stress. |
| 13 | require_no_open_checkout |
| 14 | |
| 15 | test_setup "" |
| 16 | set configDir [pwd] |
| 17 | set ::env(FOSSIL_USER) tester |
| 18 | |
| 19 | ############################################################################### |
| 20 | # Helpers. |
| @@ -505,18 +504,17 @@ | |
| 504 | configNew r-$configArea.fossil |
| 505 | configFill r-$configArea.fossil |
| 506 | configRun configuration reset $configArea -R r-$configArea.fossil |
| 507 | test_eq config-reset-$configArea-removes \ |
| 508 | [configState r-$configArea.fossil $configArea 0 1] \ |
| 509 | [configDefaults $configArea] |
| 510 | } |
| 511 | configNew r-all.fossil |
| 512 | configFill r-all.fossil |
| 513 | configRun configuration reset all -R r-all.fossil |
| 514 | test config-reset-all-removes-aliases {[configSql r-all.fossil "SELECT count(*) |
| 515 | FROM config WHERE name GLOB 'walias:/*' OR name GLOB 'interwiki:*'"] == 0} |
| 516 | test_eq config-reset-all-settings [configSql r-all.fossil "SELECT group_concat( |
| 517 | name) FROM (SELECT name FROM config WHERE NOT name GLOB 'walias:/*' AND |
| 518 | NOT name GLOB 'interwiki:*' ORDER BY name)"] \ |
| 519 | "aux-schema,content-schema,hash-policy,project-code,rebuilt,server-code" |
| 520 | |
| @@ -564,12 +562,11 @@ | |
| 562 | ############################################################################### |
| 563 | # Export of changes since a time: only what changed since then is written. |
| 564 | |
| 565 | configRun configuration export project since.cfg --since 2099-01-01 \ |
| 566 | -R a.fossil |
| 567 | test config-export-since-future {$CODE == 0 && [configKinds since.cfg] eq ""} |
| 568 | configRun configuration export project since2.cfg --since 2000-01-01 \ |
| 569 | -R a.fossil |
| 570 | test config-export-since-past {$CODE == 0 && |
| 571 | [configKinds since2.cfg] eq "/config"} |
| 572 | |
| @@ -1336,14 +1333,14 @@ | |
| 1333 | fossil_raw -input "y\n" test-var-list --unset -R w.fossil |
| 1334 | test config-var-unset-no-pattern {[configSql w.fossil "SELECT count(*) FROM |
| 1335 | config"] == $configCount} |
| 1336 | fossil_raw -input "Y\n" test-var-list "a-s*" --unset -R w.fossil |
| 1337 | test config-var-unset-capital {[configSql w.fossil "SELECT count(*) FROM config |
| 1338 | WHERE name='a-short'"] == 0} |
| 1339 | fossil_raw -input "y\n" test-var-list "a-s*" --unset -R w.fossil |
| 1340 | test config-var-unset-yes {$CODE == 0 && [configSql w.fossil "SELECT count(*) |
| 1341 | FROM config WHERE name='a-short'"] == 0} |
| 1342 | |
| 1343 | ############################################################################### |
| 1344 | # The rest of the file needs a TCP connection over the loopback interface. |
| 1345 | |
| 1346 | if {![loopback_available]} { |
| @@ -1465,11 +1462,11 @@ | |
| 1462 | $configPart 1 |
| 1463 | } |
| 1464 | } else { |
| 1465 | test config-push-$configLabel-$configArea-refused { |
| 1466 | [string first "not authorized to push configuration" $RESULT] >= 0} |
| 1467 | test config-push-refused-status {$CODE == 1} |
| 1468 | test_eq config-push-$configLabel-$configArea-unchanged \ |
| 1469 | [configDump cs.fossil] $configPre |
| 1470 | } |
| 1471 | } |
| 1472 | test_stop_server $configStop [lindex $configServerProc 0] \ |
| 1473 |
+2
-8
| --- test/content.test | ||
| +++ test/content.test | ||
| @@ -9,11 +9,10 @@ | ||
| 9 | 9 | # |
| 10 | 10 | |
| 11 | 11 | require_no_open_checkout |
| 12 | 12 | |
| 13 | 13 | test_setup |
| 14 | -source [file join $::testfiledir trunk-fixes.tcl] | |
| 15 | 14 | |
| 16 | 15 | # The record number of the artifact with the given hash. |
| 17 | 16 | # |
| 18 | 17 | proc content_rid {hash} { |
| 19 | 18 | return [fossil_sql "SELECT rid FROM blob WHERE uuid='$hash'"] |
| @@ -677,17 +676,12 @@ | ||
| 677 | 676 | SELECT content('rid:200103')=(SELECT t FROM c WHERE kind=1); |
| 678 | 677 | SELECT length(content('rid:200015')); |
| 679 | 678 | SELECT count(*) FROM n WHERE k IN (0,7,14,16,23,31,39,95,102,103) |
| 680 | 679 | AND content('rid:'||(200000+k))=(SELECT t FROM c WHERE c.kind=n.kind); |
| 681 | 680 | } |
| 682 | - if {$::sanitizerBuild} { | |
| 683 | - test_skip_part "content-cache-size and -reads: a sanitizer reports\ | |
| 684 | - a null pointer given to memcpy by the delta SQL functions" | |
| 685 | - } else { | |
| 686 | - test content-cache-size {$CODE == 0} | |
| 687 | - test_eq content-cache-size-reads [string trim $RESULT] "1\n0\n10" | |
| 688 | - } | |
| 681 | + test content-cache-size {$CODE == 0} | |
| 682 | + test_eq content-cache-size-reads [string trim $RESULT] "1\n0\n10" | |
| 689 | 683 | } |
| 690 | 684 | |
| 691 | 685 | ############################################################################### |
| 692 | 686 | |
| 693 | 687 | test_cleanup |
| 694 | 688 |
| --- test/content.test | |
| +++ test/content.test | |
| @@ -9,11 +9,10 @@ | |
| 9 | # |
| 10 | |
| 11 | require_no_open_checkout |
| 12 | |
| 13 | test_setup |
| 14 | source [file join $::testfiledir trunk-fixes.tcl] |
| 15 | |
| 16 | # The record number of the artifact with the given hash. |
| 17 | # |
| 18 | proc content_rid {hash} { |
| 19 | return [fossil_sql "SELECT rid FROM blob WHERE uuid='$hash'"] |
| @@ -677,17 +676,12 @@ | |
| 677 | SELECT content('rid:200103')=(SELECT t FROM c WHERE kind=1); |
| 678 | SELECT length(content('rid:200015')); |
| 679 | SELECT count(*) FROM n WHERE k IN (0,7,14,16,23,31,39,95,102,103) |
| 680 | AND content('rid:'||(200000+k))=(SELECT t FROM c WHERE c.kind=n.kind); |
| 681 | } |
| 682 | if {$::sanitizerBuild} { |
| 683 | test_skip_part "content-cache-size and -reads: a sanitizer reports\ |
| 684 | a null pointer given to memcpy by the delta SQL functions" |
| 685 | } else { |
| 686 | test content-cache-size {$CODE == 0} |
| 687 | test_eq content-cache-size-reads [string trim $RESULT] "1\n0\n10" |
| 688 | } |
| 689 | } |
| 690 | |
| 691 | ############################################################################### |
| 692 | |
| 693 | test_cleanup |
| 694 |
| --- test/content.test | |
| +++ test/content.test | |
| @@ -9,11 +9,10 @@ | |
| 9 | # |
| 10 | |
| 11 | require_no_open_checkout |
| 12 | |
| 13 | test_setup |
| 14 | |
| 15 | # The record number of the artifact with the given hash. |
| 16 | # |
| 17 | proc content_rid {hash} { |
| 18 | return [fossil_sql "SELECT rid FROM blob WHERE uuid='$hash'"] |
| @@ -677,17 +676,12 @@ | |
| 676 | SELECT content('rid:200103')=(SELECT t FROM c WHERE kind=1); |
| 677 | SELECT length(content('rid:200015')); |
| 678 | SELECT count(*) FROM n WHERE k IN (0,7,14,16,23,31,39,95,102,103) |
| 679 | AND content('rid:'||(200000+k))=(SELECT t FROM c WHERE c.kind=n.kind); |
| 680 | } |
| 681 | test content-cache-size {$CODE == 0} |
| 682 | test_eq content-cache-size-reads [string trim $RESULT] "1\n0\n10" |
| 683 | } |
| 684 | |
| 685 | ############################################################################### |
| 686 | |
| 687 | test_cleanup |
| 688 |
+5
-10
| --- test/crosslink.test | ||
| +++ test/crosslink.test | ||
| @@ -13,11 +13,10 @@ | ||
| 13 | 13 | # The first sections run at every level, and the rest need |
| 14 | 14 | # -assurance stress. |
| 15 | 15 | require_no_open_checkout |
| 16 | 16 | |
| 17 | 17 | test_setup |
| 18 | -source [file join $::testfiledir trunk-fixes.tcl] | |
| 19 | 18 | |
| 20 | 19 | set crosslinkSeq 0 |
| 21 | 20 | |
| 22 | 21 | # Write a file that holds the cards $body and the Z card for them, and |
| 23 | 22 | # return its name. |
| @@ -632,13 +631,11 @@ | ||
| 632 | 631 | ] { |
| 633 | 632 | set crosslinkG [crosslink_put "D 2026-01-08T10:0[incr crosslinkI]:00.000 |
| 634 | 633 | T +parent $crosslinkM3 $crosslinkValue |
| 635 | 634 | U alice |
| 636 | 635 | "] |
| 637 | - test crosslink-reparent-$crosslinkName {$CODE == 0 && $crosslinkG ne ""} \ | |
| 638 | - [sanitizer_trunk_mark $crosslinkName \ | |
| 639 | - {two-sha3-short one-sha3-short one-sha1-short}] | |
| 636 | + test crosslink-reparent-$crosslinkName {$CODE == 0 && $crosslinkG ne ""} | |
| 640 | 637 | test_eq crosslink-reparent-$crosslinkName-ignored [fossil_sql "SELECT |
| 641 | 638 | uuid FROM plink, blob WHERE pid=rid AND isprim AND cid=(SELECT rid |
| 642 | 639 | FROM blob WHERE uuid='$crosslinkM3')"] $crosslinkM2 |
| 643 | 640 | } |
| 644 | 641 | fossil rebuild |
| @@ -686,12 +683,11 @@ | ||
| 686 | 683 | set crosslinkHash [string trim [fossil_sql "SELECT uuid FROM blob, |
| 687 | 684 | attachment WHERE rid=attachid ORDER BY rid LIMIT 1"] '] |
| 688 | 685 | } |
| 689 | 686 | fossil test-artifact-to-json $crosslinkHash |
| 690 | 687 | test crosslink-json-$crosslinkKind {$CODE == 0} |
| 691 | - crosslink_match crosslink-json-$crosslinkKind-text $RESULT $crosslinkWant \ | |
| 692 | - [sanitizer_trunk_mark $crosslinkKind tag] | |
| 688 | + crosslink_match crosslink-json-$crosslinkKind-text $RESULT $crosslinkWant | |
| 693 | 689 | } |
| 694 | 690 | # Every artifact that the repository shows in its timeline has a JSON |
| 695 | 691 | # form. |
| 696 | 692 | fossil sql "SELECT uuid FROM blob WHERE rid IN (SELECT objid FROM event)" |
| 697 | 693 | set crosslinkAll [string map {' {}} $RESULT] |
| @@ -1314,18 +1310,17 @@ | ||
| 1314 | 1310 | {*reports the input is ok*manifest_parse() worked} |
| 1315 | 1311 | |
| 1316 | 1312 | fossil test-parse-manifest $crosslinkEmptyP |
| 1317 | 1313 | crosslink_match crosslink-mcdc-agree-empty-p-parses $RESULT \ |
| 1318 | 1314 | {*manifest_parse() worked*} |
| 1319 | -test crosslink-mcdc-agree-empty-p {![string match *disagree* $RESULT]} \ | |
| 1320 | - $::trunkMark | |
| 1315 | +test crosslink-mcdc-agree-empty-p {![string match *disagree* $RESULT]} | |
| 1321 | 1316 | |
| 1322 | 1317 | fossil test-parse-manifest wf-signed-no-newline.txt |
| 1323 | 1318 | crosslink_match crosslink-mcdc-agree-signed-no-newline-refused $RESULT \ |
| 1324 | 1319 | {*ERROR: not terminated*} |
| 1325 | 1320 | test crosslink-mcdc-agree-signed-no-newline \ |
| 1326 | - {![string match *disagree* $RESULT]} $::trunkMark | |
| 1321 | + {![string match *disagree* $RESULT]} | |
| 1327 | 1322 | |
| 1328 | 1323 | # The same for content held by a repository. |
| 1329 | 1324 | fossil init wf.fossil |
| 1330 | 1325 | fossil test-content-put -R wf.fossil wf-signed.txt $crosslinkEmptyP \ |
| 1331 | 1326 | wf-signed-no-newline.txt |
| @@ -1332,11 +1327,11 @@ | ||
| 1332 | 1327 | test crosslink-mcdc-agree-stored {$CODE == 0} |
| 1333 | 1328 | fossil test-parse-all-blobs --wellformed -R wf.fossil |
| 1334 | 1329 | test crosslink-mcdc-agree-stored-checked \ |
| 1335 | 1330 | {$CODE == 0 && [regexp {(\d+) tests with} $RESULT all n] && $n >= 3} |
| 1336 | 1331 | crosslink_match crosslink-mcdc-agree-stored-no-errors $RESULT \ |
| 1337 | - {*tests with 0 errors*} $::trunkMark | |
| 1332 | + {*tests with 0 errors*} | |
| 1338 | 1333 | |
| 1339 | 1334 | ############################################################################### |
| 1340 | 1335 | # More values of the "parent" tag. A value that ends in a space names the |
| 1341 | 1336 | # parent before the space. A value long enough to be a hash that is not |
| 1342 | 1337 | # one is ignored. A "parent" tag on a wiki page makes no links. |
| 1343 | 1338 |
| --- test/crosslink.test | |
| +++ test/crosslink.test | |
| @@ -13,11 +13,10 @@ | |
| 13 | # The first sections run at every level, and the rest need |
| 14 | # -assurance stress. |
| 15 | require_no_open_checkout |
| 16 | |
| 17 | test_setup |
| 18 | source [file join $::testfiledir trunk-fixes.tcl] |
| 19 | |
| 20 | set crosslinkSeq 0 |
| 21 | |
| 22 | # Write a file that holds the cards $body and the Z card for them, and |
| 23 | # return its name. |
| @@ -632,13 +631,11 @@ | |
| 632 | ] { |
| 633 | set crosslinkG [crosslink_put "D 2026-01-08T10:0[incr crosslinkI]:00.000 |
| 634 | T +parent $crosslinkM3 $crosslinkValue |
| 635 | U alice |
| 636 | "] |
| 637 | test crosslink-reparent-$crosslinkName {$CODE == 0 && $crosslinkG ne ""} \ |
| 638 | [sanitizer_trunk_mark $crosslinkName \ |
| 639 | {two-sha3-short one-sha3-short one-sha1-short}] |
| 640 | test_eq crosslink-reparent-$crosslinkName-ignored [fossil_sql "SELECT |
| 641 | uuid FROM plink, blob WHERE pid=rid AND isprim AND cid=(SELECT rid |
| 642 | FROM blob WHERE uuid='$crosslinkM3')"] $crosslinkM2 |
| 643 | } |
| 644 | fossil rebuild |
| @@ -686,12 +683,11 @@ | |
| 686 | set crosslinkHash [string trim [fossil_sql "SELECT uuid FROM blob, |
| 687 | attachment WHERE rid=attachid ORDER BY rid LIMIT 1"] '] |
| 688 | } |
| 689 | fossil test-artifact-to-json $crosslinkHash |
| 690 | test crosslink-json-$crosslinkKind {$CODE == 0} |
| 691 | crosslink_match crosslink-json-$crosslinkKind-text $RESULT $crosslinkWant \ |
| 692 | [sanitizer_trunk_mark $crosslinkKind tag] |
| 693 | } |
| 694 | # Every artifact that the repository shows in its timeline has a JSON |
| 695 | # form. |
| 696 | fossil sql "SELECT uuid FROM blob WHERE rid IN (SELECT objid FROM event)" |
| 697 | set crosslinkAll [string map {' {}} $RESULT] |
| @@ -1314,18 +1310,17 @@ | |
| 1314 | {*reports the input is ok*manifest_parse() worked} |
| 1315 | |
| 1316 | fossil test-parse-manifest $crosslinkEmptyP |
| 1317 | crosslink_match crosslink-mcdc-agree-empty-p-parses $RESULT \ |
| 1318 | {*manifest_parse() worked*} |
| 1319 | test crosslink-mcdc-agree-empty-p {![string match *disagree* $RESULT]} \ |
| 1320 | $::trunkMark |
| 1321 | |
| 1322 | fossil test-parse-manifest wf-signed-no-newline.txt |
| 1323 | crosslink_match crosslink-mcdc-agree-signed-no-newline-refused $RESULT \ |
| 1324 | {*ERROR: not terminated*} |
| 1325 | test crosslink-mcdc-agree-signed-no-newline \ |
| 1326 | {![string match *disagree* $RESULT]} $::trunkMark |
| 1327 | |
| 1328 | # The same for content held by a repository. |
| 1329 | fossil init wf.fossil |
| 1330 | fossil test-content-put -R wf.fossil wf-signed.txt $crosslinkEmptyP \ |
| 1331 | wf-signed-no-newline.txt |
| @@ -1332,11 +1327,11 @@ | |
| 1332 | test crosslink-mcdc-agree-stored {$CODE == 0} |
| 1333 | fossil test-parse-all-blobs --wellformed -R wf.fossil |
| 1334 | test crosslink-mcdc-agree-stored-checked \ |
| 1335 | {$CODE == 0 && [regexp {(\d+) tests with} $RESULT all n] && $n >= 3} |
| 1336 | crosslink_match crosslink-mcdc-agree-stored-no-errors $RESULT \ |
| 1337 | {*tests with 0 errors*} $::trunkMark |
| 1338 | |
| 1339 | ############################################################################### |
| 1340 | # More values of the "parent" tag. A value that ends in a space names the |
| 1341 | # parent before the space. A value long enough to be a hash that is not |
| 1342 | # one is ignored. A "parent" tag on a wiki page makes no links. |
| 1343 |
| --- test/crosslink.test | |
| +++ test/crosslink.test | |
| @@ -13,11 +13,10 @@ | |
| 13 | # The first sections run at every level, and the rest need |
| 14 | # -assurance stress. |
| 15 | require_no_open_checkout |
| 16 | |
| 17 | test_setup |
| 18 | |
| 19 | set crosslinkSeq 0 |
| 20 | |
| 21 | # Write a file that holds the cards $body and the Z card for them, and |
| 22 | # return its name. |
| @@ -632,13 +631,11 @@ | |
| 631 | ] { |
| 632 | set crosslinkG [crosslink_put "D 2026-01-08T10:0[incr crosslinkI]:00.000 |
| 633 | T +parent $crosslinkM3 $crosslinkValue |
| 634 | U alice |
| 635 | "] |
| 636 | test crosslink-reparent-$crosslinkName {$CODE == 0 && $crosslinkG ne ""} |
| 637 | test_eq crosslink-reparent-$crosslinkName-ignored [fossil_sql "SELECT |
| 638 | uuid FROM plink, blob WHERE pid=rid AND isprim AND cid=(SELECT rid |
| 639 | FROM blob WHERE uuid='$crosslinkM3')"] $crosslinkM2 |
| 640 | } |
| 641 | fossil rebuild |
| @@ -686,12 +683,11 @@ | |
| 683 | set crosslinkHash [string trim [fossil_sql "SELECT uuid FROM blob, |
| 684 | attachment WHERE rid=attachid ORDER BY rid LIMIT 1"] '] |
| 685 | } |
| 686 | fossil test-artifact-to-json $crosslinkHash |
| 687 | test crosslink-json-$crosslinkKind {$CODE == 0} |
| 688 | crosslink_match crosslink-json-$crosslinkKind-text $RESULT $crosslinkWant |
| 689 | } |
| 690 | # Every artifact that the repository shows in its timeline has a JSON |
| 691 | # form. |
| 692 | fossil sql "SELECT uuid FROM blob WHERE rid IN (SELECT objid FROM event)" |
| 693 | set crosslinkAll [string map {' {}} $RESULT] |
| @@ -1314,18 +1310,17 @@ | |
| 1310 | {*reports the input is ok*manifest_parse() worked} |
| 1311 | |
| 1312 | fossil test-parse-manifest $crosslinkEmptyP |
| 1313 | crosslink_match crosslink-mcdc-agree-empty-p-parses $RESULT \ |
| 1314 | {*manifest_parse() worked*} |
| 1315 | test crosslink-mcdc-agree-empty-p {![string match *disagree* $RESULT]} |
| 1316 | |
| 1317 | fossil test-parse-manifest wf-signed-no-newline.txt |
| 1318 | crosslink_match crosslink-mcdc-agree-signed-no-newline-refused $RESULT \ |
| 1319 | {*ERROR: not terminated*} |
| 1320 | test crosslink-mcdc-agree-signed-no-newline \ |
| 1321 | {![string match *disagree* $RESULT]} |
| 1322 | |
| 1323 | # The same for content held by a repository. |
| 1324 | fossil init wf.fossil |
| 1325 | fossil test-content-put -R wf.fossil wf-signed.txt $crosslinkEmptyP \ |
| 1326 | wf-signed-no-newline.txt |
| @@ -1332,11 +1327,11 @@ | |
| 1327 | test crosslink-mcdc-agree-stored {$CODE == 0} |
| 1328 | fossil test-parse-all-blobs --wellformed -R wf.fossil |
| 1329 | test crosslink-mcdc-agree-stored-checked \ |
| 1330 | {$CODE == 0 && [regexp {(\d+) tests with} $RESULT all n] && $n >= 3} |
| 1331 | crosslink_match crosslink-mcdc-agree-stored-no-errors $RESULT \ |
| 1332 | {*tests with 0 errors*} |
| 1333 | |
| 1334 | ############################################################################### |
| 1335 | # More values of the "parent" tag. A value that ends in a space names the |
| 1336 | # parent before the space. A value long enough to be a hash that is not |
| 1337 | # one is ignored. A "parent" tag on a wiki page makes no links. |
| 1338 |
+19
-32
| --- test/import.test | ||
| +++ test/import.test | ||
| @@ -7,11 +7,10 @@ | ||
| 7 | 7 | # |
| 8 | 8 | |
| 9 | 9 | # The first sections run at every level, and the rest need |
| 10 | 10 | # -assurance stress. |
| 11 | 11 | test_setup |
| 12 | -source [file join $::testfiledir trunk-fixes.tcl] | |
| 13 | 12 | |
| 14 | 13 | # A number in the variable-length form of svndiff0: seven bits a byte, |
| 15 | 14 | # most significant first, the high bit set on every byte but the last. |
| 16 | 15 | # |
| 17 | 16 | proc import_varint {n} { |
| @@ -222,19 +221,19 @@ | ||
| 222 | 221 | append importStream "data 4\nimp\nM 100644 :1 f.txt\n\n" |
| 223 | 222 | write_file git-artifact.fi $importStream |
| 224 | 223 | fossil_raw -seconds 60 import --git git-artifact.fossil git-artifact.fi |
| 225 | 224 | test import-git-artifact-file {$CODE == 0} |
| 226 | 225 | fossil sql -R git-artifact.fossil "SELECT count(*) FROM event WHERE type='ci'" |
| 227 | -test_eq import-git-artifact-one-checkin [string trim $RESULT] 1 $::trunkMark | |
| 226 | +test_eq import-git-artifact-one-checkin [string trim $RESULT] 1 | |
| 228 | 227 | fossil sql -R git-artifact.fossil \ |
| 229 | 228 | "SELECT count(*) FROM tag WHERE tagname='sym-planted'" |
| 230 | -test_eq import-git-artifact-no-branch [string trim $RESULT] 0 $::trunkMark | |
| 229 | +test_eq import-git-artifact-no-branch [string trim $RESULT] 0 | |
| 231 | 230 | fossil_raw cat f.txt -R git-artifact.fossil -r trunk |
| 232 | 231 | test_eq import-git-artifact-content $RESULT \ |
| 233 | 232 | [join [list \ |
| 234 | 233 | "${importArt}# Remove this line to create a well-formed " \ |
| 235 | - "Fossil control artifact.\n"] ""] $::trunkMark | |
| 234 | + "Fossil control artifact.\n"] ""] | |
| 236 | 235 | |
| 237 | 236 | ############################################################################### |
| 238 | 237 | # Input that "fossil import" must refuse with an error and exit code 1. |
| 239 | 238 | |
| 240 | 239 | # Each row: a git stream. The length of a data command is negative, too |
| @@ -262,21 +261,19 @@ | ||
| 262 | 261 | ] { |
| 263 | 262 | write_file refuse-$importName.fi $importStream |
| 264 | 263 | fossil_raw -seconds 60 import --git refuse-$importName.fossil \ |
| 265 | 264 | refuse-$importName.fi |
| 266 | 265 | test import-refuse-git-$importName {$CODE == 1 && |
| 267 | - [string first "bad fast-import line" $RESULT] >= 0} \ | |
| 268 | - [trunk_mark $importName {data-negative data-huge time-past-9999 | |
| 269 | - time-13-digits time-no-space}] | |
| 266 | + [string first "bad fast-import line" $RESULT] >= 0} | |
| 270 | 267 | } |
| 271 | 268 | |
| 272 | 269 | # A commit command whose name is 992 bytes long, with no slash after its |
| 273 | 270 | # fifth byte and no newline, is read within the name. The commit has no |
| 274 | 271 | # data and is not made. |
| 275 | 272 | write_file git-ref-long.fi "commit [string repeat a 992]" |
| 276 | 273 | fossil_raw -seconds 60 import --git git-ref-long.fossil git-ref-long.fi |
| 277 | -test import-git-ref-long {$CODE == 0} [sanitizer_trunk_mark] | |
| 274 | +test import-git-ref-long {$CODE == 0} | |
| 278 | 275 | |
| 279 | 276 | # Each row: an svn dump. A header line has no newline after its value, |
| 280 | 277 | # because the dump ends there, a zero byte comes first, or the line is |
| 281 | 278 | # longer than the importer reads at once; a file on the trunk has no |
| 282 | 279 | # Node-action. |
| @@ -296,11 +293,11 @@ | ||
| 296 | 293 | ] { |
| 297 | 294 | write_file refuse-$importName.dump $importDump |
| 298 | 295 | fossil_raw -seconds 60 import --svn refuse-$importName.fossil \ |
| 299 | 296 | refuse-$importName.dump |
| 300 | 297 | test import-refuse-svn-$importName {$CODE == 1 && |
| 301 | - [string first "svn-dump data format broken" $RESULT] >= 0} $::trunkMark | |
| 298 | + [string first "svn-dump data format broken" $RESULT] >= 0} | |
| 302 | 299 | } |
| 303 | 300 | |
| 304 | 301 | # A file outside trunk, branches and tags is passed over even when it has |
| 305 | 302 | # no Node-action. |
| 306 | 303 | # |
| @@ -321,11 +318,11 @@ | ||
| 321 | 318 | "Content-length: 1\n\nx\n\n"] ""] |
| 322 | 319 | foreach importName {trunk branches tags} { |
| 323 | 320 | fossil_raw -seconds 60 import --svn --$importName "" \ |
| 324 | 321 | refuse-$importName.fossil base.dump |
| 325 | 322 | test import-refuse-svn-empty-$importName {$CODE == 1 && [string first \ |
| 326 | - "may be empty only with a non-empty --base" $RESULT] >= 0} $::trunkMark | |
| 323 | + "may be empty only with a non-empty --base" $RESULT] >= 0} | |
| 327 | 324 | } |
| 328 | 325 | fossil_raw -seconds 60 import --svn --base proj --trunk "" base.fossil base.dump |
| 329 | 326 | test import-svn-base-empty-trunk {$CODE == 0} |
| 330 | 327 | fossil sql -R base.fossil "SELECT group_concat(f.filename, ' ') |
| 331 | 328 | FROM event e, blob b, files_of_checkin(b.uuid) f WHERE b.rid=e.objid" |
| @@ -643,12 +640,11 @@ | ||
| 643 | 640 | |
| 644 | 641 | # Without --force an existing repository is not written over, and the |
| 645 | 642 | # command says so rather than give an error from the database. |
| 646 | 643 | # |
| 647 | 644 | fossil_raw -seconds 60 import --git names.fossil names.fi |
| 648 | -test import-git-exists {$CODE == 1 && [holds_strings $RESULT {!SQLITE_ERROR}]} \ | |
| 649 | - $::trunkMark | |
| 645 | +test import-git-exists {$CODE == 1 && [holds_strings $RESULT {!SQLITE_ERROR}]} | |
| 650 | 646 | test_eq import-git-exists-untouched [import_checkins names] "names fewer" |
| 651 | 647 | |
| 652 | 648 | # With --force an existing repository is replaced. The stream comes on |
| 653 | 649 | # standard input when no file is named. |
| 654 | 650 | # |
| @@ -738,12 +734,11 @@ | ||
| 738 | 734 | append importStream [import_commit refs/heads/master 2 orphan \ |
| 739 | 735 | "from :5\nM 100644 :1 a\n"] |
| 740 | 736 | fossil_raw -seconds 60 -input $importStream import --git \ |
| 741 | 737 | --import-marks zero.marks zero.fossil |
| 742 | 738 | test import-git-import-marks-zero {$CODE == 1 && |
| 743 | - [string first "error importing marks from file: zero.marks" $RESULT] >= 0} \ | |
| 744 | - $::trunkMark | |
| 739 | + [string first "error importing marks from file: zero.marks" $RESULT] >= 0} | |
| 745 | 740 | |
| 746 | 741 | # Each row: a marks line that is not a commit or file mark of Fossil's, |
| 747 | 742 | # which "fossil export --import-marks" refuses. |
| 748 | 743 | # |
| 749 | 744 | fossil init marks-export.fossil |
| @@ -754,12 +749,11 @@ | ||
| 754 | 749 | ] { |
| 755 | 750 | write_file bad-$importName.marks "$importLine\n" |
| 756 | 751 | fossil_raw -seconds 60 export --git --import-marks bad-$importName.marks \ |
| 757 | 752 | -R marks-export.fossil |
| 758 | 753 | test import-export-marks-$importName {$CODE == 1 && [string first \ |
| 759 | - "error importing marks from file: bad-$importName.marks" $RESULT] >= 0} \ | |
| 760 | - $::trunkMark | |
| 754 | + "error importing marks from file: bad-$importName.marks" $RESULT] >= 0} | |
| 761 | 755 | } |
| 762 | 756 | |
| 763 | 757 | # Marks may name a check-in made by "fossil commit", whose files carry no |
| 764 | 758 | # permission, and the files of such a parent are kept. A commit whose |
| 765 | 759 | # "from" is the mark of a file keeps nothing from it. |
| @@ -796,12 +790,11 @@ | ||
| 796 | 790 | append importStream [import_commit refs/heads/master 2 first "M 100644 :1 a\n"] |
| 797 | 791 | write_file default.fi $importStream |
| 798 | 792 | fossil_raw -seconds 60 import default.fossil default.fi |
| 799 | 793 | test import-default-format {$CODE == 0} |
| 800 | 794 | test_eq import-default-format-checkins [import_checkins default] first |
| 801 | -test_eq import-default-format-tags [import_tags default first] "master trunk" \ | |
| 802 | - $::trunkMark | |
| 795 | +test_eq import-default-format-tags [import_tags default first] "master trunk" | |
| 803 | 796 | |
| 804 | 797 | # A ref of fewer than five bytes names its branch. |
| 805 | 798 | # |
| 806 | 799 | set importStream [import_blob 1 "hello\n"] |
| 807 | 800 | append importStream [import_commit refs/heads/master 2 first \ |
| @@ -808,11 +801,11 @@ | ||
| 808 | 801 | "M 100644 :1 a-long-name-for-a-file\n"] |
| 809 | 802 | append importStream [import_commit x 3 second "M 100644 :1 b\n"] |
| 810 | 803 | import_git shortref $importStream |
| 811 | 804 | test_eq import-git-short-ref [import_sql shortref "SELECT value |
| 812 | 805 | FROM event, tagxref WHERE rid=objid AND tagxref.tagid=8 |
| 813 | - AND comment='second'"] x $::trunkMark | |
| 806 | + AND comment='second'"] x | |
| 814 | 807 | |
| 815 | 808 | # A file command acts on a file that an earlier line of the same commit |
| 816 | 809 | # made: D removes it, C copies it and R renames it. Fossil applies D, C |
| 817 | 810 | # and R only to the files of the parent check-in: gone and old stay, dst |
| 818 | 811 | # and new are not made. |
| @@ -1076,11 +1069,11 @@ | ||
| 1076 | 1069 | } |
| 1077 | 1070 | |
| 1078 | 1071 | test_eq import-svn-named-copy-props [import_perm named four run3] x |
| 1079 | 1072 | |
| 1080 | 1073 | # A file that is copied keeps the permission of the file it comes from. |
| 1081 | -test_eq import-svn-named-copy-perm [import_perm named four run2] x $::trunkMark | |
| 1074 | +test_eq import-svn-named-copy-perm [import_perm named four run2] x | |
| 1082 | 1075 | |
| 1083 | 1076 | # With --flat every path is a file of the trunk. |
| 1084 | 1077 | import_svn flat $importDump --flat |
| 1085 | 1078 | test import-svn-flat {$CODE == 0} |
| 1086 | 1079 | test_eq import-svn-flat-files [import_files flat two] "elsewhere/y,\ |
| @@ -1103,12 +1096,11 @@ | ||
| 1103 | 1096 | # |
| 1104 | 1097 | import_svn dircopy \ |
| 1105 | 1098 | "$importHead[import_r 1 one][import_file add trunk/d/f "f\n"][import_r \ |
| 1106 | 1099 | 2 two][import_copy dir trunk/d2 trunk/d 1]" |
| 1107 | 1100 | test import-svn-dir-copy {$CODE == 0} |
| 1108 | -test_eq import-svn-dir-copy-files [import_files dircopy two] "d/f, d2/f" \ | |
| 1109 | - $::trunkMark | |
| 1101 | +test_eq import-svn-dir-copy-files [import_files dircopy two] "d/f, d2/f" | |
| 1110 | 1102 | |
| 1111 | 1103 | # --ignore-tree leaves out a directory and what is in it, on the trunk |
| 1112 | 1104 | # and on a branch, and no other path that begins with the same letters. |
| 1113 | 1105 | # An empty --ignore-tree names nothing. |
| 1114 | 1106 | # |
| @@ -1222,14 +1214,11 @@ | ||
| 1222 | 1214 | "SVN\000[import_window 0 5 5 {0x05 0} {}]"]" \ |
| 1223 | 1215 | "Don't know how to handle NULL input" \ |
| 1224 | 1216 | ] { |
| 1225 | 1217 | import_svn bad-$importName $importDump |
| 1226 | 1218 | test import-svn-bad-$importName {$CODE == 1 && |
| 1227 | - [string first $importError $RESULT] >= 0} \ | |
| 1228 | - [trunk_mark $importName \ | |
| 1229 | - {rev-over-31-bits rev-eleven-digits | |
| 1230 | - node-before-revision}] | |
| 1219 | + [string first $importError $RESULT] >= 0} | |
| 1231 | 1220 | } |
| 1232 | 1221 | |
| 1233 | 1222 | # Each row: the bytes of a property block before its end mark, which make |
| 1234 | 1223 | # the block malformed. A length may be negative, reach past the block or |
| 1235 | 1224 | # not be followed by a newline, a zero byte may come before the newline |
| @@ -1305,11 +1294,11 @@ | ||
| 1305 | 1294 | "a.txt, run.sh x" |
| 1306 | 1295 | |
| 1307 | 1296 | # A copied file keeps the executable permission of its source when the |
| 1308 | 1297 | # node gives no properties or only a property delta. |
| 1309 | 1298 | test_eq import-svn-copy-props [import_files quiet-nodes two] \ |
| 1310 | - "a.txt, delta x, full, nodelta, none x, run.sh x" $::trunkMark | |
| 1299 | + "a.txt, delta x, full, nodelta, none x, run.sh x" | |
| 1311 | 1300 | |
| 1312 | 1301 | # Nothing is left of the tags and the branch that were never made: the |
| 1313 | 1302 | # timeline holds the three check-ins and the tag that closes trunk when |
| 1314 | 1303 | # it is deleted. |
| 1315 | 1304 | test_eq import-svn-never-made [import_sql quiet-nodes "SELECT count(*) |
| @@ -1328,20 +1317,18 @@ | ||
| 1328 | 1317 | # becomes a check-in. |
| 1329 | 1318 | # |
| 1330 | 1319 | import_svn odd-path "$importR1[import_file add trunk/./a "a\n"][import_r 2 \ |
| 1331 | 1320 | two][import_file add trunk/b "b\n"]" |
| 1332 | 1321 | test import-svn-odd-path {$CODE == 1 && |
| 1333 | - [string first "svn path is not a valid file name" $RESULT] >= 0} \ | |
| 1334 | - $::trunkMark | |
| 1322 | + [string first "svn path is not a valid file name" $RESULT] >= 0} | |
| 1335 | 1323 | |
| 1336 | 1324 | # So is a file that is added with no content and no source. |
| 1337 | 1325 | # |
| 1338 | 1326 | import_svn no-content "$importR1[import_file add trunk/a "a\n"][import_record \ |
| 1339 | 1327 | {Node-path trunk/n Node-kind file Node-action add}]" |
| 1340 | 1328 | test import-svn-no-content {$CODE == 1 && |
| 1341 | - [string first "svn file has no content and no source" $RESULT] >= 0} \ | |
| 1342 | - $::trunkMark | |
| 1329 | + [string first "svn file has no content and no source" $RESULT] >= 0} | |
| 1343 | 1330 | |
| 1344 | 1331 | ############################################################################### |
| 1345 | 1332 | # A history made by Subversion, dumped with and without deltas: files, an |
| 1346 | 1333 | # executable and a link on the trunk, a branch and a tag copied from it, |
| 1347 | 1334 | # a change, a renamed file, and the branch deleted. |
| @@ -1389,11 +1376,11 @@ | ||
| 1389 | 1376 | test_eq import-$importName-four "[import_sql $importName "SELECT |
| 1390 | 1377 | group_concat(f.filename, ' ') FROM event e, blob b, |
| 1391 | 1378 | files_of_checkin(b.uuid) f WHERE e.comment='four' AND b.rid=e.objid"];\ |
| 1392 | 1379 | [import_cat $importName four a.txt]" "a.txt link moved.sh; alpha2\n" |
| 1393 | 1380 | test_eq import-$importName-four-perm \ |
| 1394 | - [import_perm $importName four moved.sh] x $::trunkMark | |
| 1381 | + [import_perm $importName four moved.sh] x | |
| 1395 | 1382 | } |
| 1396 | 1383 | } |
| 1397 | 1384 | |
| 1398 | 1385 | ############################################################################### |
| 1399 | 1386 | # A history made by git and written by "git fast-export": files whose |
| 1400 | 1387 |
| --- test/import.test | |
| +++ test/import.test | |
| @@ -7,11 +7,10 @@ | |
| 7 | # |
| 8 | |
| 9 | # The first sections run at every level, and the rest need |
| 10 | # -assurance stress. |
| 11 | test_setup |
| 12 | source [file join $::testfiledir trunk-fixes.tcl] |
| 13 | |
| 14 | # A number in the variable-length form of svndiff0: seven bits a byte, |
| 15 | # most significant first, the high bit set on every byte but the last. |
| 16 | # |
| 17 | proc import_varint {n} { |
| @@ -222,19 +221,19 @@ | |
| 222 | append importStream "data 4\nimp\nM 100644 :1 f.txt\n\n" |
| 223 | write_file git-artifact.fi $importStream |
| 224 | fossil_raw -seconds 60 import --git git-artifact.fossil git-artifact.fi |
| 225 | test import-git-artifact-file {$CODE == 0} |
| 226 | fossil sql -R git-artifact.fossil "SELECT count(*) FROM event WHERE type='ci'" |
| 227 | test_eq import-git-artifact-one-checkin [string trim $RESULT] 1 $::trunkMark |
| 228 | fossil sql -R git-artifact.fossil \ |
| 229 | "SELECT count(*) FROM tag WHERE tagname='sym-planted'" |
| 230 | test_eq import-git-artifact-no-branch [string trim $RESULT] 0 $::trunkMark |
| 231 | fossil_raw cat f.txt -R git-artifact.fossil -r trunk |
| 232 | test_eq import-git-artifact-content $RESULT \ |
| 233 | [join [list \ |
| 234 | "${importArt}# Remove this line to create a well-formed " \ |
| 235 | "Fossil control artifact.\n"] ""] $::trunkMark |
| 236 | |
| 237 | ############################################################################### |
| 238 | # Input that "fossil import" must refuse with an error and exit code 1. |
| 239 | |
| 240 | # Each row: a git stream. The length of a data command is negative, too |
| @@ -262,21 +261,19 @@ | |
| 262 | ] { |
| 263 | write_file refuse-$importName.fi $importStream |
| 264 | fossil_raw -seconds 60 import --git refuse-$importName.fossil \ |
| 265 | refuse-$importName.fi |
| 266 | test import-refuse-git-$importName {$CODE == 1 && |
| 267 | [string first "bad fast-import line" $RESULT] >= 0} \ |
| 268 | [trunk_mark $importName {data-negative data-huge time-past-9999 |
| 269 | time-13-digits time-no-space}] |
| 270 | } |
| 271 | |
| 272 | # A commit command whose name is 992 bytes long, with no slash after its |
| 273 | # fifth byte and no newline, is read within the name. The commit has no |
| 274 | # data and is not made. |
| 275 | write_file git-ref-long.fi "commit [string repeat a 992]" |
| 276 | fossil_raw -seconds 60 import --git git-ref-long.fossil git-ref-long.fi |
| 277 | test import-git-ref-long {$CODE == 0} [sanitizer_trunk_mark] |
| 278 | |
| 279 | # Each row: an svn dump. A header line has no newline after its value, |
| 280 | # because the dump ends there, a zero byte comes first, or the line is |
| 281 | # longer than the importer reads at once; a file on the trunk has no |
| 282 | # Node-action. |
| @@ -296,11 +293,11 @@ | |
| 296 | ] { |
| 297 | write_file refuse-$importName.dump $importDump |
| 298 | fossil_raw -seconds 60 import --svn refuse-$importName.fossil \ |
| 299 | refuse-$importName.dump |
| 300 | test import-refuse-svn-$importName {$CODE == 1 && |
| 301 | [string first "svn-dump data format broken" $RESULT] >= 0} $::trunkMark |
| 302 | } |
| 303 | |
| 304 | # A file outside trunk, branches and tags is passed over even when it has |
| 305 | # no Node-action. |
| 306 | # |
| @@ -321,11 +318,11 @@ | |
| 321 | "Content-length: 1\n\nx\n\n"] ""] |
| 322 | foreach importName {trunk branches tags} { |
| 323 | fossil_raw -seconds 60 import --svn --$importName "" \ |
| 324 | refuse-$importName.fossil base.dump |
| 325 | test import-refuse-svn-empty-$importName {$CODE == 1 && [string first \ |
| 326 | "may be empty only with a non-empty --base" $RESULT] >= 0} $::trunkMark |
| 327 | } |
| 328 | fossil_raw -seconds 60 import --svn --base proj --trunk "" base.fossil base.dump |
| 329 | test import-svn-base-empty-trunk {$CODE == 0} |
| 330 | fossil sql -R base.fossil "SELECT group_concat(f.filename, ' ') |
| 331 | FROM event e, blob b, files_of_checkin(b.uuid) f WHERE b.rid=e.objid" |
| @@ -643,12 +640,11 @@ | |
| 643 | |
| 644 | # Without --force an existing repository is not written over, and the |
| 645 | # command says so rather than give an error from the database. |
| 646 | # |
| 647 | fossil_raw -seconds 60 import --git names.fossil names.fi |
| 648 | test import-git-exists {$CODE == 1 && [holds_strings $RESULT {!SQLITE_ERROR}]} \ |
| 649 | $::trunkMark |
| 650 | test_eq import-git-exists-untouched [import_checkins names] "names fewer" |
| 651 | |
| 652 | # With --force an existing repository is replaced. The stream comes on |
| 653 | # standard input when no file is named. |
| 654 | # |
| @@ -738,12 +734,11 @@ | |
| 738 | append importStream [import_commit refs/heads/master 2 orphan \ |
| 739 | "from :5\nM 100644 :1 a\n"] |
| 740 | fossil_raw -seconds 60 -input $importStream import --git \ |
| 741 | --import-marks zero.marks zero.fossil |
| 742 | test import-git-import-marks-zero {$CODE == 1 && |
| 743 | [string first "error importing marks from file: zero.marks" $RESULT] >= 0} \ |
| 744 | $::trunkMark |
| 745 | |
| 746 | # Each row: a marks line that is not a commit or file mark of Fossil's, |
| 747 | # which "fossil export --import-marks" refuses. |
| 748 | # |
| 749 | fossil init marks-export.fossil |
| @@ -754,12 +749,11 @@ | |
| 754 | ] { |
| 755 | write_file bad-$importName.marks "$importLine\n" |
| 756 | fossil_raw -seconds 60 export --git --import-marks bad-$importName.marks \ |
| 757 | -R marks-export.fossil |
| 758 | test import-export-marks-$importName {$CODE == 1 && [string first \ |
| 759 | "error importing marks from file: bad-$importName.marks" $RESULT] >= 0} \ |
| 760 | $::trunkMark |
| 761 | } |
| 762 | |
| 763 | # Marks may name a check-in made by "fossil commit", whose files carry no |
| 764 | # permission, and the files of such a parent are kept. A commit whose |
| 765 | # "from" is the mark of a file keeps nothing from it. |
| @@ -796,12 +790,11 @@ | |
| 796 | append importStream [import_commit refs/heads/master 2 first "M 100644 :1 a\n"] |
| 797 | write_file default.fi $importStream |
| 798 | fossil_raw -seconds 60 import default.fossil default.fi |
| 799 | test import-default-format {$CODE == 0} |
| 800 | test_eq import-default-format-checkins [import_checkins default] first |
| 801 | test_eq import-default-format-tags [import_tags default first] "master trunk" \ |
| 802 | $::trunkMark |
| 803 | |
| 804 | # A ref of fewer than five bytes names its branch. |
| 805 | # |
| 806 | set importStream [import_blob 1 "hello\n"] |
| 807 | append importStream [import_commit refs/heads/master 2 first \ |
| @@ -808,11 +801,11 @@ | |
| 808 | "M 100644 :1 a-long-name-for-a-file\n"] |
| 809 | append importStream [import_commit x 3 second "M 100644 :1 b\n"] |
| 810 | import_git shortref $importStream |
| 811 | test_eq import-git-short-ref [import_sql shortref "SELECT value |
| 812 | FROM event, tagxref WHERE rid=objid AND tagxref.tagid=8 |
| 813 | AND comment='second'"] x $::trunkMark |
| 814 | |
| 815 | # A file command acts on a file that an earlier line of the same commit |
| 816 | # made: D removes it, C copies it and R renames it. Fossil applies D, C |
| 817 | # and R only to the files of the parent check-in: gone and old stay, dst |
| 818 | # and new are not made. |
| @@ -1076,11 +1069,11 @@ | |
| 1076 | } |
| 1077 | |
| 1078 | test_eq import-svn-named-copy-props [import_perm named four run3] x |
| 1079 | |
| 1080 | # A file that is copied keeps the permission of the file it comes from. |
| 1081 | test_eq import-svn-named-copy-perm [import_perm named four run2] x $::trunkMark |
| 1082 | |
| 1083 | # With --flat every path is a file of the trunk. |
| 1084 | import_svn flat $importDump --flat |
| 1085 | test import-svn-flat {$CODE == 0} |
| 1086 | test_eq import-svn-flat-files [import_files flat two] "elsewhere/y,\ |
| @@ -1103,12 +1096,11 @@ | |
| 1103 | # |
| 1104 | import_svn dircopy \ |
| 1105 | "$importHead[import_r 1 one][import_file add trunk/d/f "f\n"][import_r \ |
| 1106 | 2 two][import_copy dir trunk/d2 trunk/d 1]" |
| 1107 | test import-svn-dir-copy {$CODE == 0} |
| 1108 | test_eq import-svn-dir-copy-files [import_files dircopy two] "d/f, d2/f" \ |
| 1109 | $::trunkMark |
| 1110 | |
| 1111 | # --ignore-tree leaves out a directory and what is in it, on the trunk |
| 1112 | # and on a branch, and no other path that begins with the same letters. |
| 1113 | # An empty --ignore-tree names nothing. |
| 1114 | # |
| @@ -1222,14 +1214,11 @@ | |
| 1222 | "SVN\000[import_window 0 5 5 {0x05 0} {}]"]" \ |
| 1223 | "Don't know how to handle NULL input" \ |
| 1224 | ] { |
| 1225 | import_svn bad-$importName $importDump |
| 1226 | test import-svn-bad-$importName {$CODE == 1 && |
| 1227 | [string first $importError $RESULT] >= 0} \ |
| 1228 | [trunk_mark $importName \ |
| 1229 | {rev-over-31-bits rev-eleven-digits |
| 1230 | node-before-revision}] |
| 1231 | } |
| 1232 | |
| 1233 | # Each row: the bytes of a property block before its end mark, which make |
| 1234 | # the block malformed. A length may be negative, reach past the block or |
| 1235 | # not be followed by a newline, a zero byte may come before the newline |
| @@ -1305,11 +1294,11 @@ | |
| 1305 | "a.txt, run.sh x" |
| 1306 | |
| 1307 | # A copied file keeps the executable permission of its source when the |
| 1308 | # node gives no properties or only a property delta. |
| 1309 | test_eq import-svn-copy-props [import_files quiet-nodes two] \ |
| 1310 | "a.txt, delta x, full, nodelta, none x, run.sh x" $::trunkMark |
| 1311 | |
| 1312 | # Nothing is left of the tags and the branch that were never made: the |
| 1313 | # timeline holds the three check-ins and the tag that closes trunk when |
| 1314 | # it is deleted. |
| 1315 | test_eq import-svn-never-made [import_sql quiet-nodes "SELECT count(*) |
| @@ -1328,20 +1317,18 @@ | |
| 1328 | # becomes a check-in. |
| 1329 | # |
| 1330 | import_svn odd-path "$importR1[import_file add trunk/./a "a\n"][import_r 2 \ |
| 1331 | two][import_file add trunk/b "b\n"]" |
| 1332 | test import-svn-odd-path {$CODE == 1 && |
| 1333 | [string first "svn path is not a valid file name" $RESULT] >= 0} \ |
| 1334 | $::trunkMark |
| 1335 | |
| 1336 | # So is a file that is added with no content and no source. |
| 1337 | # |
| 1338 | import_svn no-content "$importR1[import_file add trunk/a "a\n"][import_record \ |
| 1339 | {Node-path trunk/n Node-kind file Node-action add}]" |
| 1340 | test import-svn-no-content {$CODE == 1 && |
| 1341 | [string first "svn file has no content and no source" $RESULT] >= 0} \ |
| 1342 | $::trunkMark |
| 1343 | |
| 1344 | ############################################################################### |
| 1345 | # A history made by Subversion, dumped with and without deltas: files, an |
| 1346 | # executable and a link on the trunk, a branch and a tag copied from it, |
| 1347 | # a change, a renamed file, and the branch deleted. |
| @@ -1389,11 +1376,11 @@ | |
| 1389 | test_eq import-$importName-four "[import_sql $importName "SELECT |
| 1390 | group_concat(f.filename, ' ') FROM event e, blob b, |
| 1391 | files_of_checkin(b.uuid) f WHERE e.comment='four' AND b.rid=e.objid"];\ |
| 1392 | [import_cat $importName four a.txt]" "a.txt link moved.sh; alpha2\n" |
| 1393 | test_eq import-$importName-four-perm \ |
| 1394 | [import_perm $importName four moved.sh] x $::trunkMark |
| 1395 | } |
| 1396 | } |
| 1397 | |
| 1398 | ############################################################################### |
| 1399 | # A history made by git and written by "git fast-export": files whose |
| 1400 |
| --- test/import.test | |
| +++ test/import.test | |
| @@ -7,11 +7,10 @@ | |
| 7 | # |
| 8 | |
| 9 | # The first sections run at every level, and the rest need |
| 10 | # -assurance stress. |
| 11 | test_setup |
| 12 | |
| 13 | # A number in the variable-length form of svndiff0: seven bits a byte, |
| 14 | # most significant first, the high bit set on every byte but the last. |
| 15 | # |
| 16 | proc import_varint {n} { |
| @@ -222,19 +221,19 @@ | |
| 221 | append importStream "data 4\nimp\nM 100644 :1 f.txt\n\n" |
| 222 | write_file git-artifact.fi $importStream |
| 223 | fossil_raw -seconds 60 import --git git-artifact.fossil git-artifact.fi |
| 224 | test import-git-artifact-file {$CODE == 0} |
| 225 | fossil sql -R git-artifact.fossil "SELECT count(*) FROM event WHERE type='ci'" |
| 226 | test_eq import-git-artifact-one-checkin [string trim $RESULT] 1 |
| 227 | fossil sql -R git-artifact.fossil \ |
| 228 | "SELECT count(*) FROM tag WHERE tagname='sym-planted'" |
| 229 | test_eq import-git-artifact-no-branch [string trim $RESULT] 0 |
| 230 | fossil_raw cat f.txt -R git-artifact.fossil -r trunk |
| 231 | test_eq import-git-artifact-content $RESULT \ |
| 232 | [join [list \ |
| 233 | "${importArt}# Remove this line to create a well-formed " \ |
| 234 | "Fossil control artifact.\n"] ""] |
| 235 | |
| 236 | ############################################################################### |
| 237 | # Input that "fossil import" must refuse with an error and exit code 1. |
| 238 | |
| 239 | # Each row: a git stream. The length of a data command is negative, too |
| @@ -262,21 +261,19 @@ | |
| 261 | ] { |
| 262 | write_file refuse-$importName.fi $importStream |
| 263 | fossil_raw -seconds 60 import --git refuse-$importName.fossil \ |
| 264 | refuse-$importName.fi |
| 265 | test import-refuse-git-$importName {$CODE == 1 && |
| 266 | [string first "bad fast-import line" $RESULT] >= 0} |
| 267 | } |
| 268 | |
| 269 | # A commit command whose name is 992 bytes long, with no slash after its |
| 270 | # fifth byte and no newline, is read within the name. The commit has no |
| 271 | # data and is not made. |
| 272 | write_file git-ref-long.fi "commit [string repeat a 992]" |
| 273 | fossil_raw -seconds 60 import --git git-ref-long.fossil git-ref-long.fi |
| 274 | test import-git-ref-long {$CODE == 0} |
| 275 | |
| 276 | # Each row: an svn dump. A header line has no newline after its value, |
| 277 | # because the dump ends there, a zero byte comes first, or the line is |
| 278 | # longer than the importer reads at once; a file on the trunk has no |
| 279 | # Node-action. |
| @@ -296,11 +293,11 @@ | |
| 293 | ] { |
| 294 | write_file refuse-$importName.dump $importDump |
| 295 | fossil_raw -seconds 60 import --svn refuse-$importName.fossil \ |
| 296 | refuse-$importName.dump |
| 297 | test import-refuse-svn-$importName {$CODE == 1 && |
| 298 | [string first "svn-dump data format broken" $RESULT] >= 0} |
| 299 | } |
| 300 | |
| 301 | # A file outside trunk, branches and tags is passed over even when it has |
| 302 | # no Node-action. |
| 303 | # |
| @@ -321,11 +318,11 @@ | |
| 318 | "Content-length: 1\n\nx\n\n"] ""] |
| 319 | foreach importName {trunk branches tags} { |
| 320 | fossil_raw -seconds 60 import --svn --$importName "" \ |
| 321 | refuse-$importName.fossil base.dump |
| 322 | test import-refuse-svn-empty-$importName {$CODE == 1 && [string first \ |
| 323 | "may be empty only with a non-empty --base" $RESULT] >= 0} |
| 324 | } |
| 325 | fossil_raw -seconds 60 import --svn --base proj --trunk "" base.fossil base.dump |
| 326 | test import-svn-base-empty-trunk {$CODE == 0} |
| 327 | fossil sql -R base.fossil "SELECT group_concat(f.filename, ' ') |
| 328 | FROM event e, blob b, files_of_checkin(b.uuid) f WHERE b.rid=e.objid" |
| @@ -643,12 +640,11 @@ | |
| 640 | |
| 641 | # Without --force an existing repository is not written over, and the |
| 642 | # command says so rather than give an error from the database. |
| 643 | # |
| 644 | fossil_raw -seconds 60 import --git names.fossil names.fi |
| 645 | test import-git-exists {$CODE == 1 && [holds_strings $RESULT {!SQLITE_ERROR}]} |
| 646 | test_eq import-git-exists-untouched [import_checkins names] "names fewer" |
| 647 | |
| 648 | # With --force an existing repository is replaced. The stream comes on |
| 649 | # standard input when no file is named. |
| 650 | # |
| @@ -738,12 +734,11 @@ | |
| 734 | append importStream [import_commit refs/heads/master 2 orphan \ |
| 735 | "from :5\nM 100644 :1 a\n"] |
| 736 | fossil_raw -seconds 60 -input $importStream import --git \ |
| 737 | --import-marks zero.marks zero.fossil |
| 738 | test import-git-import-marks-zero {$CODE == 1 && |
| 739 | [string first "error importing marks from file: zero.marks" $RESULT] >= 0} |
| 740 | |
| 741 | # Each row: a marks line that is not a commit or file mark of Fossil's, |
| 742 | # which "fossil export --import-marks" refuses. |
| 743 | # |
| 744 | fossil init marks-export.fossil |
| @@ -754,12 +749,11 @@ | |
| 749 | ] { |
| 750 | write_file bad-$importName.marks "$importLine\n" |
| 751 | fossil_raw -seconds 60 export --git --import-marks bad-$importName.marks \ |
| 752 | -R marks-export.fossil |
| 753 | test import-export-marks-$importName {$CODE == 1 && [string first \ |
| 754 | "error importing marks from file: bad-$importName.marks" $RESULT] >= 0} |
| 755 | } |
| 756 | |
| 757 | # Marks may name a check-in made by "fossil commit", whose files carry no |
| 758 | # permission, and the files of such a parent are kept. A commit whose |
| 759 | # "from" is the mark of a file keeps nothing from it. |
| @@ -796,12 +790,11 @@ | |
| 790 | append importStream [import_commit refs/heads/master 2 first "M 100644 :1 a\n"] |
| 791 | write_file default.fi $importStream |
| 792 | fossil_raw -seconds 60 import default.fossil default.fi |
| 793 | test import-default-format {$CODE == 0} |
| 794 | test_eq import-default-format-checkins [import_checkins default] first |
| 795 | test_eq import-default-format-tags [import_tags default first] "master trunk" |
| 796 | |
| 797 | # A ref of fewer than five bytes names its branch. |
| 798 | # |
| 799 | set importStream [import_blob 1 "hello\n"] |
| 800 | append importStream [import_commit refs/heads/master 2 first \ |
| @@ -808,11 +801,11 @@ | |
| 801 | "M 100644 :1 a-long-name-for-a-file\n"] |
| 802 | append importStream [import_commit x 3 second "M 100644 :1 b\n"] |
| 803 | import_git shortref $importStream |
| 804 | test_eq import-git-short-ref [import_sql shortref "SELECT value |
| 805 | FROM event, tagxref WHERE rid=objid AND tagxref.tagid=8 |
| 806 | AND comment='second'"] x |
| 807 | |
| 808 | # A file command acts on a file that an earlier line of the same commit |
| 809 | # made: D removes it, C copies it and R renames it. Fossil applies D, C |
| 810 | # and R only to the files of the parent check-in: gone and old stay, dst |
| 811 | # and new are not made. |
| @@ -1076,11 +1069,11 @@ | |
| 1069 | } |
| 1070 | |
| 1071 | test_eq import-svn-named-copy-props [import_perm named four run3] x |
| 1072 | |
| 1073 | # A file that is copied keeps the permission of the file it comes from. |
| 1074 | test_eq import-svn-named-copy-perm [import_perm named four run2] x |
| 1075 | |
| 1076 | # With --flat every path is a file of the trunk. |
| 1077 | import_svn flat $importDump --flat |
| 1078 | test import-svn-flat {$CODE == 0} |
| 1079 | test_eq import-svn-flat-files [import_files flat two] "elsewhere/y,\ |
| @@ -1103,12 +1096,11 @@ | |
| 1096 | # |
| 1097 | import_svn dircopy \ |
| 1098 | "$importHead[import_r 1 one][import_file add trunk/d/f "f\n"][import_r \ |
| 1099 | 2 two][import_copy dir trunk/d2 trunk/d 1]" |
| 1100 | test import-svn-dir-copy {$CODE == 0} |
| 1101 | test_eq import-svn-dir-copy-files [import_files dircopy two] "d/f, d2/f" |
| 1102 | |
| 1103 | # --ignore-tree leaves out a directory and what is in it, on the trunk |
| 1104 | # and on a branch, and no other path that begins with the same letters. |
| 1105 | # An empty --ignore-tree names nothing. |
| 1106 | # |
| @@ -1222,14 +1214,11 @@ | |
| 1214 | "SVN\000[import_window 0 5 5 {0x05 0} {}]"]" \ |
| 1215 | "Don't know how to handle NULL input" \ |
| 1216 | ] { |
| 1217 | import_svn bad-$importName $importDump |
| 1218 | test import-svn-bad-$importName {$CODE == 1 && |
| 1219 | [string first $importError $RESULT] >= 0} |
| 1220 | } |
| 1221 | |
| 1222 | # Each row: the bytes of a property block before its end mark, which make |
| 1223 | # the block malformed. A length may be negative, reach past the block or |
| 1224 | # not be followed by a newline, a zero byte may come before the newline |
| @@ -1305,11 +1294,11 @@ | |
| 1294 | "a.txt, run.sh x" |
| 1295 | |
| 1296 | # A copied file keeps the executable permission of its source when the |
| 1297 | # node gives no properties or only a property delta. |
| 1298 | test_eq import-svn-copy-props [import_files quiet-nodes two] \ |
| 1299 | "a.txt, delta x, full, nodelta, none x, run.sh x" |
| 1300 | |
| 1301 | # Nothing is left of the tags and the branch that were never made: the |
| 1302 | # timeline holds the three check-ins and the tag that closes trunk when |
| 1303 | # it is deleted. |
| 1304 | test_eq import-svn-never-made [import_sql quiet-nodes "SELECT count(*) |
| @@ -1328,20 +1317,18 @@ | |
| 1317 | # becomes a check-in. |
| 1318 | # |
| 1319 | import_svn odd-path "$importR1[import_file add trunk/./a "a\n"][import_r 2 \ |
| 1320 | two][import_file add trunk/b "b\n"]" |
| 1321 | test import-svn-odd-path {$CODE == 1 && |
| 1322 | [string first "svn path is not a valid file name" $RESULT] >= 0} |
| 1323 | |
| 1324 | # So is a file that is added with no content and no source. |
| 1325 | # |
| 1326 | import_svn no-content "$importR1[import_file add trunk/a "a\n"][import_record \ |
| 1327 | {Node-path trunk/n Node-kind file Node-action add}]" |
| 1328 | test import-svn-no-content {$CODE == 1 && |
| 1329 | [string first "svn file has no content and no source" $RESULT] >= 0} |
| 1330 | |
| 1331 | ############################################################################### |
| 1332 | # A history made by Subversion, dumped with and without deltas: files, an |
| 1333 | # executable and a link on the trunk, a branch and a tag copied from it, |
| 1334 | # a change, a renamed file, and the branch deleted. |
| @@ -1389,11 +1376,11 @@ | |
| 1376 | test_eq import-$importName-four "[import_sql $importName "SELECT |
| 1377 | group_concat(f.filename, ' ') FROM event e, blob b, |
| 1378 | files_of_checkin(b.uuid) f WHERE e.comment='four' AND b.rid=e.objid"];\ |
| 1379 | [import_cat $importName four a.txt]" "a.txt link moved.sh; alpha2\n" |
| 1380 | test_eq import-$importName-four-perm \ |
| 1381 | [import_perm $importName four moved.sh] x |
| 1382 | } |
| 1383 | } |
| 1384 | |
| 1385 | ############################################################################### |
| 1386 | # A history made by git and written by "git fast-export": files whose |
| 1387 |
+8
-12
| --- test/login.test | ||
| +++ test/login.test | ||
| @@ -17,11 +17,10 @@ | ||
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | require_no_open_checkout |
| 20 | 20 | |
| 21 | 21 | test_setup |
| 22 | -source [file join $::testfiledir trunk-fixes.tcl] | |
| 23 | 22 | |
| 24 | 23 | set loginRepo [file join [pwd] .rep.fossil] |
| 25 | 24 | |
| 26 | 25 | # A user with Read, Write and Password capability, and a Setup user. |
| 27 | 26 | fossil user new loginbob [email protected] bobpw |
| @@ -469,12 +468,11 @@ | ||
| 469 | 468 | } { |
| 470 | 469 | set loginReply [login_get /test-env \ |
| 471 | 470 | [list "Cookie: $loginCookieName=$loginCkValue"]] |
| 472 | 471 | test login-cookie-bad-$loginCkName {$CODE == 0 |
| 473 | 472 | && [reply_status $loginReply] eq "HTTP/1.0 200 OK" |
| 474 | - && [login_who $loginReply] eq "nobody"} \ | |
| 475 | - [sanitizer_trunk_mark $loginCkName {slash end-slash}] | |
| 473 | + && [login_who $loginReply] eq "nobody"} | |
| 476 | 474 | } |
| 477 | 475 | |
| 478 | 476 | ############################################################################### |
| 479 | 477 | # Where a login goes afterwards when the request carries "fossil-goto", as a |
| 480 | 478 | # query parameter, a form field or a cookie: to that address if it is on this |
| @@ -497,26 +495,25 @@ | ||
| 497 | 495 | same-site http://x/timeline http://x/timeline \ |
| 498 | 496 | ] { |
| 499 | 497 | set loginReply [login_get \ |
| 500 | 498 | "/login?u=loginbob&p=newbobpw&fossil-goto=$loginGoTarget"] |
| 501 | 499 | test_eq login-goto-query-$loginGoName [reply_header $loginReply Location] \ |
| 502 | - $loginGoWant [trunk_mark $loginGoName {other-site host-prefix}] | |
| 500 | + $loginGoWant | |
| 503 | 501 | set loginReply [login_form loginbob newbobpw "fossil-goto=$loginGoTarget"] |
| 504 | 502 | test_eq login-goto-form-$loginGoName [reply_header $loginReply Location] \ |
| 505 | - $loginGoWant [trunk_mark $loginGoName {other-site host-prefix}] | |
| 503 | + $loginGoWant | |
| 506 | 504 | set loginReply [login_post /login "u=loginbob&p=newbobpw&in=Login" \ |
| 507 | 505 | [list "Cookie: fossil-goto=$loginGoTarget"]] |
| 508 | 506 | test_eq login-goto-cookie-$loginGoName [reply_header $loginReply Location] \ |
| 509 | - $loginGoWant [trunk_mark $loginGoName {other-site host-prefix}] | |
| 507 | + $loginGoWant | |
| 510 | 508 | set loginReply [login_get "/login?$loginAnon&fossil-goto=$loginGoTarget"] |
| 511 | 509 | test login-goto-anonymous-$loginGoName \ |
| 512 | 510 | {[string match "*anonymous*" [reply_header $loginReply Set-Cookie]] |
| 513 | - && [reply_header $loginReply Location] eq $loginGoWant} \ | |
| 514 | - [trunk_mark $loginGoName {other-site host-prefix}] | |
| 511 | + && [reply_header $loginReply Location] eq $loginGoWant} | |
| 515 | 512 | set loginReply [login_get "/ityaar?$loginRobot&fossil-goto=$loginGoTarget"] |
| 516 | 513 | test_eq login-goto-ityaar-$loginGoName [reply_header $loginReply Location] \ |
| 517 | - $loginGoWant [trunk_mark $loginGoName {other-site host-prefix}] | |
| 514 | + $loginGoWant | |
| 518 | 515 | } |
| 519 | 516 | |
| 520 | 517 | # The captcha page at /honeypot remembers the address asked for in a |
| 521 | 518 | # "fossil-goto" cookie, and a right answer sent with that cookie goes there. |
| 522 | 519 | set loginReply [login_get /honeypot?x=1] |
| @@ -1326,11 +1323,11 @@ | ||
| 1326 | 1323 | base-more http://xy $loginHome \ |
| 1327 | 1324 | other http://y/ $loginHome \ |
| 1328 | 1325 | ] { |
| 1329 | 1326 | test_eq login-goto-$loginFgName [reply_header [login_get \ |
| 1330 | 1327 | "/login?u=loginbob&p=bobfinal&fossil-goto=$loginFgTarget"] Location] \ |
| 1331 | - $loginFgWant [trunk_mark $loginFgName {base-more other}] | |
| 1328 | + $loginFgWant | |
| 1332 | 1329 | } |
| 1333 | 1330 | |
| 1334 | 1331 | # A GET with "out" does not log out. |
| 1335 | 1332 | test login-logout-get {[string match \ |
| 1336 | 1333 | "*Currently logged in as <b>loginbob</b>*" \ |
| @@ -1553,12 +1550,11 @@ | ||
| 1553 | 1550 | end-slash "[string repeat a 50]/" \ |
| 1554 | 1551 | ] { |
| 1555 | 1552 | set loginReply [login_get "/ityaar?captchaseed=$loginSeed&captcha=zzzzzzzz" \ |
| 1556 | 1553 | [list "Cookie: $loginGrpCookie=$loginWfValue"]] |
| 1557 | 1554 | test login-group-wellformed-$loginWfName \ |
| 1558 | - {[string match "*Prove that you are human*" $loginReply]} \ | |
| 1559 | - [sanitizer_trunk_mark $loginWfName end-slash] | |
| 1555 | + {[string match "*Prove that you are human*" $loginReply]} | |
| 1560 | 1556 | } |
| 1561 | 1557 | fossil login-group leave |
| 1562 | 1558 | |
| 1563 | 1559 | # An empty login-group subcommand is unknown. |
| 1564 | 1560 | fossil_raw login-group "" |
| 1565 | 1561 |
| --- test/login.test | |
| +++ test/login.test | |
| @@ -17,11 +17,10 @@ | |
| 17 | } |
| 18 | |
| 19 | require_no_open_checkout |
| 20 | |
| 21 | test_setup |
| 22 | source [file join $::testfiledir trunk-fixes.tcl] |
| 23 | |
| 24 | set loginRepo [file join [pwd] .rep.fossil] |
| 25 | |
| 26 | # A user with Read, Write and Password capability, and a Setup user. |
| 27 | fossil user new loginbob [email protected] bobpw |
| @@ -469,12 +468,11 @@ | |
| 469 | } { |
| 470 | set loginReply [login_get /test-env \ |
| 471 | [list "Cookie: $loginCookieName=$loginCkValue"]] |
| 472 | test login-cookie-bad-$loginCkName {$CODE == 0 |
| 473 | && [reply_status $loginReply] eq "HTTP/1.0 200 OK" |
| 474 | && [login_who $loginReply] eq "nobody"} \ |
| 475 | [sanitizer_trunk_mark $loginCkName {slash end-slash}] |
| 476 | } |
| 477 | |
| 478 | ############################################################################### |
| 479 | # Where a login goes afterwards when the request carries "fossil-goto", as a |
| 480 | # query parameter, a form field or a cookie: to that address if it is on this |
| @@ -497,26 +495,25 @@ | |
| 497 | same-site http://x/timeline http://x/timeline \ |
| 498 | ] { |
| 499 | set loginReply [login_get \ |
| 500 | "/login?u=loginbob&p=newbobpw&fossil-goto=$loginGoTarget"] |
| 501 | test_eq login-goto-query-$loginGoName [reply_header $loginReply Location] \ |
| 502 | $loginGoWant [trunk_mark $loginGoName {other-site host-prefix}] |
| 503 | set loginReply [login_form loginbob newbobpw "fossil-goto=$loginGoTarget"] |
| 504 | test_eq login-goto-form-$loginGoName [reply_header $loginReply Location] \ |
| 505 | $loginGoWant [trunk_mark $loginGoName {other-site host-prefix}] |
| 506 | set loginReply [login_post /login "u=loginbob&p=newbobpw&in=Login" \ |
| 507 | [list "Cookie: fossil-goto=$loginGoTarget"]] |
| 508 | test_eq login-goto-cookie-$loginGoName [reply_header $loginReply Location] \ |
| 509 | $loginGoWant [trunk_mark $loginGoName {other-site host-prefix}] |
| 510 | set loginReply [login_get "/login?$loginAnon&fossil-goto=$loginGoTarget"] |
| 511 | test login-goto-anonymous-$loginGoName \ |
| 512 | {[string match "*anonymous*" [reply_header $loginReply Set-Cookie]] |
| 513 | && [reply_header $loginReply Location] eq $loginGoWant} \ |
| 514 | [trunk_mark $loginGoName {other-site host-prefix}] |
| 515 | set loginReply [login_get "/ityaar?$loginRobot&fossil-goto=$loginGoTarget"] |
| 516 | test_eq login-goto-ityaar-$loginGoName [reply_header $loginReply Location] \ |
| 517 | $loginGoWant [trunk_mark $loginGoName {other-site host-prefix}] |
| 518 | } |
| 519 | |
| 520 | # The captcha page at /honeypot remembers the address asked for in a |
| 521 | # "fossil-goto" cookie, and a right answer sent with that cookie goes there. |
| 522 | set loginReply [login_get /honeypot?x=1] |
| @@ -1326,11 +1323,11 @@ | |
| 1326 | base-more http://xy $loginHome \ |
| 1327 | other http://y/ $loginHome \ |
| 1328 | ] { |
| 1329 | test_eq login-goto-$loginFgName [reply_header [login_get \ |
| 1330 | "/login?u=loginbob&p=bobfinal&fossil-goto=$loginFgTarget"] Location] \ |
| 1331 | $loginFgWant [trunk_mark $loginFgName {base-more other}] |
| 1332 | } |
| 1333 | |
| 1334 | # A GET with "out" does not log out. |
| 1335 | test login-logout-get {[string match \ |
| 1336 | "*Currently logged in as <b>loginbob</b>*" \ |
| @@ -1553,12 +1550,11 @@ | |
| 1553 | end-slash "[string repeat a 50]/" \ |
| 1554 | ] { |
| 1555 | set loginReply [login_get "/ityaar?captchaseed=$loginSeed&captcha=zzzzzzzz" \ |
| 1556 | [list "Cookie: $loginGrpCookie=$loginWfValue"]] |
| 1557 | test login-group-wellformed-$loginWfName \ |
| 1558 | {[string match "*Prove that you are human*" $loginReply]} \ |
| 1559 | [sanitizer_trunk_mark $loginWfName end-slash] |
| 1560 | } |
| 1561 | fossil login-group leave |
| 1562 | |
| 1563 | # An empty login-group subcommand is unknown. |
| 1564 | fossil_raw login-group "" |
| 1565 |
| --- test/login.test | |
| +++ test/login.test | |
| @@ -17,11 +17,10 @@ | |
| 17 | } |
| 18 | |
| 19 | require_no_open_checkout |
| 20 | |
| 21 | test_setup |
| 22 | |
| 23 | set loginRepo [file join [pwd] .rep.fossil] |
| 24 | |
| 25 | # A user with Read, Write and Password capability, and a Setup user. |
| 26 | fossil user new loginbob [email protected] bobpw |
| @@ -469,12 +468,11 @@ | |
| 468 | } { |
| 469 | set loginReply [login_get /test-env \ |
| 470 | [list "Cookie: $loginCookieName=$loginCkValue"]] |
| 471 | test login-cookie-bad-$loginCkName {$CODE == 0 |
| 472 | && [reply_status $loginReply] eq "HTTP/1.0 200 OK" |
| 473 | && [login_who $loginReply] eq "nobody"} |
| 474 | } |
| 475 | |
| 476 | ############################################################################### |
| 477 | # Where a login goes afterwards when the request carries "fossil-goto", as a |
| 478 | # query parameter, a form field or a cookie: to that address if it is on this |
| @@ -497,26 +495,25 @@ | |
| 495 | same-site http://x/timeline http://x/timeline \ |
| 496 | ] { |
| 497 | set loginReply [login_get \ |
| 498 | "/login?u=loginbob&p=newbobpw&fossil-goto=$loginGoTarget"] |
| 499 | test_eq login-goto-query-$loginGoName [reply_header $loginReply Location] \ |
| 500 | $loginGoWant |
| 501 | set loginReply [login_form loginbob newbobpw "fossil-goto=$loginGoTarget"] |
| 502 | test_eq login-goto-form-$loginGoName [reply_header $loginReply Location] \ |
| 503 | $loginGoWant |
| 504 | set loginReply [login_post /login "u=loginbob&p=newbobpw&in=Login" \ |
| 505 | [list "Cookie: fossil-goto=$loginGoTarget"]] |
| 506 | test_eq login-goto-cookie-$loginGoName [reply_header $loginReply Location] \ |
| 507 | $loginGoWant |
| 508 | set loginReply [login_get "/login?$loginAnon&fossil-goto=$loginGoTarget"] |
| 509 | test login-goto-anonymous-$loginGoName \ |
| 510 | {[string match "*anonymous*" [reply_header $loginReply Set-Cookie]] |
| 511 | && [reply_header $loginReply Location] eq $loginGoWant} |
| 512 | set loginReply [login_get "/ityaar?$loginRobot&fossil-goto=$loginGoTarget"] |
| 513 | test_eq login-goto-ityaar-$loginGoName [reply_header $loginReply Location] \ |
| 514 | $loginGoWant |
| 515 | } |
| 516 | |
| 517 | # The captcha page at /honeypot remembers the address asked for in a |
| 518 | # "fossil-goto" cookie, and a right answer sent with that cookie goes there. |
| 519 | set loginReply [login_get /honeypot?x=1] |
| @@ -1326,11 +1323,11 @@ | |
| 1323 | base-more http://xy $loginHome \ |
| 1324 | other http://y/ $loginHome \ |
| 1325 | ] { |
| 1326 | test_eq login-goto-$loginFgName [reply_header [login_get \ |
| 1327 | "/login?u=loginbob&p=bobfinal&fossil-goto=$loginFgTarget"] Location] \ |
| 1328 | $loginFgWant |
| 1329 | } |
| 1330 | |
| 1331 | # A GET with "out" does not log out. |
| 1332 | test login-logout-get {[string match \ |
| 1333 | "*Currently logged in as <b>loginbob</b>*" \ |
| @@ -1553,12 +1550,11 @@ | |
| 1550 | end-slash "[string repeat a 50]/" \ |
| 1551 | ] { |
| 1552 | set loginReply [login_get "/ityaar?captchaseed=$loginSeed&captcha=zzzzzzzz" \ |
| 1553 | [list "Cookie: $loginGrpCookie=$loginWfValue"]] |
| 1554 | test login-group-wellformed-$loginWfName \ |
| 1555 | {[string match "*Prove that you are human*" $loginReply]} |
| 1556 | } |
| 1557 | fossil login-group leave |
| 1558 | |
| 1559 | # An empty login-group subcommand is unknown. |
| 1560 | fossil_raw login-group "" |
| 1561 |
+12
-20
| --- test/name.test | ||
| +++ test/name.test | ||
| @@ -11,11 +11,10 @@ | ||
| 11 | 11 | # The first sections run at every level, and the rest need |
| 12 | 12 | # -assurance stress. |
| 13 | 13 | require_no_open_checkout |
| 14 | 14 | |
| 15 | 15 | test_setup "" |
| 16 | -source [file join $::testfiledir trunk-fixes.tcl] | |
| 17 | 16 | |
| 18 | 17 | set nameRepo [file join [pwd] name.fossil] |
| 19 | 18 | fossil new --admin-user alice --date-override "2025-01-01 00:00:00" $nameRepo |
| 20 | 19 | fossil open $nameRepo |
| 21 | 20 | fossil user default alice |
| @@ -469,13 +468,11 @@ | ||
| 469 | 468 | tag-not-date {trunk:2025} {} - \ |
| 470 | 469 | tag-colon-only {:} {} - \ |
| 471 | 470 | tag-two-colons {::} {} - \ |
| 472 | 471 | ] { |
| 473 | 472 | if {$nameWant eq "-"} { set nameWant $nameNoDate$nameName } |
| 474 | - test_eq name-date-$nameCase [name_id $nameName $nameType] $nameWant \ | |
| 475 | - [sanitizer_trunk_mark $nameCase \ | |
| 476 | - {compact-zulu-day compact-zulu-min compact-zulu-sec}] | |
| 473 | + test_eq name-date-$nameCase [name_id $nameName $nameType] $nameWant | |
| 477 | 474 | } |
| 478 | 475 | |
| 479 | 476 | ############################################################################### |
| 480 | 477 | # Hashes and their beginnings, tags that look like hashes, record |
| 481 | 478 | # numbers, and names with punctuation after them. |
| @@ -880,16 +877,15 @@ | ||
| 880 | 877 | } |
| 881 | 878 | return [fossil_http $nameWeb [request_get $path] {*}$options] |
| 882 | 879 | } |
| 883 | 880 | |
| 884 | 881 | # Test NAME passes if the reply to a request for PATH holds every string |
| 885 | -# in WANTED and none of those that begin with "!". CONSTRAINTS is given | |
| 886 | -# to the test. | |
| 882 | +# in WANTED and none of those that begin with "!". | |
| 887 | 883 | # |
| 888 | -proc name_page {name path wanted {caps gjorz} {constraints ""}} { | |
| 884 | +proc name_page {name path wanted {caps gjorz}} { | |
| 889 | 885 | set reply [name_get $path $caps] |
| 890 | - test_eq name-page-$name [name_missing $reply $wanted] {} $constraints | |
| 886 | + test_eq name-page-$name [name_missing $reply $wanted] {} | |
| 891 | 887 | } |
| 892 | 888 | |
| 893 | 889 | set nameHref {<a href="/info/} |
| 894 | 890 | |
| 895 | 891 | # A name that could mean more than one thing gets the page that lists |
| @@ -910,11 +906,11 @@ | ||
| 910 | 906 | $nameC3] admin |
| 911 | 907 | name_page info-prefix /info/[string range $nameC1 0 9] [list \ |
| 912 | 908 | "!is ambiguous" "HTTP/1.0 200 OK" $nameC1] admin |
| 913 | 909 | name_page info-date /info/date:2025-01-03 [list "HTTP/1.0 200 OK" $nameC2] admin |
| 914 | 910 | name_page info-date-zulu /info/date:20250103Z [list "HTTP/1.0 200 OK" \ |
| 915 | - $nameC2] admin [sanitizer_trunk_mark] | |
| 911 | + $nameC2] admin | |
| 916 | 912 | name_page info-escape /info/re%6c1 [list "HTTP/1.0 200 OK" $nameC1] admin |
| 917 | 913 | name_page info-percent /info/% [list "No such object: %"] |
| 918 | 914 | name_page info-bad-escape /info/%zz [list "No such object: "] |
| 919 | 915 | name_page info-nul /info/rel1%00x [list "HTTP/1.0 200 OK" $nameC1] admin |
| 920 | 916 | name_page info-long /info/[string repeat a 5000] [list "No such object: aaaa"] |
| @@ -980,12 +976,11 @@ | ||
| 980 | 976 | name_page timeline-number-after "/timeline?a=202501041000Z&n=2" [list \ |
| 981 | 977 | "occurring on or after 2025-01-04 10:00Z." b1 c3] admin |
| 982 | 978 | name_page timeline-number-after-z "/timeline?a=20250104100000z&n=1" [list \ |
| 983 | 979 | "occurring on or after 2025-01-04 10:00:00Z." b1 "!>c3<"] admin |
| 984 | 980 | name_page timeline-number-zulu-day "/timeline?a=20250104Z&n=1" [list \ |
| 985 | - "HTTP/1.0 200 OK" "occurring on or after 20250104Z." b1 "!>c3<"] admin \ | |
| 986 | - [sanitizer_trunk_mark] | |
| 981 | + "HTTP/1.0 200 OK" "occurring on or after 20250104Z." b1 "!>c3<"] admin | |
| 987 | 982 | name_page timeline-number-is-hash /timeline?c=20250105 [list \ |
| 988 | 983 | "HTTP/1.0 200 OK" "!occurring around 2025-01-05"] admin |
| 989 | 984 | name_page timeline-tag /timeline?c=rel1&n=1 [list \ |
| 990 | 985 | "occurring around rel1." c1] admin |
| 991 | 986 | name_page timeline-technote "/timeline?c=[string range $nameEid 0 7]&n=1" \ |
| @@ -1007,11 +1002,11 @@ | ||
| 1007 | 1002 | "descendants of" ">br</a>"] admin |
| 1008 | 1003 | name_page timeline-forward-to-tag /timeline?d=rel1&ft=tag:br [list \ |
| 1009 | 1004 | "HTTP/1.0 200 OK" "descendants of" ">tag:br</a>"] admin |
| 1010 | 1005 | name_page timeline-forward-to-hash \ |
| 1011 | 1006 | "/timeline?d=rel1&ft=[string range $nameB1 0 9]" [list "HTTP/1.0 200 OK" \ |
| 1012 | - "descendants of" ">[string range $nameB1 0 9]</a>"] admin $::trunkMark | |
| 1007 | + "descendants of" ">[string range $nameB1 0 9]</a>"] admin | |
| 1013 | 1008 | name_page timeline-forward-to-none /timeline?d=rel1&ft=nosuch [list \ |
| 1014 | 1009 | "HTTP/1.0 200 OK" "descendants of" "!cannot resolve"] admin |
| 1015 | 1010 | |
| 1016 | 1011 | # A page that is given no name at all. |
| 1017 | 1012 | name_page forum-edit-no-name /forumedit [list \ |
| @@ -1231,31 +1226,28 @@ | ||
| 1231 | 1226 | "<tr><td>5<td>211<td>" "!collisions of length 4:" \ |
| 1232 | 1227 | "<p>Collisions of length 4:\n<a href=\"/ambiguous/$nameCtwin\">"] admin |
| 1233 | 1228 | |
| 1234 | 1229 | # A user with no capabilities is not shown the names of artifacts. |
| 1235 | 1230 | set nameReply [name_get /ambiguous/[string range $nameP 0 0] {}] |
| 1236 | -test name-page-ambiguous-no-read {![string match *$nameP* $nameReply]} \ | |
| 1237 | - $::trunkMark | |
| 1231 | +test name-page-ambiguous-no-read {![string match *$nameP* $nameReply]} | |
| 1238 | 1232 | |
| 1239 | 1233 | ############################################################################### |
| 1240 | 1234 | # Known faults. |
| 1241 | 1235 | |
| 1242 | 1236 | # A request for more of the most recent artifacts than there are shows |
| 1243 | 1237 | # them all, and a request for fewer shows as many as asked for. |
| 1244 | 1238 | test name-page-bloblist-recent-all {[string match \ |
| 1245 | - {*<tr><td align="right">1</td>*} [name_get /bloblist?recent&n=600 admin]]} \ | |
| 1246 | - $::trunkMark | |
| 1239 | + {*<tr><td align="right">1</td>*} [name_get /bloblist?recent&n=600 admin]]} | |
| 1247 | 1240 | test name-page-bloblist-recent-count {[regexp -all {<tr><td align="right">} \ |
| 1248 | - [name_get /bloblist?recent&n=250 admin]] == 250} $::trunkMark | |
| 1241 | + [name_get /bloblist?recent&n=250 admin]] == 250} | |
| 1249 | 1242 | |
| 1250 | 1243 | # The list of tags has a quoted key in JSON. |
| 1251 | 1244 | fossil whatis --json tip |
| 1252 | -test name-whatis-json-tags-key {[string match {*,"tags":\["br"\],*} $RESULT]} \ | |
| 1253 | - $::trunkMark | |
| 1245 | +test name-whatis-json-tags-key {[string match {*,"tags":\["br"\],*} $RESULT]} | |
| 1254 | 1246 | |
| 1255 | 1247 | # The second meaning of a name is numbered 2 when it is a ticket. |
| 1256 | 1248 | fossil whatis [string range $nameC1 0 5] |
| 1257 | 1249 | test name-whatis-ticket-meaning-number \ |
| 1258 | - {[string match "*---- meaning #2 ----*" $RESULT]} $::trunkMark | |
| 1250 | + {[string match "*---- meaning #2 ----*" $RESULT]} | |
| 1259 | 1251 | |
| 1260 | 1252 | ############################################################################### |
| 1261 | 1253 | test_cleanup |
| 1262 | 1254 |
| --- test/name.test | |
| +++ test/name.test | |
| @@ -11,11 +11,10 @@ | |
| 11 | # The first sections run at every level, and the rest need |
| 12 | # -assurance stress. |
| 13 | require_no_open_checkout |
| 14 | |
| 15 | test_setup "" |
| 16 | source [file join $::testfiledir trunk-fixes.tcl] |
| 17 | |
| 18 | set nameRepo [file join [pwd] name.fossil] |
| 19 | fossil new --admin-user alice --date-override "2025-01-01 00:00:00" $nameRepo |
| 20 | fossil open $nameRepo |
| 21 | fossil user default alice |
| @@ -469,13 +468,11 @@ | |
| 469 | tag-not-date {trunk:2025} {} - \ |
| 470 | tag-colon-only {:} {} - \ |
| 471 | tag-two-colons {::} {} - \ |
| 472 | ] { |
| 473 | if {$nameWant eq "-"} { set nameWant $nameNoDate$nameName } |
| 474 | test_eq name-date-$nameCase [name_id $nameName $nameType] $nameWant \ |
| 475 | [sanitizer_trunk_mark $nameCase \ |
| 476 | {compact-zulu-day compact-zulu-min compact-zulu-sec}] |
| 477 | } |
| 478 | |
| 479 | ############################################################################### |
| 480 | # Hashes and their beginnings, tags that look like hashes, record |
| 481 | # numbers, and names with punctuation after them. |
| @@ -880,16 +877,15 @@ | |
| 880 | } |
| 881 | return [fossil_http $nameWeb [request_get $path] {*}$options] |
| 882 | } |
| 883 | |
| 884 | # Test NAME passes if the reply to a request for PATH holds every string |
| 885 | # in WANTED and none of those that begin with "!". CONSTRAINTS is given |
| 886 | # to the test. |
| 887 | # |
| 888 | proc name_page {name path wanted {caps gjorz} {constraints ""}} { |
| 889 | set reply [name_get $path $caps] |
| 890 | test_eq name-page-$name [name_missing $reply $wanted] {} $constraints |
| 891 | } |
| 892 | |
| 893 | set nameHref {<a href="/info/} |
| 894 | |
| 895 | # A name that could mean more than one thing gets the page that lists |
| @@ -910,11 +906,11 @@ | |
| 910 | $nameC3] admin |
| 911 | name_page info-prefix /info/[string range $nameC1 0 9] [list \ |
| 912 | "!is ambiguous" "HTTP/1.0 200 OK" $nameC1] admin |
| 913 | name_page info-date /info/date:2025-01-03 [list "HTTP/1.0 200 OK" $nameC2] admin |
| 914 | name_page info-date-zulu /info/date:20250103Z [list "HTTP/1.0 200 OK" \ |
| 915 | $nameC2] admin [sanitizer_trunk_mark] |
| 916 | name_page info-escape /info/re%6c1 [list "HTTP/1.0 200 OK" $nameC1] admin |
| 917 | name_page info-percent /info/% [list "No such object: %"] |
| 918 | name_page info-bad-escape /info/%zz [list "No such object: "] |
| 919 | name_page info-nul /info/rel1%00x [list "HTTP/1.0 200 OK" $nameC1] admin |
| 920 | name_page info-long /info/[string repeat a 5000] [list "No such object: aaaa"] |
| @@ -980,12 +976,11 @@ | |
| 980 | name_page timeline-number-after "/timeline?a=202501041000Z&n=2" [list \ |
| 981 | "occurring on or after 2025-01-04 10:00Z." b1 c3] admin |
| 982 | name_page timeline-number-after-z "/timeline?a=20250104100000z&n=1" [list \ |
| 983 | "occurring on or after 2025-01-04 10:00:00Z." b1 "!>c3<"] admin |
| 984 | name_page timeline-number-zulu-day "/timeline?a=20250104Z&n=1" [list \ |
| 985 | "HTTP/1.0 200 OK" "occurring on or after 20250104Z." b1 "!>c3<"] admin \ |
| 986 | [sanitizer_trunk_mark] |
| 987 | name_page timeline-number-is-hash /timeline?c=20250105 [list \ |
| 988 | "HTTP/1.0 200 OK" "!occurring around 2025-01-05"] admin |
| 989 | name_page timeline-tag /timeline?c=rel1&n=1 [list \ |
| 990 | "occurring around rel1." c1] admin |
| 991 | name_page timeline-technote "/timeline?c=[string range $nameEid 0 7]&n=1" \ |
| @@ -1007,11 +1002,11 @@ | |
| 1007 | "descendants of" ">br</a>"] admin |
| 1008 | name_page timeline-forward-to-tag /timeline?d=rel1&ft=tag:br [list \ |
| 1009 | "HTTP/1.0 200 OK" "descendants of" ">tag:br</a>"] admin |
| 1010 | name_page timeline-forward-to-hash \ |
| 1011 | "/timeline?d=rel1&ft=[string range $nameB1 0 9]" [list "HTTP/1.0 200 OK" \ |
| 1012 | "descendants of" ">[string range $nameB1 0 9]</a>"] admin $::trunkMark |
| 1013 | name_page timeline-forward-to-none /timeline?d=rel1&ft=nosuch [list \ |
| 1014 | "HTTP/1.0 200 OK" "descendants of" "!cannot resolve"] admin |
| 1015 | |
| 1016 | # A page that is given no name at all. |
| 1017 | name_page forum-edit-no-name /forumedit [list \ |
| @@ -1231,31 +1226,28 @@ | |
| 1231 | "<tr><td>5<td>211<td>" "!collisions of length 4:" \ |
| 1232 | "<p>Collisions of length 4:\n<a href=\"/ambiguous/$nameCtwin\">"] admin |
| 1233 | |
| 1234 | # A user with no capabilities is not shown the names of artifacts. |
| 1235 | set nameReply [name_get /ambiguous/[string range $nameP 0 0] {}] |
| 1236 | test name-page-ambiguous-no-read {![string match *$nameP* $nameReply]} \ |
| 1237 | $::trunkMark |
| 1238 | |
| 1239 | ############################################################################### |
| 1240 | # Known faults. |
| 1241 | |
| 1242 | # A request for more of the most recent artifacts than there are shows |
| 1243 | # them all, and a request for fewer shows as many as asked for. |
| 1244 | test name-page-bloblist-recent-all {[string match \ |
| 1245 | {*<tr><td align="right">1</td>*} [name_get /bloblist?recent&n=600 admin]]} \ |
| 1246 | $::trunkMark |
| 1247 | test name-page-bloblist-recent-count {[regexp -all {<tr><td align="right">} \ |
| 1248 | [name_get /bloblist?recent&n=250 admin]] == 250} $::trunkMark |
| 1249 | |
| 1250 | # The list of tags has a quoted key in JSON. |
| 1251 | fossil whatis --json tip |
| 1252 | test name-whatis-json-tags-key {[string match {*,"tags":\["br"\],*} $RESULT]} \ |
| 1253 | $::trunkMark |
| 1254 | |
| 1255 | # The second meaning of a name is numbered 2 when it is a ticket. |
| 1256 | fossil whatis [string range $nameC1 0 5] |
| 1257 | test name-whatis-ticket-meaning-number \ |
| 1258 | {[string match "*---- meaning #2 ----*" $RESULT]} $::trunkMark |
| 1259 | |
| 1260 | ############################################################################### |
| 1261 | test_cleanup |
| 1262 |
| --- test/name.test | |
| +++ test/name.test | |
| @@ -11,11 +11,10 @@ | |
| 11 | # The first sections run at every level, and the rest need |
| 12 | # -assurance stress. |
| 13 | require_no_open_checkout |
| 14 | |
| 15 | test_setup "" |
| 16 | |
| 17 | set nameRepo [file join [pwd] name.fossil] |
| 18 | fossil new --admin-user alice --date-override "2025-01-01 00:00:00" $nameRepo |
| 19 | fossil open $nameRepo |
| 20 | fossil user default alice |
| @@ -469,13 +468,11 @@ | |
| 468 | tag-not-date {trunk:2025} {} - \ |
| 469 | tag-colon-only {:} {} - \ |
| 470 | tag-two-colons {::} {} - \ |
| 471 | ] { |
| 472 | if {$nameWant eq "-"} { set nameWant $nameNoDate$nameName } |
| 473 | test_eq name-date-$nameCase [name_id $nameName $nameType] $nameWant |
| 474 | } |
| 475 | |
| 476 | ############################################################################### |
| 477 | # Hashes and their beginnings, tags that look like hashes, record |
| 478 | # numbers, and names with punctuation after them. |
| @@ -880,16 +877,15 @@ | |
| 877 | } |
| 878 | return [fossil_http $nameWeb [request_get $path] {*}$options] |
| 879 | } |
| 880 | |
| 881 | # Test NAME passes if the reply to a request for PATH holds every string |
| 882 | # in WANTED and none of those that begin with "!". |
| 883 | # |
| 884 | proc name_page {name path wanted {caps gjorz}} { |
| 885 | set reply [name_get $path $caps] |
| 886 | test_eq name-page-$name [name_missing $reply $wanted] {} |
| 887 | } |
| 888 | |
| 889 | set nameHref {<a href="/info/} |
| 890 | |
| 891 | # A name that could mean more than one thing gets the page that lists |
| @@ -910,11 +906,11 @@ | |
| 906 | $nameC3] admin |
| 907 | name_page info-prefix /info/[string range $nameC1 0 9] [list \ |
| 908 | "!is ambiguous" "HTTP/1.0 200 OK" $nameC1] admin |
| 909 | name_page info-date /info/date:2025-01-03 [list "HTTP/1.0 200 OK" $nameC2] admin |
| 910 | name_page info-date-zulu /info/date:20250103Z [list "HTTP/1.0 200 OK" \ |
| 911 | $nameC2] admin |
| 912 | name_page info-escape /info/re%6c1 [list "HTTP/1.0 200 OK" $nameC1] admin |
| 913 | name_page info-percent /info/% [list "No such object: %"] |
| 914 | name_page info-bad-escape /info/%zz [list "No such object: "] |
| 915 | name_page info-nul /info/rel1%00x [list "HTTP/1.0 200 OK" $nameC1] admin |
| 916 | name_page info-long /info/[string repeat a 5000] [list "No such object: aaaa"] |
| @@ -980,12 +976,11 @@ | |
| 976 | name_page timeline-number-after "/timeline?a=202501041000Z&n=2" [list \ |
| 977 | "occurring on or after 2025-01-04 10:00Z." b1 c3] admin |
| 978 | name_page timeline-number-after-z "/timeline?a=20250104100000z&n=1" [list \ |
| 979 | "occurring on or after 2025-01-04 10:00:00Z." b1 "!>c3<"] admin |
| 980 | name_page timeline-number-zulu-day "/timeline?a=20250104Z&n=1" [list \ |
| 981 | "HTTP/1.0 200 OK" "occurring on or after 20250104Z." b1 "!>c3<"] admin |
| 982 | name_page timeline-number-is-hash /timeline?c=20250105 [list \ |
| 983 | "HTTP/1.0 200 OK" "!occurring around 2025-01-05"] admin |
| 984 | name_page timeline-tag /timeline?c=rel1&n=1 [list \ |
| 985 | "occurring around rel1." c1] admin |
| 986 | name_page timeline-technote "/timeline?c=[string range $nameEid 0 7]&n=1" \ |
| @@ -1007,11 +1002,11 @@ | |
| 1002 | "descendants of" ">br</a>"] admin |
| 1003 | name_page timeline-forward-to-tag /timeline?d=rel1&ft=tag:br [list \ |
| 1004 | "HTTP/1.0 200 OK" "descendants of" ">tag:br</a>"] admin |
| 1005 | name_page timeline-forward-to-hash \ |
| 1006 | "/timeline?d=rel1&ft=[string range $nameB1 0 9]" [list "HTTP/1.0 200 OK" \ |
| 1007 | "descendants of" ">[string range $nameB1 0 9]</a>"] admin |
| 1008 | name_page timeline-forward-to-none /timeline?d=rel1&ft=nosuch [list \ |
| 1009 | "HTTP/1.0 200 OK" "descendants of" "!cannot resolve"] admin |
| 1010 | |
| 1011 | # A page that is given no name at all. |
| 1012 | name_page forum-edit-no-name /forumedit [list \ |
| @@ -1231,31 +1226,28 @@ | |
| 1226 | "<tr><td>5<td>211<td>" "!collisions of length 4:" \ |
| 1227 | "<p>Collisions of length 4:\n<a href=\"/ambiguous/$nameCtwin\">"] admin |
| 1228 | |
| 1229 | # A user with no capabilities is not shown the names of artifacts. |
| 1230 | set nameReply [name_get /ambiguous/[string range $nameP 0 0] {}] |
| 1231 | test name-page-ambiguous-no-read {![string match *$nameP* $nameReply]} |
| 1232 | |
| 1233 | ############################################################################### |
| 1234 | # Known faults. |
| 1235 | |
| 1236 | # A request for more of the most recent artifacts than there are shows |
| 1237 | # them all, and a request for fewer shows as many as asked for. |
| 1238 | test name-page-bloblist-recent-all {[string match \ |
| 1239 | {*<tr><td align="right">1</td>*} [name_get /bloblist?recent&n=600 admin]]} |
| 1240 | test name-page-bloblist-recent-count {[regexp -all {<tr><td align="right">} \ |
| 1241 | [name_get /bloblist?recent&n=250 admin]] == 250} |
| 1242 | |
| 1243 | # The list of tags has a quoted key in JSON. |
| 1244 | fossil whatis --json tip |
| 1245 | test name-whatis-json-tags-key {[string match {*,"tags":\["br"\],*} $RESULT]} |
| 1246 | |
| 1247 | # The second meaning of a name is numbered 2 when it is a ticket. |
| 1248 | fossil whatis [string range $nameC1 0 5] |
| 1249 | test name-whatis-ticket-meaning-number \ |
| 1250 | {[string match "*---- meaning #2 ----*" $RESULT]} |
| 1251 | |
| 1252 | ############################################################################### |
| 1253 | test_cleanup |
| 1254 |
+1
-3
| --- test/purge.test | ||
| +++ test/purge.test | ||
| @@ -8,11 +8,10 @@ | ||
| 8 | 8 | # The first sections run at every level, and the rest need |
| 9 | 9 | # -assurance stress. |
| 10 | 10 | require_no_open_checkout |
| 11 | 11 | |
| 12 | 12 | test_setup |
| 13 | -source [file join $::testfiledir trunk-fixes.tcl] | |
| 14 | 13 | |
| 15 | 14 | proc purge_sql {sql {repo .rep.fossil}} { |
| 16 | 15 | return [fossil_sql $sql $repo] |
| 17 | 16 | } |
| 18 | 17 | |
| @@ -427,12 +426,11 @@ | ||
| 427 | 426 | file copy -force p8.fossil damaged.fossil |
| 428 | 427 | fossil sql -R damaged.fossil $purgeDamage |
| 429 | 428 | set purgeBefore [repository_state damaged.fossil] |
| 430 | 429 | fossil_raw purge {*}$purgeArgs -R damaged.fossil |
| 431 | 430 | test purge-damage-$purgeName {$CODE == 1 && |
| 432 | - [string match $purgeMessage $RESULT]} \ | |
| 433 | - [trunk_mark $purgeName cat-source-loop] | |
| 431 | + [string match $purgeMessage $RESULT]} | |
| 434 | 432 | test_eq purge-damage-$purgeName-no-change [repository_state damaged.fossil] \ |
| 435 | 433 | $purgeBefore |
| 436 | 434 | test_eq purge-damage-$purgeName-event-kept \ |
| 437 | 435 | [purge_last_event damaged.fossil] $purgeEvent8 |
| 438 | 436 | } |
| 439 | 437 |
| --- test/purge.test | |
| +++ test/purge.test | |
| @@ -8,11 +8,10 @@ | |
| 8 | # The first sections run at every level, and the rest need |
| 9 | # -assurance stress. |
| 10 | require_no_open_checkout |
| 11 | |
| 12 | test_setup |
| 13 | source [file join $::testfiledir trunk-fixes.tcl] |
| 14 | |
| 15 | proc purge_sql {sql {repo .rep.fossil}} { |
| 16 | return [fossil_sql $sql $repo] |
| 17 | } |
| 18 | |
| @@ -427,12 +426,11 @@ | |
| 427 | file copy -force p8.fossil damaged.fossil |
| 428 | fossil sql -R damaged.fossil $purgeDamage |
| 429 | set purgeBefore [repository_state damaged.fossil] |
| 430 | fossil_raw purge {*}$purgeArgs -R damaged.fossil |
| 431 | test purge-damage-$purgeName {$CODE == 1 && |
| 432 | [string match $purgeMessage $RESULT]} \ |
| 433 | [trunk_mark $purgeName cat-source-loop] |
| 434 | test_eq purge-damage-$purgeName-no-change [repository_state damaged.fossil] \ |
| 435 | $purgeBefore |
| 436 | test_eq purge-damage-$purgeName-event-kept \ |
| 437 | [purge_last_event damaged.fossil] $purgeEvent8 |
| 438 | } |
| 439 |
| --- test/purge.test | |
| +++ test/purge.test | |
| @@ -8,11 +8,10 @@ | |
| 8 | # The first sections run at every level, and the rest need |
| 9 | # -assurance stress. |
| 10 | require_no_open_checkout |
| 11 | |
| 12 | test_setup |
| 13 | |
| 14 | proc purge_sql {sql {repo .rep.fossil}} { |
| 15 | return [fossil_sql $sql $repo] |
| 16 | } |
| 17 | |
| @@ -427,12 +426,11 @@ | |
| 426 | file copy -force p8.fossil damaged.fossil |
| 427 | fossil sql -R damaged.fossil $purgeDamage |
| 428 | set purgeBefore [repository_state damaged.fossil] |
| 429 | fossil_raw purge {*}$purgeArgs -R damaged.fossil |
| 430 | test purge-damage-$purgeName {$CODE == 1 && |
| 431 | [string match $purgeMessage $RESULT]} |
| 432 | test_eq purge-damage-$purgeName-no-change [repository_state damaged.fossil] \ |
| 433 | $purgeBefore |
| 434 | test_eq purge-damage-$purgeName-event-kept \ |
| 435 | [purge_last_event damaged.fossil] $purgeEvent8 |
| 436 | } |
| 437 |
+5
-9
| --- test/rebuild.test | ||
| +++ test/rebuild.test | ||
| @@ -10,11 +10,10 @@ | ||
| 10 | 10 | # The first sections run at every level, and the rest need |
| 11 | 11 | # -assurance stress. |
| 12 | 12 | require_no_open_checkout |
| 13 | 13 | |
| 14 | 14 | test_setup |
| 15 | -source [file join $::testfiledir trunk-fixes.tcl] | |
| 16 | 15 | |
| 17 | 16 | proc rebuild_sql {sql {repo .rep.fossil}} { |
| 18 | 17 | return [fossil_sql $sql $repo] |
| 19 | 18 | } |
| 20 | 19 | |
| @@ -418,13 +417,13 @@ | ||
| 418 | 417 | test rebuild-index-search {[string match "*rebuild-side-1*" $RESULT]} |
| 419 | 418 | # --compress-only with --index, when there is an index already, builds it |
| 420 | 419 | # again. |
| 421 | 420 | fossil sql -R fts.fossil "DELETE FROM ftsdocs" |
| 422 | 421 | fossil rebuild fts.fossil --compress-only --index |
| 423 | -test rebuild-index-compress-only-index {$CODE == 0} $::trunkMark | |
| 422 | +test rebuild-index-compress-only-index {$CODE == 0} | |
| 424 | 423 | test_eq rebuild-index-compress-only-index-filled \ |
| 425 | - [rebuild_indexed fts.fossil] $rebuildDocs $::trunkMark | |
| 424 | + [rebuild_indexed fts.fossil] $rebuildDocs | |
| 426 | 425 | fossil rebuild fts.fossil --noindex |
| 427 | 426 | test rebuild-noindex {$CODE == 0} |
| 428 | 427 | test_eq rebuild-noindex-gone [rebuild_indexed fts.fossil] none |
| 429 | 428 | test_eq rebuild-index-state \ |
| 430 | 429 | [repository_state_diff $rebuildStart [repository_state fts.fossil]] "" |
| @@ -582,14 +581,11 @@ | ||
| 582 | 581 | WHERE rid=1" r-keep.fossil] $rebuildFirst |
| 583 | 582 | test_eq rebuild-reconstruct-keep-private \ |
| 584 | 583 | [rebuild_hashes r-keep.fossil "rid IN private"] $rebuildPrivate |
| 585 | 584 | test_eq rebuild-reconstruct-keep-state \ |
| 586 | 585 | [repository_state_diff $rebuildStart [repository_state r-keep.fossil]] "" |
| 587 | -fossil test-integrity -R r-keep.fossil | |
| 588 | -test rebuild-reconstruct-keep-integrity {$CODE == 0} $::trunkMark | |
| 589 | -fossil test-missing -R r-keep.fossil | |
| 590 | -test rebuild-reconstruct-keep-missing {$CODE == 0} | |
| 586 | +repository_sound rebuild-reconstruct-keep r-keep.fossil | |
| 591 | 587 | |
| 592 | 588 | # Without -P every artifact in the directory becomes public. |
| 593 | 589 | fossil reconstruct r-private.fossil d-private |
| 594 | 590 | test rebuild-reconstruct-private {$CODE == 0} |
| 595 | 591 | test_eq rebuild-reconstruct-private-all [rebuild_hashes r-private.fossil] \ |
| @@ -639,13 +635,13 @@ | ||
| 639 | 635 | |
| 640 | 636 | # A destination that is a file is refused, and the file is kept. |
| 641 | 637 | write_file d-file.txt "a file, not a directory\n" |
| 642 | 638 | fossil deconstruct -R full.fossil d-file.txt -expectError |
| 643 | 639 | test rebuild-deconstruct-file-destination {$CODE != 0 && |
| 644 | - [string match "*is not a directory*" $RESULT]} $::trunkMark | |
| 640 | + [string match "*is not a directory*" $RESULT]} | |
| 645 | 641 | test rebuild-deconstruct-file-destination-kept \ |
| 646 | - {[file isfile d-file.txt]} $::trunkMark | |
| 642 | + {[file isfile d-file.txt]} | |
| 647 | 643 | |
| 648 | 644 | # A destination that cannot be written to, where the system can make one. |
| 649 | 645 | catch {file attributes d-none -permissions 0555} |
| 650 | 646 | if {![file writable d-none]} { |
| 651 | 647 | fossil deconstruct -R full.fossil d-none -expectError |
| 652 | 648 |
| --- test/rebuild.test | |
| +++ test/rebuild.test | |
| @@ -10,11 +10,10 @@ | |
| 10 | # The first sections run at every level, and the rest need |
| 11 | # -assurance stress. |
| 12 | require_no_open_checkout |
| 13 | |
| 14 | test_setup |
| 15 | source [file join $::testfiledir trunk-fixes.tcl] |
| 16 | |
| 17 | proc rebuild_sql {sql {repo .rep.fossil}} { |
| 18 | return [fossil_sql $sql $repo] |
| 19 | } |
| 20 | |
| @@ -418,13 +417,13 @@ | |
| 418 | test rebuild-index-search {[string match "*rebuild-side-1*" $RESULT]} |
| 419 | # --compress-only with --index, when there is an index already, builds it |
| 420 | # again. |
| 421 | fossil sql -R fts.fossil "DELETE FROM ftsdocs" |
| 422 | fossil rebuild fts.fossil --compress-only --index |
| 423 | test rebuild-index-compress-only-index {$CODE == 0} $::trunkMark |
| 424 | test_eq rebuild-index-compress-only-index-filled \ |
| 425 | [rebuild_indexed fts.fossil] $rebuildDocs $::trunkMark |
| 426 | fossil rebuild fts.fossil --noindex |
| 427 | test rebuild-noindex {$CODE == 0} |
| 428 | test_eq rebuild-noindex-gone [rebuild_indexed fts.fossil] none |
| 429 | test_eq rebuild-index-state \ |
| 430 | [repository_state_diff $rebuildStart [repository_state fts.fossil]] "" |
| @@ -582,14 +581,11 @@ | |
| 582 | WHERE rid=1" r-keep.fossil] $rebuildFirst |
| 583 | test_eq rebuild-reconstruct-keep-private \ |
| 584 | [rebuild_hashes r-keep.fossil "rid IN private"] $rebuildPrivate |
| 585 | test_eq rebuild-reconstruct-keep-state \ |
| 586 | [repository_state_diff $rebuildStart [repository_state r-keep.fossil]] "" |
| 587 | fossil test-integrity -R r-keep.fossil |
| 588 | test rebuild-reconstruct-keep-integrity {$CODE == 0} $::trunkMark |
| 589 | fossil test-missing -R r-keep.fossil |
| 590 | test rebuild-reconstruct-keep-missing {$CODE == 0} |
| 591 | |
| 592 | # Without -P every artifact in the directory becomes public. |
| 593 | fossil reconstruct r-private.fossil d-private |
| 594 | test rebuild-reconstruct-private {$CODE == 0} |
| 595 | test_eq rebuild-reconstruct-private-all [rebuild_hashes r-private.fossil] \ |
| @@ -639,13 +635,13 @@ | |
| 639 | |
| 640 | # A destination that is a file is refused, and the file is kept. |
| 641 | write_file d-file.txt "a file, not a directory\n" |
| 642 | fossil deconstruct -R full.fossil d-file.txt -expectError |
| 643 | test rebuild-deconstruct-file-destination {$CODE != 0 && |
| 644 | [string match "*is not a directory*" $RESULT]} $::trunkMark |
| 645 | test rebuild-deconstruct-file-destination-kept \ |
| 646 | {[file isfile d-file.txt]} $::trunkMark |
| 647 | |
| 648 | # A destination that cannot be written to, where the system can make one. |
| 649 | catch {file attributes d-none -permissions 0555} |
| 650 | if {![file writable d-none]} { |
| 651 | fossil deconstruct -R full.fossil d-none -expectError |
| 652 |
| --- test/rebuild.test | |
| +++ test/rebuild.test | |
| @@ -10,11 +10,10 @@ | |
| 10 | # The first sections run at every level, and the rest need |
| 11 | # -assurance stress. |
| 12 | require_no_open_checkout |
| 13 | |
| 14 | test_setup |
| 15 | |
| 16 | proc rebuild_sql {sql {repo .rep.fossil}} { |
| 17 | return [fossil_sql $sql $repo] |
| 18 | } |
| 19 | |
| @@ -418,13 +417,13 @@ | |
| 417 | test rebuild-index-search {[string match "*rebuild-side-1*" $RESULT]} |
| 418 | # --compress-only with --index, when there is an index already, builds it |
| 419 | # again. |
| 420 | fossil sql -R fts.fossil "DELETE FROM ftsdocs" |
| 421 | fossil rebuild fts.fossil --compress-only --index |
| 422 | test rebuild-index-compress-only-index {$CODE == 0} |
| 423 | test_eq rebuild-index-compress-only-index-filled \ |
| 424 | [rebuild_indexed fts.fossil] $rebuildDocs |
| 425 | fossil rebuild fts.fossil --noindex |
| 426 | test rebuild-noindex {$CODE == 0} |
| 427 | test_eq rebuild-noindex-gone [rebuild_indexed fts.fossil] none |
| 428 | test_eq rebuild-index-state \ |
| 429 | [repository_state_diff $rebuildStart [repository_state fts.fossil]] "" |
| @@ -582,14 +581,11 @@ | |
| 581 | WHERE rid=1" r-keep.fossil] $rebuildFirst |
| 582 | test_eq rebuild-reconstruct-keep-private \ |
| 583 | [rebuild_hashes r-keep.fossil "rid IN private"] $rebuildPrivate |
| 584 | test_eq rebuild-reconstruct-keep-state \ |
| 585 | [repository_state_diff $rebuildStart [repository_state r-keep.fossil]] "" |
| 586 | repository_sound rebuild-reconstruct-keep r-keep.fossil |
| 587 | |
| 588 | # Without -P every artifact in the directory becomes public. |
| 589 | fossil reconstruct r-private.fossil d-private |
| 590 | test rebuild-reconstruct-private {$CODE == 0} |
| 591 | test_eq rebuild-reconstruct-private-all [rebuild_hashes r-private.fossil] \ |
| @@ -639,13 +635,13 @@ | |
| 635 | |
| 636 | # A destination that is a file is refused, and the file is kept. |
| 637 | write_file d-file.txt "a file, not a directory\n" |
| 638 | fossil deconstruct -R full.fossil d-file.txt -expectError |
| 639 | test rebuild-deconstruct-file-destination {$CODE != 0 && |
| 640 | [string match "*is not a directory*" $RESULT]} |
| 641 | test rebuild-deconstruct-file-destination-kept \ |
| 642 | {[file isfile d-file.txt]} |
| 643 | |
| 644 | # A destination that cannot be written to, where the system can make one. |
| 645 | catch {file attributes d-none -permissions 0555} |
| 646 | if {![file writable d-none]} { |
| 647 | fossil deconstruct -R full.fossil d-none -expectError |
| 648 |
+4
-7
| --- test/regress.test | ||
| +++ test/regress.test | ||
| @@ -3,11 +3,10 @@ | ||
| 3 | 3 | # |
| 4 | 4 | |
| 5 | 5 | require_no_open_checkout |
| 6 | 6 | |
| 7 | 7 | test_setup |
| 8 | -source [file join $::testfiledir trunk-fixes.tcl] | |
| 9 | 8 | |
| 10 | 9 | write_file a.txt "a\n" |
| 11 | 10 | fossil add a.txt |
| 12 | 11 | fossil commit -m "regress-c1" |
| 13 | 12 | |
| @@ -198,11 +197,11 @@ | ||
| 198 | 197 | ############################################################################### |
| 199 | 198 | # A port number above 65535 in a URL is refused with an error. |
| 200 | 199 | |
| 201 | 200 | fossil remote http://example.invalid:99999999999/x -expectError |
| 202 | 201 | test regress-url-port-too-large {$CODE != 0 |
| 203 | - && [string match "*port number too large*" $RESULT]} $::trunkMark | |
| 202 | + && [string match "*port number too large*" $RESULT]} | |
| 204 | 203 | fossil remote http://example.invalid:65535/x |
| 205 | 204 | test regress-url-port-largest {$CODE == 0} |
| 206 | 205 | fossil remote off |
| 207 | 206 | |
| 208 | 207 | ############################################################################### |
| @@ -241,11 +240,11 @@ | ||
| 241 | 240 | fossil wiki create AttachPage wiki.txt |
| 242 | 241 | fossil attachment add AttachPage attach.txt |
| 243 | 242 | fossil clone .rep.fossil regress-attach-clone.fossil |
| 244 | 243 | fossil push regress-attach-clone.fossil --once |
| 245 | 244 | test regress-push-held-attachment {$CODE == 0 |
| 246 | - && ![string match "*UNIQUE constraint*" $RESULT]} $::trunkMark | |
| 245 | + && ![string match "*UNIQUE constraint*" $RESULT]} | |
| 247 | 246 | fossil sql -R regress-attach-clone.fossil \ |
| 248 | 247 | "SELECT count(*) FROM attachment WHERE target='AttachPage'" |
| 249 | 248 | test_eq regress-push-held-attachment-rows [string trim $RESULT] 1 |
| 250 | 249 | |
| 251 | 250 | ############################################################################### |
| @@ -254,12 +253,11 @@ | ||
| 254 | 253 | |
| 255 | 254 | foreach {regressName regressRobot} {unset {} list timelineX,diff all *} { |
| 256 | 255 | fossil settings robot-restrict $regressRobot |
| 257 | 256 | fossil_raw test-th-eval --open-config {styleHeader {Page Title}} |
| 258 | 257 | test regress-styleheader-cli-$regressName \ |
| 259 | - {$CODE == 0 && [string match "*<title>*: Page Title</title>*" $RESULT]} \ | |
| 260 | - $::trunkMark | |
| 258 | + {$CODE == 0 && [string match "*<title>*: Page Title</title>*" $RESULT]} | |
| 261 | 259 | } |
| 262 | 260 | fossil settings robot-restrict "" |
| 263 | 261 | |
| 264 | 262 | ############################################################################### |
| 265 | 263 | # A base URL given with --baseurl and no path, with or without a slash after |
| @@ -268,10 +266,9 @@ | ||
| 268 | 266 | |
| 269 | 267 | write_file baseurl-req.txt "GET /robots.txt HTTP/1.1\r\nHost: x\r\n\r\n" |
| 270 | 268 | foreach {regressName regressUrl} {bare https://x slash https://x/} { |
| 271 | 269 | fossil_raw http .rep.fossil --in baseurl-req.txt --baseurl $regressUrl |
| 272 | 270 | test regress-baseurl-no-path-$regressName \ |
| 273 | - {$CODE == 0 && [string match "HTTP/1.0 200*" $RESULT]} \ | |
| 274 | - [sanitizer_trunk_mark $regressName {bare slash}] | |
| 271 | + {$CODE == 0 && [string match "HTTP/1.0 200*" $RESULT]} | |
| 275 | 272 | } |
| 276 | 273 | |
| 277 | 274 | test_cleanup |
| 278 | 275 |
| --- test/regress.test | |
| +++ test/regress.test | |
| @@ -3,11 +3,10 @@ | |
| 3 | # |
| 4 | |
| 5 | require_no_open_checkout |
| 6 | |
| 7 | test_setup |
| 8 | source [file join $::testfiledir trunk-fixes.tcl] |
| 9 | |
| 10 | write_file a.txt "a\n" |
| 11 | fossil add a.txt |
| 12 | fossil commit -m "regress-c1" |
| 13 | |
| @@ -198,11 +197,11 @@ | |
| 198 | ############################################################################### |
| 199 | # A port number above 65535 in a URL is refused with an error. |
| 200 | |
| 201 | fossil remote http://example.invalid:99999999999/x -expectError |
| 202 | test regress-url-port-too-large {$CODE != 0 |
| 203 | && [string match "*port number too large*" $RESULT]} $::trunkMark |
| 204 | fossil remote http://example.invalid:65535/x |
| 205 | test regress-url-port-largest {$CODE == 0} |
| 206 | fossil remote off |
| 207 | |
| 208 | ############################################################################### |
| @@ -241,11 +240,11 @@ | |
| 241 | fossil wiki create AttachPage wiki.txt |
| 242 | fossil attachment add AttachPage attach.txt |
| 243 | fossil clone .rep.fossil regress-attach-clone.fossil |
| 244 | fossil push regress-attach-clone.fossil --once |
| 245 | test regress-push-held-attachment {$CODE == 0 |
| 246 | && ![string match "*UNIQUE constraint*" $RESULT]} $::trunkMark |
| 247 | fossil sql -R regress-attach-clone.fossil \ |
| 248 | "SELECT count(*) FROM attachment WHERE target='AttachPage'" |
| 249 | test_eq regress-push-held-attachment-rows [string trim $RESULT] 1 |
| 250 | |
| 251 | ############################################################################### |
| @@ -254,12 +253,11 @@ | |
| 254 | |
| 255 | foreach {regressName regressRobot} {unset {} list timelineX,diff all *} { |
| 256 | fossil settings robot-restrict $regressRobot |
| 257 | fossil_raw test-th-eval --open-config {styleHeader {Page Title}} |
| 258 | test regress-styleheader-cli-$regressName \ |
| 259 | {$CODE == 0 && [string match "*<title>*: Page Title</title>*" $RESULT]} \ |
| 260 | $::trunkMark |
| 261 | } |
| 262 | fossil settings robot-restrict "" |
| 263 | |
| 264 | ############################################################################### |
| 265 | # A base URL given with --baseurl and no path, with or without a slash after |
| @@ -268,10 +266,9 @@ | |
| 268 | |
| 269 | write_file baseurl-req.txt "GET /robots.txt HTTP/1.1\r\nHost: x\r\n\r\n" |
| 270 | foreach {regressName regressUrl} {bare https://x slash https://x/} { |
| 271 | fossil_raw http .rep.fossil --in baseurl-req.txt --baseurl $regressUrl |
| 272 | test regress-baseurl-no-path-$regressName \ |
| 273 | {$CODE == 0 && [string match "HTTP/1.0 200*" $RESULT]} \ |
| 274 | [sanitizer_trunk_mark $regressName {bare slash}] |
| 275 | } |
| 276 | |
| 277 | test_cleanup |
| 278 |
| --- test/regress.test | |
| +++ test/regress.test | |
| @@ -3,11 +3,10 @@ | |
| 3 | # |
| 4 | |
| 5 | require_no_open_checkout |
| 6 | |
| 7 | test_setup |
| 8 | |
| 9 | write_file a.txt "a\n" |
| 10 | fossil add a.txt |
| 11 | fossil commit -m "regress-c1" |
| 12 | |
| @@ -198,11 +197,11 @@ | |
| 197 | ############################################################################### |
| 198 | # A port number above 65535 in a URL is refused with an error. |
| 199 | |
| 200 | fossil remote http://example.invalid:99999999999/x -expectError |
| 201 | test regress-url-port-too-large {$CODE != 0 |
| 202 | && [string match "*port number too large*" $RESULT]} |
| 203 | fossil remote http://example.invalid:65535/x |
| 204 | test regress-url-port-largest {$CODE == 0} |
| 205 | fossil remote off |
| 206 | |
| 207 | ############################################################################### |
| @@ -241,11 +240,11 @@ | |
| 240 | fossil wiki create AttachPage wiki.txt |
| 241 | fossil attachment add AttachPage attach.txt |
| 242 | fossil clone .rep.fossil regress-attach-clone.fossil |
| 243 | fossil push regress-attach-clone.fossil --once |
| 244 | test regress-push-held-attachment {$CODE == 0 |
| 245 | && ![string match "*UNIQUE constraint*" $RESULT]} |
| 246 | fossil sql -R regress-attach-clone.fossil \ |
| 247 | "SELECT count(*) FROM attachment WHERE target='AttachPage'" |
| 248 | test_eq regress-push-held-attachment-rows [string trim $RESULT] 1 |
| 249 | |
| 250 | ############################################################################### |
| @@ -254,12 +253,11 @@ | |
| 253 | |
| 254 | foreach {regressName regressRobot} {unset {} list timelineX,diff all *} { |
| 255 | fossil settings robot-restrict $regressRobot |
| 256 | fossil_raw test-th-eval --open-config {styleHeader {Page Title}} |
| 257 | test regress-styleheader-cli-$regressName \ |
| 258 | {$CODE == 0 && [string match "*<title>*: Page Title</title>*" $RESULT]} |
| 259 | } |
| 260 | fossil settings robot-restrict "" |
| 261 | |
| 262 | ############################################################################### |
| 263 | # A base URL given with --baseurl and no path, with or without a slash after |
| @@ -268,10 +266,9 @@ | |
| 266 | |
| 267 | write_file baseurl-req.txt "GET /robots.txt HTTP/1.1\r\nHost: x\r\n\r\n" |
| 268 | foreach {regressName regressUrl} {bare https://x slash https://x/} { |
| 269 | fossil_raw http .rep.fossil --in baseurl-req.txt --baseurl $regressUrl |
| 270 | test regress-baseurl-no-path-$regressName \ |
| 271 | {$CODE == 0 && [string match "HTTP/1.0 200*" $RESULT]} |
| 272 | } |
| 273 | |
| 274 | test_cleanup |
| 275 |
-1
| --- test/ssh.test | ||
| +++ test/ssh.test | ||
| @@ -17,11 +17,10 @@ | ||
| 17 | 17 | if {$::tcl_platform(platform) eq "windows"} { |
| 18 | 18 | test_skip "the stand-in for ssh is a shell script" |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | test_setup |
| 22 | -source [file join $::testfiledir trunk-fixes.tcl] | |
| 23 | 22 | |
| 24 | 23 | set sshDir [file join [pwd] ssh-standin] |
| 25 | 24 | file mkdir $sshDir |
| 26 | 25 | set sshStub [test_standin log-args.sh [file join $sshDir ssh]] |
| 27 | 26 | set sshLog [file join [pwd] ssh-args.txt] |
| 28 | 27 |
| --- test/ssh.test | |
| +++ test/ssh.test | |
| @@ -17,11 +17,10 @@ | |
| 17 | if {$::tcl_platform(platform) eq "windows"} { |
| 18 | test_skip "the stand-in for ssh is a shell script" |
| 19 | } |
| 20 | |
| 21 | test_setup |
| 22 | source [file join $::testfiledir trunk-fixes.tcl] |
| 23 | |
| 24 | set sshDir [file join [pwd] ssh-standin] |
| 25 | file mkdir $sshDir |
| 26 | set sshStub [test_standin log-args.sh [file join $sshDir ssh]] |
| 27 | set sshLog [file join [pwd] ssh-args.txt] |
| 28 |
| --- test/ssh.test | |
| +++ test/ssh.test | |
| @@ -17,11 +17,10 @@ | |
| 17 | if {$::tcl_platform(platform) eq "windows"} { |
| 18 | test_skip "the stand-in for ssh is a shell script" |
| 19 | } |
| 20 | |
| 21 | test_setup |
| 22 | |
| 23 | set sshDir [file join [pwd] ssh-standin] |
| 24 | file mkdir $sshDir |
| 25 | set sshStub [test_standin log-args.sh [file join $sshDir ssh]] |
| 26 | set sshLog [file join [pwd] ssh-args.txt] |
| 27 |
+19
-26
| --- test/th1main.test | ||
| +++ test/th1main.test | ||
| @@ -6,11 +6,10 @@ | ||
| 6 | 6 | # |
| 7 | 7 | |
| 8 | 8 | # The first sections run at every level, and the rest need |
| 9 | 9 | # -assurance stress. |
| 10 | 10 | test_setup |
| 11 | -source [file join $::testfiledir trunk-fixes.tcl] | |
| 12 | 11 | |
| 13 | 12 | write_file a.txt "hello\n" |
| 14 | 13 | write_file f83.txt "line 83\n" |
| 15 | 14 | write_file f100.txt "line 100\n" |
| 16 | 15 | fossil add a.txt f83.txt f100.txt |
| @@ -43,16 +42,15 @@ | ||
| 43 | 42 | } |
| 44 | 43 | } |
| 45 | 44 | |
| 46 | 45 | # Run each row of TABLE: a test name, options for test-th-eval, a |
| 47 | 46 | # script, a mode and an expected value as th1main_check takes them. |
| 48 | -# CONSTRAINTS is given to every test of the table. | |
| 49 | 47 | # |
| 50 | -proc th1main_table {table {constraints ""}} { | |
| 48 | +proc th1main_table {table} { | |
| 51 | 49 | foreach {name opts script mode expected} $table { |
| 52 | 50 | set got [th1main_eval $script {*}$opts] |
| 53 | - th1main_check th1main-$name $got $mode $expected $constraints | |
| 51 | + th1main_check th1main-$name $got $mode $expected | |
| 54 | 52 | } |
| 55 | 53 | } |
| 56 | 54 | |
| 57 | 55 | ############################################################################### |
| 58 | 56 | # Every command refuses a call with too few or too many arguments. Each |
| @@ -167,12 +165,11 @@ | ||
| 167 | 165 | {http ?-asynchronous? ?--? url ?payload?} |
| 168 | 166 | capture-few {captureTh1} {captureTh1 STRING} |
| 169 | 167 | capture-many {captureTh1 a b} {captureTh1 STRING} |
| 170 | 168 | } { |
| 171 | 169 | test_eq th1main-args-$th1mainName [th1main_eval $th1mainCall] \ |
| 172 | - "TH_ERROR: wrong # args: should be \"$th1mainUsage\"" \ | |
| 173 | - [trunk_mark $th1mainName {randhex-many http-none http-three}] | |
| 170 | + "TH_ERROR: wrong # args: should be \"$th1mainUsage\"" | |
| 174 | 171 | } |
| 175 | 172 | |
| 176 | 173 | if {[test_assurance] ne "stress"} { |
| 177 | 174 | test_skip "the tests after the first sections need -assurance stress" |
| 178 | 175 | } |
| @@ -523,14 +520,14 @@ | ||
| 523 | 520 | # Unversioned files. |
| 524 | 521 | |
| 525 | 522 | # In a repository that has never held an unversioned file, "unversioned |
| 526 | 523 | # list" gives an empty list and "unversioned content" a script error. |
| 527 | 524 | set th1mainGot [th1main_eval {unversioned list}] |
| 528 | -test th1main-uv-list-none {$CODE == 0 && $th1mainGot eq ""} $::trunkMark | |
| 525 | +test th1main-uv-list-none {$CODE == 0 && $th1mainGot eq ""} | |
| 529 | 526 | set th1mainGot [th1main_eval {unversioned content nosuch}] |
| 530 | 527 | test th1main-uv-content-none \ |
| 531 | - {$CODE == 0 && [string match "TH_ERROR:*" $th1mainGot]} $::trunkMark | |
| 528 | + {$CODE == 0 && [string match "TH_ERROR:*" $th1mainGot]} | |
| 532 | 529 | |
| 533 | 530 | write_file u.txt "data\n" |
| 534 | 531 | write_file v.txt "more\n" |
| 535 | 532 | fossil uv add u.txt v.txt |
| 536 | 533 | fossil uv rm v.txt |
| @@ -556,14 +553,14 @@ | ||
| 556 | 553 | fossil sql "SELECT substr(uuid,1,4) FROM blob GROUP BY 1 HAVING count(*)>1" |
| 557 | 554 | set th1mainPrefix [string trim $RESULT] |
| 558 | 555 | test_eq th1main-ambiguous-setup $th1mainPrefix 2b06 |
| 559 | 556 | set th1mainGot [th1main_eval "artifact $th1mainPrefix"] |
| 560 | 557 | test th1main-artifact-ambiguous \ |
| 561 | - {$CODE == 0 && $th1mainGot eq "TH_ERROR: ambiguous name"} $::trunkMark | |
| 558 | + {$CODE == 0 && $th1mainGot eq "TH_ERROR: ambiguous name"} | |
| 562 | 559 | set th1mainGot [th1main_eval "artifact $th1mainPrefix a.txt"] |
| 563 | 560 | test th1main-artifact-ambiguous-checkin \ |
| 564 | - {$CODE == 0 && [string match "TH_ERROR: *" $th1mainGot]} $::trunkMark | |
| 561 | + {$CODE == 0 && [string match "TH_ERROR: *" $th1mainGot]} | |
| 565 | 562 | test_eq th1main-dir-ambiguous [th1main_eval "dir $th1mainPrefix"] {} |
| 566 | 563 | |
| 567 | 564 | # "setting -strict" and "http -asynchronous" with nothing after the |
| 568 | 565 | # option, and "http" with an empty first argument, give a script error. |
| 569 | 566 | foreach {th1mainName th1mainCall th1mainUsage} { |
| @@ -572,17 +569,17 @@ | ||
| 572 | 569 | {http ?-asynchronous? ?--? url ?payload?} |
| 573 | 570 | http-empty {http {}} {http ?-asynchronous? ?--? url ?payload?} |
| 574 | 571 | } { |
| 575 | 572 | set th1mainGot [th1main_eval $th1mainCall] |
| 576 | 573 | test th1main-args-$th1mainName {$CODE == 0 && [string match \ |
| 577 | - "TH_ERROR: *" $th1mainGot]} $::trunkMark | |
| 574 | + "TH_ERROR: *" $th1mainGot]} | |
| 578 | 575 | } |
| 579 | 576 | |
| 580 | 577 | # combobox with a second argument that is not a list gives a script error. |
| 581 | 578 | set th1mainGot [th1main_eval "combobox nm \"\{\" 1"] |
| 582 | 579 | test th1main-combobox-not-list \ |
| 583 | - {$CODE == 0 && [string match "*TH_ERROR: *" $th1mainGot]} $::trunkMark | |
| 580 | + {$CODE == 0 && [string match "*TH_ERROR: *" $th1mainGot]} | |
| 584 | 581 | |
| 585 | 582 | # A query runs each of its statements once. |
| 586 | 583 | foreach {th1mainName th1mainSql} { |
| 587 | 584 | two {SELECT 1 AS a; SELECT 2 AS a} |
| 588 | 585 | space {SELECT 1 AS a; } |
| @@ -591,30 +588,27 @@ | ||
| 591 | 588 | [join [list \ |
| 592 | 589 | "set n 0; query {$th1mainSql} {set n \[expr {\$n+1}\]; if " \ |
| 593 | 590 | "{\$n>50} {error endless}}; set n"] ""] |
| 594 | 591 | test th1main-query-statements-$th1mainName \ |
| 595 | 592 | {$CODE == 0 && [string trim $RESULT] eq [dict get {two 2 space 1} \ |
| 596 | - $th1mainName]} $::trunkMark | |
| 593 | + $th1mainName]} | |
| 597 | 594 | } |
| 598 | 595 | |
| 599 | 596 | # builtin_request_js with a name that is not a built-in file gives a |
| 600 | 597 | # script error. |
| 601 | 598 | set th1mainGot [th1main_eval {builtin_request_js nosuch.js}] |
| 602 | -test th1main-requestjs-unknown {$CODE == 0} $::trunkMark | |
| 599 | +test th1main-requestjs-unknown {$CODE == 0} | |
| 603 | 600 | |
| 604 | 601 | # randhex gives at most 50 bytes, 100 digits. |
| 605 | -test_match th1main-randhex-50 [th1main_eval {randhex 50}] {^[0-9a-f]{100}$} \ | |
| 606 | - [sanitizer_trunk_mark] | |
| 607 | -test th1main-randhex-50-exit {$CODE == 0} [sanitizer_trunk_mark] | |
| 608 | -test_match th1main-randhex-over [th1main_eval {randhex 1000}] \ | |
| 609 | - {^[0-9a-f]{100}$} \ | |
| 610 | - [sanitizer_trunk_mark] | |
| 602 | +test_match th1main-randhex-50 [th1main_eval {randhex 50}] {^[0-9a-f]{100}$} | |
| 603 | +test th1main-randhex-50-exit {$CODE == 0} | |
| 604 | +test_match th1main-randhex-over [th1main_eval {randhex 1000}] {^[0-9a-f]{100}$} | |
| 611 | 605 | |
| 612 | 606 | # http with text that is not a URL gives a script error. |
| 613 | 607 | set th1mainGot [th1main_eval {http not-a-url}] |
| 614 | 608 | test th1main-http-not-url \ |
| 615 | - {$CODE == 0 && [string match "TH_ERROR: *" $th1mainGot]} $::trunkMark | |
| 609 | + {$CODE == 0 && [string match "TH_ERROR: *" $th1mainGot]} | |
| 616 | 610 | |
| 617 | 611 | # A phantom: an artifact whose content the repository does not hold. |
| 618 | 612 | set th1mainPhantom \ |
| 619 | 613 | abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789 |
| 620 | 614 | fossil sql "INSERT INTO blob(rcvid,size,uuid) VALUES(0,-1,'$th1mainPhantom'); |
| @@ -743,11 +737,11 @@ | ||
| 743 | 737 | {maybe_set default_csp } {set project_name [taint }} |
| 744 | 738 | } { |
| 745 | 739 | set th1mainGot [th1main_eval $th1mainScript --th-trace {*}$th1mainOpts] |
| 746 | 740 | test th1main-trace-$th1mainName {[holds_strings $th1mainGot [concat \ |
| 747 | 741 | {{------------------ BEGIN TRACE LOG ------------------}} \ |
| 748 | - $th1mainWanted]]} [trunk_mark $th1mainName header] | |
| 742 | + $th1mainWanted]]} | |
| 749 | 743 | } |
| 750 | 744 | |
| 751 | 745 | ############################################################################### |
| 752 | 746 | # Templates: text with TH1 between <th1> and </th1>, $name for the value |
| 753 | 747 | # of a variable as it is and $<name> for its value escaped for HTML. |
| @@ -809,12 +803,11 @@ | ||
| 809 | 803 | foreach {th1mainName th1mainText} { |
| 810 | 804 | break {a<th1>break</th1>after} |
| 811 | 805 | continue {a<th1>continue</th1>after} |
| 812 | 806 | return {a<th1>return 5</th1>after} |
| 813 | 807 | } { |
| 814 | - test_eq th1main-render-$th1mainName [th1main_render $th1mainText] a \ | |
| 815 | - $::trunkMark | |
| 808 | + test_eq th1main-render-$th1mainName [th1main_render $th1mainText] a | |
| 816 | 809 | } |
| 817 | 810 | |
| 818 | 811 | # Text after a zero byte in the file is not rendered. |
| 819 | 812 | test_eq th1main-render-zero-byte [th1main_render "a\0b<th1>puts c</th1>"] a |
| 820 | 813 | |
| @@ -1016,20 +1009,20 @@ | ||
| 1016 | 1009 | th1main_table { |
| 1017 | 1010 | redirect-no-request {} {redirect /elsewhere} |
| 1018 | 1011 | eq {TH_ERROR: redirect is only allowed in a web request } |
| 1019 | 1012 | redirect-no-request-http {} {redirect http://example.com/} |
| 1020 | 1013 | eq {TH_ERROR: redirect is only allowed in a web request } |
| 1021 | -} $::trunkMark | |
| 1014 | +} | |
| 1022 | 1015 | set th1mainGot [th1main_eval {redirect http://example.com/a} --cgi] |
| 1023 | 1016 | test th1main-redirect-cgi-http {[holds_strings $th1mainGot [list \ |
| 1024 | 1017 | "Status: 302 " "Location: http://example.com/a\r\n"]]} |
| 1025 | 1018 | set th1mainGot [th1main_eval {redirect https://example.com/a} --cgi] |
| 1026 | 1019 | test th1main-redirect-cgi-https {[holds_strings $th1mainGot [list \ |
| 1027 | 1020 | "Status: 302 " "Location: https://example.com/a\r\n"]]} |
| 1028 | 1021 | set th1mainGot [th1main_eval {redirect /relative} --cgi] |
| 1029 | 1022 | test th1main-redirect-cgi-relative {[holds_strings $th1mainGot \ |
| 1030 | - {{redirect is only allowed in a web request} !Location}]} $::trunkMark | |
| 1023 | + {{redirect is only allowed in a web request} !Location}]} | |
| 1031 | 1024 | |
| 1032 | 1025 | # verifyCsrf lets through only a POST from the same site that carries |
| 1033 | 1026 | # the token insertCsrf wrote. |
| 1034 | 1027 | set th1mainGot [th1main_page {<th1>insertCsrf</th1>}] |
| 1035 | 1028 | regexp {name="csrf" value="([^"]+)"} $th1mainGot -> th1mainToken |
| 1036 | 1029 | |
| 1037 | 1030 | DELETED test/trunk-fixes.tcl |
| --- test/th1main.test | |
| +++ test/th1main.test | |
| @@ -6,11 +6,10 @@ | |
| 6 | # |
| 7 | |
| 8 | # The first sections run at every level, and the rest need |
| 9 | # -assurance stress. |
| 10 | test_setup |
| 11 | source [file join $::testfiledir trunk-fixes.tcl] |
| 12 | |
| 13 | write_file a.txt "hello\n" |
| 14 | write_file f83.txt "line 83\n" |
| 15 | write_file f100.txt "line 100\n" |
| 16 | fossil add a.txt f83.txt f100.txt |
| @@ -43,16 +42,15 @@ | |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | # Run each row of TABLE: a test name, options for test-th-eval, a |
| 47 | # script, a mode and an expected value as th1main_check takes them. |
| 48 | # CONSTRAINTS is given to every test of the table. |
| 49 | # |
| 50 | proc th1main_table {table {constraints ""}} { |
| 51 | foreach {name opts script mode expected} $table { |
| 52 | set got [th1main_eval $script {*}$opts] |
| 53 | th1main_check th1main-$name $got $mode $expected $constraints |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | ############################################################################### |
| 58 | # Every command refuses a call with too few or too many arguments. Each |
| @@ -167,12 +165,11 @@ | |
| 167 | {http ?-asynchronous? ?--? url ?payload?} |
| 168 | capture-few {captureTh1} {captureTh1 STRING} |
| 169 | capture-many {captureTh1 a b} {captureTh1 STRING} |
| 170 | } { |
| 171 | test_eq th1main-args-$th1mainName [th1main_eval $th1mainCall] \ |
| 172 | "TH_ERROR: wrong # args: should be \"$th1mainUsage\"" \ |
| 173 | [trunk_mark $th1mainName {randhex-many http-none http-three}] |
| 174 | } |
| 175 | |
| 176 | if {[test_assurance] ne "stress"} { |
| 177 | test_skip "the tests after the first sections need -assurance stress" |
| 178 | } |
| @@ -523,14 +520,14 @@ | |
| 523 | # Unversioned files. |
| 524 | |
| 525 | # In a repository that has never held an unversioned file, "unversioned |
| 526 | # list" gives an empty list and "unversioned content" a script error. |
| 527 | set th1mainGot [th1main_eval {unversioned list}] |
| 528 | test th1main-uv-list-none {$CODE == 0 && $th1mainGot eq ""} $::trunkMark |
| 529 | set th1mainGot [th1main_eval {unversioned content nosuch}] |
| 530 | test th1main-uv-content-none \ |
| 531 | {$CODE == 0 && [string match "TH_ERROR:*" $th1mainGot]} $::trunkMark |
| 532 | |
| 533 | write_file u.txt "data\n" |
| 534 | write_file v.txt "more\n" |
| 535 | fossil uv add u.txt v.txt |
| 536 | fossil uv rm v.txt |
| @@ -556,14 +553,14 @@ | |
| 556 | fossil sql "SELECT substr(uuid,1,4) FROM blob GROUP BY 1 HAVING count(*)>1" |
| 557 | set th1mainPrefix [string trim $RESULT] |
| 558 | test_eq th1main-ambiguous-setup $th1mainPrefix 2b06 |
| 559 | set th1mainGot [th1main_eval "artifact $th1mainPrefix"] |
| 560 | test th1main-artifact-ambiguous \ |
| 561 | {$CODE == 0 && $th1mainGot eq "TH_ERROR: ambiguous name"} $::trunkMark |
| 562 | set th1mainGot [th1main_eval "artifact $th1mainPrefix a.txt"] |
| 563 | test th1main-artifact-ambiguous-checkin \ |
| 564 | {$CODE == 0 && [string match "TH_ERROR: *" $th1mainGot]} $::trunkMark |
| 565 | test_eq th1main-dir-ambiguous [th1main_eval "dir $th1mainPrefix"] {} |
| 566 | |
| 567 | # "setting -strict" and "http -asynchronous" with nothing after the |
| 568 | # option, and "http" with an empty first argument, give a script error. |
| 569 | foreach {th1mainName th1mainCall th1mainUsage} { |
| @@ -572,17 +569,17 @@ | |
| 572 | {http ?-asynchronous? ?--? url ?payload?} |
| 573 | http-empty {http {}} {http ?-asynchronous? ?--? url ?payload?} |
| 574 | } { |
| 575 | set th1mainGot [th1main_eval $th1mainCall] |
| 576 | test th1main-args-$th1mainName {$CODE == 0 && [string match \ |
| 577 | "TH_ERROR: *" $th1mainGot]} $::trunkMark |
| 578 | } |
| 579 | |
| 580 | # combobox with a second argument that is not a list gives a script error. |
| 581 | set th1mainGot [th1main_eval "combobox nm \"\{\" 1"] |
| 582 | test th1main-combobox-not-list \ |
| 583 | {$CODE == 0 && [string match "*TH_ERROR: *" $th1mainGot]} $::trunkMark |
| 584 | |
| 585 | # A query runs each of its statements once. |
| 586 | foreach {th1mainName th1mainSql} { |
| 587 | two {SELECT 1 AS a; SELECT 2 AS a} |
| 588 | space {SELECT 1 AS a; } |
| @@ -591,30 +588,27 @@ | |
| 591 | [join [list \ |
| 592 | "set n 0; query {$th1mainSql} {set n \[expr {\$n+1}\]; if " \ |
| 593 | "{\$n>50} {error endless}}; set n"] ""] |
| 594 | test th1main-query-statements-$th1mainName \ |
| 595 | {$CODE == 0 && [string trim $RESULT] eq [dict get {two 2 space 1} \ |
| 596 | $th1mainName]} $::trunkMark |
| 597 | } |
| 598 | |
| 599 | # builtin_request_js with a name that is not a built-in file gives a |
| 600 | # script error. |
| 601 | set th1mainGot [th1main_eval {builtin_request_js nosuch.js}] |
| 602 | test th1main-requestjs-unknown {$CODE == 0} $::trunkMark |
| 603 | |
| 604 | # randhex gives at most 50 bytes, 100 digits. |
| 605 | test_match th1main-randhex-50 [th1main_eval {randhex 50}] {^[0-9a-f]{100}$} \ |
| 606 | [sanitizer_trunk_mark] |
| 607 | test th1main-randhex-50-exit {$CODE == 0} [sanitizer_trunk_mark] |
| 608 | test_match th1main-randhex-over [th1main_eval {randhex 1000}] \ |
| 609 | {^[0-9a-f]{100}$} \ |
| 610 | [sanitizer_trunk_mark] |
| 611 | |
| 612 | # http with text that is not a URL gives a script error. |
| 613 | set th1mainGot [th1main_eval {http not-a-url}] |
| 614 | test th1main-http-not-url \ |
| 615 | {$CODE == 0 && [string match "TH_ERROR: *" $th1mainGot]} $::trunkMark |
| 616 | |
| 617 | # A phantom: an artifact whose content the repository does not hold. |
| 618 | set th1mainPhantom \ |
| 619 | abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789 |
| 620 | fossil sql "INSERT INTO blob(rcvid,size,uuid) VALUES(0,-1,'$th1mainPhantom'); |
| @@ -743,11 +737,11 @@ | |
| 743 | {maybe_set default_csp } {set project_name [taint }} |
| 744 | } { |
| 745 | set th1mainGot [th1main_eval $th1mainScript --th-trace {*}$th1mainOpts] |
| 746 | test th1main-trace-$th1mainName {[holds_strings $th1mainGot [concat \ |
| 747 | {{------------------ BEGIN TRACE LOG ------------------}} \ |
| 748 | $th1mainWanted]]} [trunk_mark $th1mainName header] |
| 749 | } |
| 750 | |
| 751 | ############################################################################### |
| 752 | # Templates: text with TH1 between <th1> and </th1>, $name for the value |
| 753 | # of a variable as it is and $<name> for its value escaped for HTML. |
| @@ -809,12 +803,11 @@ | |
| 809 | foreach {th1mainName th1mainText} { |
| 810 | break {a<th1>break</th1>after} |
| 811 | continue {a<th1>continue</th1>after} |
| 812 | return {a<th1>return 5</th1>after} |
| 813 | } { |
| 814 | test_eq th1main-render-$th1mainName [th1main_render $th1mainText] a \ |
| 815 | $::trunkMark |
| 816 | } |
| 817 | |
| 818 | # Text after a zero byte in the file is not rendered. |
| 819 | test_eq th1main-render-zero-byte [th1main_render "a\0b<th1>puts c</th1>"] a |
| 820 | |
| @@ -1016,20 +1009,20 @@ | |
| 1016 | th1main_table { |
| 1017 | redirect-no-request {} {redirect /elsewhere} |
| 1018 | eq {TH_ERROR: redirect is only allowed in a web request } |
| 1019 | redirect-no-request-http {} {redirect http://example.com/} |
| 1020 | eq {TH_ERROR: redirect is only allowed in a web request } |
| 1021 | } $::trunkMark |
| 1022 | set th1mainGot [th1main_eval {redirect http://example.com/a} --cgi] |
| 1023 | test th1main-redirect-cgi-http {[holds_strings $th1mainGot [list \ |
| 1024 | "Status: 302 " "Location: http://example.com/a\r\n"]]} |
| 1025 | set th1mainGot [th1main_eval {redirect https://example.com/a} --cgi] |
| 1026 | test th1main-redirect-cgi-https {[holds_strings $th1mainGot [list \ |
| 1027 | "Status: 302 " "Location: https://example.com/a\r\n"]]} |
| 1028 | set th1mainGot [th1main_eval {redirect /relative} --cgi] |
| 1029 | test th1main-redirect-cgi-relative {[holds_strings $th1mainGot \ |
| 1030 | {{redirect is only allowed in a web request} !Location}]} $::trunkMark |
| 1031 | |
| 1032 | # verifyCsrf lets through only a POST from the same site that carries |
| 1033 | # the token insertCsrf wrote. |
| 1034 | set th1mainGot [th1main_page {<th1>insertCsrf</th1>}] |
| 1035 | regexp {name="csrf" value="([^"]+)"} $th1mainGot -> th1mainToken |
| 1036 | |
| 1037 | ELETED test/trunk-fixes.tcl |
| --- test/th1main.test | |
| +++ test/th1main.test | |
| @@ -6,11 +6,10 @@ | |
| 6 | # |
| 7 | |
| 8 | # The first sections run at every level, and the rest need |
| 9 | # -assurance stress. |
| 10 | test_setup |
| 11 | |
| 12 | write_file a.txt "hello\n" |
| 13 | write_file f83.txt "line 83\n" |
| 14 | write_file f100.txt "line 100\n" |
| 15 | fossil add a.txt f83.txt f100.txt |
| @@ -43,16 +42,15 @@ | |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | # Run each row of TABLE: a test name, options for test-th-eval, a |
| 46 | # script, a mode and an expected value as th1main_check takes them. |
| 47 | # |
| 48 | proc th1main_table {table} { |
| 49 | foreach {name opts script mode expected} $table { |
| 50 | set got [th1main_eval $script {*}$opts] |
| 51 | th1main_check th1main-$name $got $mode $expected |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | ############################################################################### |
| 56 | # Every command refuses a call with too few or too many arguments. Each |
| @@ -167,12 +165,11 @@ | |
| 165 | {http ?-asynchronous? ?--? url ?payload?} |
| 166 | capture-few {captureTh1} {captureTh1 STRING} |
| 167 | capture-many {captureTh1 a b} {captureTh1 STRING} |
| 168 | } { |
| 169 | test_eq th1main-args-$th1mainName [th1main_eval $th1mainCall] \ |
| 170 | "TH_ERROR: wrong # args: should be \"$th1mainUsage\"" |
| 171 | } |
| 172 | |
| 173 | if {[test_assurance] ne "stress"} { |
| 174 | test_skip "the tests after the first sections need -assurance stress" |
| 175 | } |
| @@ -523,14 +520,14 @@ | |
| 520 | # Unversioned files. |
| 521 | |
| 522 | # In a repository that has never held an unversioned file, "unversioned |
| 523 | # list" gives an empty list and "unversioned content" a script error. |
| 524 | set th1mainGot [th1main_eval {unversioned list}] |
| 525 | test th1main-uv-list-none {$CODE == 0 && $th1mainGot eq ""} |
| 526 | set th1mainGot [th1main_eval {unversioned content nosuch}] |
| 527 | test th1main-uv-content-none \ |
| 528 | {$CODE == 0 && [string match "TH_ERROR:*" $th1mainGot]} |
| 529 | |
| 530 | write_file u.txt "data\n" |
| 531 | write_file v.txt "more\n" |
| 532 | fossil uv add u.txt v.txt |
| 533 | fossil uv rm v.txt |
| @@ -556,14 +553,14 @@ | |
| 553 | fossil sql "SELECT substr(uuid,1,4) FROM blob GROUP BY 1 HAVING count(*)>1" |
| 554 | set th1mainPrefix [string trim $RESULT] |
| 555 | test_eq th1main-ambiguous-setup $th1mainPrefix 2b06 |
| 556 | set th1mainGot [th1main_eval "artifact $th1mainPrefix"] |
| 557 | test th1main-artifact-ambiguous \ |
| 558 | {$CODE == 0 && $th1mainGot eq "TH_ERROR: ambiguous name"} |
| 559 | set th1mainGot [th1main_eval "artifact $th1mainPrefix a.txt"] |
| 560 | test th1main-artifact-ambiguous-checkin \ |
| 561 | {$CODE == 0 && [string match "TH_ERROR: *" $th1mainGot]} |
| 562 | test_eq th1main-dir-ambiguous [th1main_eval "dir $th1mainPrefix"] {} |
| 563 | |
| 564 | # "setting -strict" and "http -asynchronous" with nothing after the |
| 565 | # option, and "http" with an empty first argument, give a script error. |
| 566 | foreach {th1mainName th1mainCall th1mainUsage} { |
| @@ -572,17 +569,17 @@ | |
| 569 | {http ?-asynchronous? ?--? url ?payload?} |
| 570 | http-empty {http {}} {http ?-asynchronous? ?--? url ?payload?} |
| 571 | } { |
| 572 | set th1mainGot [th1main_eval $th1mainCall] |
| 573 | test th1main-args-$th1mainName {$CODE == 0 && [string match \ |
| 574 | "TH_ERROR: *" $th1mainGot]} |
| 575 | } |
| 576 | |
| 577 | # combobox with a second argument that is not a list gives a script error. |
| 578 | set th1mainGot [th1main_eval "combobox nm \"\{\" 1"] |
| 579 | test th1main-combobox-not-list \ |
| 580 | {$CODE == 0 && [string match "*TH_ERROR: *" $th1mainGot]} |
| 581 | |
| 582 | # A query runs each of its statements once. |
| 583 | foreach {th1mainName th1mainSql} { |
| 584 | two {SELECT 1 AS a; SELECT 2 AS a} |
| 585 | space {SELECT 1 AS a; } |
| @@ -591,30 +588,27 @@ | |
| 588 | [join [list \ |
| 589 | "set n 0; query {$th1mainSql} {set n \[expr {\$n+1}\]; if " \ |
| 590 | "{\$n>50} {error endless}}; set n"] ""] |
| 591 | test th1main-query-statements-$th1mainName \ |
| 592 | {$CODE == 0 && [string trim $RESULT] eq [dict get {two 2 space 1} \ |
| 593 | $th1mainName]} |
| 594 | } |
| 595 | |
| 596 | # builtin_request_js with a name that is not a built-in file gives a |
| 597 | # script error. |
| 598 | set th1mainGot [th1main_eval {builtin_request_js nosuch.js}] |
| 599 | test th1main-requestjs-unknown {$CODE == 0} |
| 600 | |
| 601 | # randhex gives at most 50 bytes, 100 digits. |
| 602 | test_match th1main-randhex-50 [th1main_eval {randhex 50}] {^[0-9a-f]{100}$} |
| 603 | test th1main-randhex-50-exit {$CODE == 0} |
| 604 | test_match th1main-randhex-over [th1main_eval {randhex 1000}] {^[0-9a-f]{100}$} |
| 605 | |
| 606 | # http with text that is not a URL gives a script error. |
| 607 | set th1mainGot [th1main_eval {http not-a-url}] |
| 608 | test th1main-http-not-url \ |
| 609 | {$CODE == 0 && [string match "TH_ERROR: *" $th1mainGot]} |
| 610 | |
| 611 | # A phantom: an artifact whose content the repository does not hold. |
| 612 | set th1mainPhantom \ |
| 613 | abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789 |
| 614 | fossil sql "INSERT INTO blob(rcvid,size,uuid) VALUES(0,-1,'$th1mainPhantom'); |
| @@ -743,11 +737,11 @@ | |
| 737 | {maybe_set default_csp } {set project_name [taint }} |
| 738 | } { |
| 739 | set th1mainGot [th1main_eval $th1mainScript --th-trace {*}$th1mainOpts] |
| 740 | test th1main-trace-$th1mainName {[holds_strings $th1mainGot [concat \ |
| 741 | {{------------------ BEGIN TRACE LOG ------------------}} \ |
| 742 | $th1mainWanted]]} |
| 743 | } |
| 744 | |
| 745 | ############################################################################### |
| 746 | # Templates: text with TH1 between <th1> and </th1>, $name for the value |
| 747 | # of a variable as it is and $<name> for its value escaped for HTML. |
| @@ -809,12 +803,11 @@ | |
| 803 | foreach {th1mainName th1mainText} { |
| 804 | break {a<th1>break</th1>after} |
| 805 | continue {a<th1>continue</th1>after} |
| 806 | return {a<th1>return 5</th1>after} |
| 807 | } { |
| 808 | test_eq th1main-render-$th1mainName [th1main_render $th1mainText] a |
| 809 | } |
| 810 | |
| 811 | # Text after a zero byte in the file is not rendered. |
| 812 | test_eq th1main-render-zero-byte [th1main_render "a\0b<th1>puts c</th1>"] a |
| 813 | |
| @@ -1016,20 +1009,20 @@ | |
| 1009 | th1main_table { |
| 1010 | redirect-no-request {} {redirect /elsewhere} |
| 1011 | eq {TH_ERROR: redirect is only allowed in a web request } |
| 1012 | redirect-no-request-http {} {redirect http://example.com/} |
| 1013 | eq {TH_ERROR: redirect is only allowed in a web request } |
| 1014 | } |
| 1015 | set th1mainGot [th1main_eval {redirect http://example.com/a} --cgi] |
| 1016 | test th1main-redirect-cgi-http {[holds_strings $th1mainGot [list \ |
| 1017 | "Status: 302 " "Location: http://example.com/a\r\n"]]} |
| 1018 | set th1mainGot [th1main_eval {redirect https://example.com/a} --cgi] |
| 1019 | test th1main-redirect-cgi-https {[holds_strings $th1mainGot [list \ |
| 1020 | "Status: 302 " "Location: https://example.com/a\r\n"]]} |
| 1021 | set th1mainGot [th1main_eval {redirect /relative} --cgi] |
| 1022 | test th1main-redirect-cgi-relative {[holds_strings $th1mainGot \ |
| 1023 | {{redirect is only allowed in a web request} !Location}]} |
| 1024 | |
| 1025 | # verifyCsrf lets through only a POST from the same site that carries |
| 1026 | # the token insertCsrf wrote. |
| 1027 | set th1mainGot [th1main_page {<th1>insertCsrf</th1>}] |
| 1028 | regexp {name="csrf" value="([^"]+)"} $th1mainGot -> th1mainToken |
| 1029 | |
| 1030 | ELETED test/trunk-fixes.tcl |
D
test/trunk-fixes.tcl
-58
| --- a/test/trunk-fixes.tcl | ||
| +++ b/test/trunk-fixes.tcl | ||
| @@ -1,58 +0,0 @@ | ||
| 1 | -# | |
| 2 | -# Sourced by test files with tests of faults that are fixed on trunk. A | |
| 3 | -# fossil built from an older trunk has those faults. Each such test | |
| 4 | -# passes $trunkMark as its constraint: "knownBug" for a fossil with the | |
| 5 | -# faults, so that their tests are reported but not counted as failures, | |
| 6 | -# and empty for a fossil without them. | |
| 7 | -# | |
| 8 | -# A fossil with the fixes names randhex when TH1 randhex is given too many | |
| 9 | -# arguments. The check needs no repository or check-out. | |
| 10 | -# | |
| 11 | -if {![info exists trunkMark]} { | |
| 12 | - catch {exec $::fossilexe test-th-eval {randhex 1 2} 2>@1} trunkFixesReply | |
| 13 | - if {[string first {should be "randhex} $trunkFixesReply] >= 0} { | |
| 14 | - set trunkMark "" | |
| 15 | - } else { | |
| 16 | - set trunkMark knownBug | |
| 17 | - } | |
| 18 | -} | |
| 19 | - | |
| 20 | -# Some tests send input on which the address or undefined-behaviour | |
| 21 | -# sanitizer reports a fault that is not fixed on trunk. Those tests are | |
| 22 | -# skipped on a fossil built with a sanitizer. sanitizerBuild is 1 for | |
| 23 | -# such a fossil: its file holds the sanitizer's entry points. | |
| 24 | -# | |
| 25 | -if {![info exists sanitizerBuild]} { | |
| 26 | - set trunkFixesFd [open $::fossilexe rb] | |
| 27 | - set trunkFixesBytes [read $trunkFixesFd] | |
| 28 | - close $trunkFixesFd | |
| 29 | - set sanitizerBuild [expr { | |
| 30 | - [string first __asan_init $trunkFixesBytes] >= 0 || | |
| 31 | - [string first __ubsan_handle $trunkFixesBytes] >= 0}] | |
| 32 | - unset trunkFixesBytes trunkFixesFd | |
| 33 | -} | |
| 34 | - | |
| 35 | -# Return trunkMark if VALUE is one of VALUES, and an empty string | |
| 36 | -# otherwise: the constraint for a test made in a loop, only some of whose | |
| 37 | -# rounds test a fix on trunk. | |
| 38 | -# | |
| 39 | -proc trunk_mark {value values} { | |
| 40 | - if {$value in $values} { | |
| 41 | - return $::trunkMark | |
| 42 | - } | |
| 43 | - return "" | |
| 44 | -} | |
| 45 | - | |
| 46 | -# The constraint for a test of a fix on trunk whose fault only a sanitizer | |
| 47 | -# reports: trunkMark on a sanitizer build, and an empty string otherwise. | |
| 48 | -# With VALUE and VALUES, as for trunk_mark. | |
| 49 | -# | |
| 50 | -proc sanitizer_trunk_mark {args} { | |
| 51 | - if {!$::sanitizerBuild} { | |
| 52 | - return "" | |
| 53 | - } | |
| 54 | - if {[llength $args] == 0} { | |
| 55 | - return $::trunkMark | |
| 56 | - } | |
| 57 | - return [trunk_mark {*}$args] | |
| 58 | -} |
| --- a/test/trunk-fixes.tcl | |
| +++ b/test/trunk-fixes.tcl | |
| @@ -1,58 +0,0 @@ | |
| 1 | # |
| 2 | # Sourced by test files with tests of faults that are fixed on trunk. A |
| 3 | # fossil built from an older trunk has those faults. Each such test |
| 4 | # passes $trunkMark as its constraint: "knownBug" for a fossil with the |
| 5 | # faults, so that their tests are reported but not counted as failures, |
| 6 | # and empty for a fossil without them. |
| 7 | # |
| 8 | # A fossil with the fixes names randhex when TH1 randhex is given too many |
| 9 | # arguments. The check needs no repository or check-out. |
| 10 | # |
| 11 | if {![info exists trunkMark]} { |
| 12 | catch {exec $::fossilexe test-th-eval {randhex 1 2} 2>@1} trunkFixesReply |
| 13 | if {[string first {should be "randhex} $trunkFixesReply] >= 0} { |
| 14 | set trunkMark "" |
| 15 | } else { |
| 16 | set trunkMark knownBug |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | # Some tests send input on which the address or undefined-behaviour |
| 21 | # sanitizer reports a fault that is not fixed on trunk. Those tests are |
| 22 | # skipped on a fossil built with a sanitizer. sanitizerBuild is 1 for |
| 23 | # such a fossil: its file holds the sanitizer's entry points. |
| 24 | # |
| 25 | if {![info exists sanitizerBuild]} { |
| 26 | set trunkFixesFd [open $::fossilexe rb] |
| 27 | set trunkFixesBytes [read $trunkFixesFd] |
| 28 | close $trunkFixesFd |
| 29 | set sanitizerBuild [expr { |
| 30 | [string first __asan_init $trunkFixesBytes] >= 0 || |
| 31 | [string first __ubsan_handle $trunkFixesBytes] >= 0}] |
| 32 | unset trunkFixesBytes trunkFixesFd |
| 33 | } |
| 34 | |
| 35 | # Return trunkMark if VALUE is one of VALUES, and an empty string |
| 36 | # otherwise: the constraint for a test made in a loop, only some of whose |
| 37 | # rounds test a fix on trunk. |
| 38 | # |
| 39 | proc trunk_mark {value values} { |
| 40 | if {$value in $values} { |
| 41 | return $::trunkMark |
| 42 | } |
| 43 | return "" |
| 44 | } |
| 45 | |
| 46 | # The constraint for a test of a fix on trunk whose fault only a sanitizer |
| 47 | # reports: trunkMark on a sanitizer build, and an empty string otherwise. |
| 48 | # With VALUE and VALUES, as for trunk_mark. |
| 49 | # |
| 50 | proc sanitizer_trunk_mark {args} { |
| 51 | if {!$::sanitizerBuild} { |
| 52 | return "" |
| 53 | } |
| 54 | if {[llength $args] == 0} { |
| 55 | return $::trunkMark |
| 56 | } |
| 57 | return [trunk_mark {*}$args] |
| 58 | } |
| --- a/test/trunk-fixes.tcl | |
| +++ b/test/trunk-fixes.tcl | |
| @@ -1,58 +0,0 @@ | |
+15
-32
| --- test/url.test | ||
| +++ test/url.test | ||
| @@ -35,11 +35,10 @@ | ||
| 35 | 35 | unset env($urlVar) |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | test_setup |
| 40 | -source [file join $::testfiledir trunk-fixes.tcl] | |
| 41 | 40 | set urlRepo [file join [pwd] .rep.fossil] |
| 42 | 41 | set urlDir [pwd] |
| 43 | 42 | |
| 44 | 43 | ############################################################################### |
| 45 | 44 | # The parts of a URL. |
| @@ -220,12 +219,11 @@ | ||
| 220 | 219 | port-letters http://h:80x/ {url missing '/' after port number} |
| 221 | 220 | port-ipv6-junk {http://[::1]:8x} {url missing '/' after port number} |
| 222 | 221 | } { |
| 223 | 222 | fossil_raw test-urlparser $urlText --proxy off |
| 224 | 223 | test url-parse-refused-$urlName \ |
| 225 | - {$CODE == 1 && [string first $urlMessage $RESULT] >= 0} \ | |
| 226 | - [trunk_mark $urlName {port-too-large port-huge}] | |
| 224 | + {$CODE == 1 && [string first $urlMessage $RESULT] >= 0} | |
| 227 | 225 | } |
| 228 | 226 | |
| 229 | 227 | # An ssh: URL with a host and no path has an empty path, and fossil |
| 230 | 228 | # prints nothing but the parts of the URL. |
| 231 | 229 | # |
| @@ -240,33 +238,28 @@ | ||
| 240 | 238 | user-host-port ssh://u@h:2222 |
| 241 | 239 | {isSsh 1 name h port 2222 path {} canonical ssh://u@h:2222} |
| 242 | 240 | scheme-only ssh:// |
| 243 | 241 | {isSsh 1 name {} path {} canonical ssh://} |
| 244 | 242 | } { |
| 245 | - url_parse_test url-parse-ssh-no-path-$urlName $urlText {} $urlExpected \ | |
| 246 | - [sanitizer_trunk_mark $urlName \ | |
| 247 | - {host user-host host-port user-host-port scheme-only}] | |
| 243 | + url_parse_test url-parse-ssh-no-path-$urlName $urlText {} $urlExpected | |
| 248 | 244 | test url-parse-ssh-no-path-$urlName-output {$CODE == 0 && |
| 249 | 245 | [regexp -all -line {^(g\.url\.\w+ +|url_full\(g\.url\) )= } $RESULT] == |
| 250 | - [llength [split [string trim $RESULT] \n]]} \ | |
| 251 | - [sanitizer_trunk_mark $urlName \ | |
| 252 | - {host user-host host-port user-host-port scheme-only}] | |
| 246 | + [llength [split [string trim $RESULT] \n]]} | |
| 253 | 247 | } |
| 254 | 248 | |
| 255 | 249 | # The complete URL of an ssh: remote has the "/" between the host and |
| 256 | 250 | # the path. |
| 257 | 251 | # |
| 258 | 252 | url_parse_test url-parse-ssh-full ssh://u@h/dir/r.fossil {} \ |
| 259 | - {full ssh://u@h/dir/r.fossil} $::trunkMark | |
| 253 | + {full ssh://u@h/dir/r.fossil} | |
| 260 | 254 | |
| 261 | 255 | # A second fossil= parameter is refused. |
| 262 | 256 | # |
| 263 | 257 | fossil_raw test-urlparser ssh://h/r.fossil?fossil=/a/fossil&fossil=/b/fossil \ |
| 264 | 258 | --proxy off |
| 265 | 259 | test url-parse-ssh-fossil-twice {$CODE == 1 && |
| 266 | - [string match "*more than one fossil= query parameter*" $RESULT]} \ | |
| 267 | - $::trunkMark | |
| 260 | + [string match "*more than one fossil= query parameter*" $RESULT]} | |
| 268 | 261 | |
| 269 | 262 | # A very long user name, password, host and path. The four together stay |
| 270 | 263 | # under the 128 KB that Linux allows for one argument. |
| 271 | 264 | # |
| 272 | 265 | set urlLong [string repeat a 30000] |
| @@ -778,21 +771,20 @@ | ||
| 778 | 771 | status-401 "HTTP/1.1 401 Unauthorized\n\n" \ |
| 779 | 772 | {server says: 401 Unauthorized} \ |
| 780 | 773 | ] { |
| 781 | 774 | url_httpmsg [list [url_crlf $urlReply]] -v |
| 782 | 775 | test_match url-http-refused-$urlName "$CODE $RESULT" \ |
| 783 | - "^1 (?:.*\n)*.*$urlMessage" [trunk_mark $urlName redirect-to-bad-port] | |
| 776 | + "^1 (?:.*\n)*.*$urlMessage" | |
| 784 | 777 | url_httpmsg [list [url_crlf $urlReply]] |
| 785 | - test url-http-refused-quiet-$urlName {$CODE == 1} \ | |
| 786 | - [trunk_mark $urlName redirect-to-bad-port] | |
| 778 | + test url-http-refused-quiet-$urlName {$CODE == 1} | |
| 787 | 779 | } |
| 788 | 780 | |
| 789 | 781 | # A redirect to an ssh: URL with no path is refused. |
| 790 | 782 | # |
| 791 | 783 | url_httpmsg [list [url_crlf "HTTP/1.1 302 Found\nLocation: ssh://h\n\n"]] -v |
| 792 | 784 | test_match url-http-refused-redirect-to-ssh-no-path "$CODE $RESULT" \ |
| 793 | - {^1 (?:.*\n)*.*cannot redirect to ssh://h} [sanitizer_trunk_mark] | |
| 785 | + {^1 (?:.*\n)*.*cannot redirect to ssh://h} | |
| 794 | 786 | |
| 795 | 787 | # A status line that test-httpmsg prints an error for without -v only |
| 796 | 788 | # when it is not told to be quiet: it is quiet when it prints the reply |
| 797 | 789 | # on standard output, and it is not when the reply goes to a file. |
| 798 | 790 | # |
| @@ -809,15 +801,10 @@ | ||
| 809 | 801 | file delete out.txt |
| 810 | 802 | url_httpmsg [list [url_crlf $urlReply]] --out out.txt |
| 811 | 803 | test url-http-message-$urlName \ |
| 812 | 804 | {$CODE == 1 && [string first $urlMessage $RESULT] >= 0} |
| 813 | 805 | url_httpmsg [list [url_crlf $urlReply]] |
| 814 | - if {$urlName eq "redirect-to-file" && $::sanitizerBuild} { | |
| 815 | - test_skip_part "url-http-message-quiet-redirect-to-file: a sanitizer\ | |
| 816 | - reports the fault that 71f60497bb fixes, which is not on trunk" | |
| 817 | - continue | |
| 818 | - } | |
| 819 | 806 | test url-http-message-quiet-$urlName {$CODE == 1 && $RESULT eq ""} |
| 820 | 807 | } |
| 821 | 808 | |
| 822 | 809 | # A reply that is shorter than its Content-Length is an error, and only |
| 823 | 810 | # the bytes that came are printed. |
| @@ -826,11 +813,11 @@ | ||
| 826 | 813 | file delete out.txt |
| 827 | 814 | url_httpmsg [list $urlShort] --out out.txt |
| 828 | 815 | test url-http-message-truncated {$CODE == 1 && |
| 829 | 816 | [string first "response truncated: got 5 bytes of 6" $RESULT] >= 0} |
| 830 | 817 | url_httpmsg [list $urlShort] |
| 831 | -test url-http-truncated-bytes {$RESULT eq "hello"} $::trunkMark | |
| 818 | +test url-http-truncated-bytes {$RESULT eq "hello"} | |
| 832 | 819 | |
| 833 | 820 | # A redirect is followed three times, with the same method and payload, |
| 834 | 821 | # and the fourth is refused. 301, 302, 307 and 308 are followed. A |
| 835 | 822 | # Location that ends in /xfer is used without that ending. |
| 836 | 823 | # |
| @@ -1173,12 +1160,11 @@ | ||
| 1173 | 1160 | payload.txt --xfer {*}$args |
| 1174 | 1161 | test_listen_stop |
| 1175 | 1162 | } |
| 1176 | 1163 | url_xfer_reply text/html "<p>no <b>such</b> page</p>" -v |
| 1177 | 1164 | test url-xfer-error-verbose {$CODE == 1 && |
| 1178 | - [string first "server sends error: no such page" $RESULT] >= 0} \ | |
| 1179 | - $::trunkMark | |
| 1165 | + [string first "server sends error: no such page" $RESULT] >= 0} | |
| 1180 | 1166 | url_xfer_reply text/html "plain text, no tags" -v |
| 1181 | 1167 | test url-xfer-error-plain-text {$CODE == 1 && |
| 1182 | 1168 | [string first "server sends error: plain text, no tags" $RESULT] >= 0} |
| 1183 | 1169 | url_xfer_reply text/html "cut short <b" -v |
| 1184 | 1170 | test url-xfer-error-open-tag {$CODE == 1 && |
| @@ -1263,20 +1249,19 @@ | ||
| 1263 | 1249 | url_sync pull http://example.invalid/repo [list \ |
| 1264 | 1250 | [url_crlf "HTTP/1.1 302 Found\nLocation: http://127.0.0.1:PORT/moved\n\n"] \ |
| 1265 | 1251 | $urlNotFound] --once --proxy http://127.0.0.1:PORT |
| 1266 | 1252 | test url-sync-proxy-redirect {[llength $urlRequests] == 2 && |
| 1267 | 1253 | [string match "POST http://127.0.0.1:*/moved HTTP/1.1" \ |
| 1268 | - [url_request_line 1]]} $::trunkMark | |
| 1254 | + [url_request_line 1]]} | |
| 1269 | 1255 | |
| 1270 | 1256 | # A proxy is an http: or https: URL. With any other value fossil must |
| 1271 | 1257 | # not talk to the repository that the value names in place of the |
| 1272 | 1258 | # remote. |
| 1273 | 1259 | # |
| 1274 | 1260 | fossil_raw -seconds 60 clone http://example.invalid/repo proxyclone.fossil \ |
| 1275 | 1261 | --proxy file://$urlRepo |
| 1276 | -test url-sync-proxy-file {$CODE == 1 && ![file exists proxyclone.fossil]} \ | |
| 1277 | - $::trunkMark | |
| 1262 | +test url-sync-proxy-file {$CODE == 1 && ![file exists proxyclone.fossil]} | |
| 1278 | 1263 | file delete proxyclone.fossil |
| 1279 | 1264 | |
| 1280 | 1265 | # A pull through a proxy remembers the URL of the remote, not of the |
| 1281 | 1266 | # proxy. A proxy is not used for a file: URL. |
| 1282 | 1267 | # |
| @@ -1406,12 +1391,11 @@ | ||
| 1406 | 1391 | --httptrace |
| 1407 | 1392 | test url-sync-clone-httptrace-no-reply {$CODE == 1 && |
| 1408 | 1393 | ![file exists traceclone.fossil] && |
| 1409 | 1394 | [string first "cannot connect to host 127.0.0.1:$urlPort" $RESULT] >= 0} |
| 1410 | 1395 | test url-sync-clone-httptrace-no-reply-message \ |
| 1411 | - {[string first "server returned an error - clone aborted" $RESULT] >= 0} \ | |
| 1412 | - $::trunkMark | |
| 1396 | + {[string first "server returned an error - clone aborted" $RESULT] >= 0} | |
| 1413 | 1397 | file delete {*}[glob -nocomplain http-request-*.txt http-reply-*.txt] |
| 1414 | 1398 | |
| 1415 | 1399 | # --transport-command with --httptrace prints the command. A command |
| 1416 | 1400 | # that fails, or writes no reply, is an error. |
| 1417 | 1401 | # |
| @@ -1459,12 +1443,11 @@ | ||
| 1459 | 1443 | url_config last-sync-url 'http://[email protected]:$urlPort/repo' |
| 1460 | 1444 | fossil_raw -seconds 60 http --in xfersetup.txt --ipaddr 127.0.0.1 $urlRepo \ |
| 1461 | 1445 | --localauth |
| 1462 | 1446 | test_listen_stop |
| 1463 | 1447 | test url-web-sync-no-password {[string first "HTTP/1.0 200 OK" $RESULT] == 0 && |
| 1464 | - [string first "incorrect or missing password for user bob" $RESULT] >= 0} \ | |
| 1465 | - $::trunkMark | |
| 1448 | + [string first "incorrect or missing password for user bob" $RESULT] >= 0} | |
| 1466 | 1449 | fossil sql "DELETE FROM config WHERE name GLOB 'last-sync-*'" |
| 1467 | 1450 | |
| 1468 | 1451 | ############################################################################### |
| 1469 | 1452 | # Links that web pages build from their own query parameters. Each row |
| 1470 | 1453 | # is a page and regular expressions for links that the page must have. |
| @@ -1739,15 +1722,15 @@ | ||
| 1739 | 1722 | url_ssh [list $urlSshPull] pull ssh://hh/dir/r.fossil --once \ |
| 1740 | 1723 | --proxy http://127.0.0.1:1 |
| 1741 | 1724 | test url-ssh-proxy-not-used {$CODE == 0 && [url_ssh_runs] == 1 && |
| 1742 | 1725 | [string first "via proxy" $RESULT] < 0} |
| 1743 | 1726 | url_ssh [list] pull http://example.invalid/repo --once --proxy ssh://hh/x |
| 1744 | - test url-ssh-proxy-is-ssh-url {[url_ssh_runs] == 0} $::trunkMark | |
| 1727 | + test url-ssh-proxy-is-ssh-url {[url_ssh_runs] == 0} | |
| 1745 | 1728 | |
| 1746 | 1729 | set env(PATH) $urlSavedPath |
| 1747 | 1730 | unset env(URL_SSH_DIR) |
| 1748 | 1731 | } |
| 1749 | 1732 | |
| 1750 | 1733 | ############################################################################### |
| 1751 | 1734 | |
| 1752 | 1735 | array set env [array get urlSavedEnv] |
| 1753 | 1736 | test_cleanup |
| 1754 | 1737 |
| --- test/url.test | |
| +++ test/url.test | |
| @@ -35,11 +35,10 @@ | |
| 35 | unset env($urlVar) |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | test_setup |
| 40 | source [file join $::testfiledir trunk-fixes.tcl] |
| 41 | set urlRepo [file join [pwd] .rep.fossil] |
| 42 | set urlDir [pwd] |
| 43 | |
| 44 | ############################################################################### |
| 45 | # The parts of a URL. |
| @@ -220,12 +219,11 @@ | |
| 220 | port-letters http://h:80x/ {url missing '/' after port number} |
| 221 | port-ipv6-junk {http://[::1]:8x} {url missing '/' after port number} |
| 222 | } { |
| 223 | fossil_raw test-urlparser $urlText --proxy off |
| 224 | test url-parse-refused-$urlName \ |
| 225 | {$CODE == 1 && [string first $urlMessage $RESULT] >= 0} \ |
| 226 | [trunk_mark $urlName {port-too-large port-huge}] |
| 227 | } |
| 228 | |
| 229 | # An ssh: URL with a host and no path has an empty path, and fossil |
| 230 | # prints nothing but the parts of the URL. |
| 231 | # |
| @@ -240,33 +238,28 @@ | |
| 240 | user-host-port ssh://u@h:2222 |
| 241 | {isSsh 1 name h port 2222 path {} canonical ssh://u@h:2222} |
| 242 | scheme-only ssh:// |
| 243 | {isSsh 1 name {} path {} canonical ssh://} |
| 244 | } { |
| 245 | url_parse_test url-parse-ssh-no-path-$urlName $urlText {} $urlExpected \ |
| 246 | [sanitizer_trunk_mark $urlName \ |
| 247 | {host user-host host-port user-host-port scheme-only}] |
| 248 | test url-parse-ssh-no-path-$urlName-output {$CODE == 0 && |
| 249 | [regexp -all -line {^(g\.url\.\w+ +|url_full\(g\.url\) )= } $RESULT] == |
| 250 | [llength [split [string trim $RESULT] \n]]} \ |
| 251 | [sanitizer_trunk_mark $urlName \ |
| 252 | {host user-host host-port user-host-port scheme-only}] |
| 253 | } |
| 254 | |
| 255 | # The complete URL of an ssh: remote has the "/" between the host and |
| 256 | # the path. |
| 257 | # |
| 258 | url_parse_test url-parse-ssh-full ssh://u@h/dir/r.fossil {} \ |
| 259 | {full ssh://u@h/dir/r.fossil} $::trunkMark |
| 260 | |
| 261 | # A second fossil= parameter is refused. |
| 262 | # |
| 263 | fossil_raw test-urlparser ssh://h/r.fossil?fossil=/a/fossil&fossil=/b/fossil \ |
| 264 | --proxy off |
| 265 | test url-parse-ssh-fossil-twice {$CODE == 1 && |
| 266 | [string match "*more than one fossil= query parameter*" $RESULT]} \ |
| 267 | $::trunkMark |
| 268 | |
| 269 | # A very long user name, password, host and path. The four together stay |
| 270 | # under the 128 KB that Linux allows for one argument. |
| 271 | # |
| 272 | set urlLong [string repeat a 30000] |
| @@ -778,21 +771,20 @@ | |
| 778 | status-401 "HTTP/1.1 401 Unauthorized\n\n" \ |
| 779 | {server says: 401 Unauthorized} \ |
| 780 | ] { |
| 781 | url_httpmsg [list [url_crlf $urlReply]] -v |
| 782 | test_match url-http-refused-$urlName "$CODE $RESULT" \ |
| 783 | "^1 (?:.*\n)*.*$urlMessage" [trunk_mark $urlName redirect-to-bad-port] |
| 784 | url_httpmsg [list [url_crlf $urlReply]] |
| 785 | test url-http-refused-quiet-$urlName {$CODE == 1} \ |
| 786 | [trunk_mark $urlName redirect-to-bad-port] |
| 787 | } |
| 788 | |
| 789 | # A redirect to an ssh: URL with no path is refused. |
| 790 | # |
| 791 | url_httpmsg [list [url_crlf "HTTP/1.1 302 Found\nLocation: ssh://h\n\n"]] -v |
| 792 | test_match url-http-refused-redirect-to-ssh-no-path "$CODE $RESULT" \ |
| 793 | {^1 (?:.*\n)*.*cannot redirect to ssh://h} [sanitizer_trunk_mark] |
| 794 | |
| 795 | # A status line that test-httpmsg prints an error for without -v only |
| 796 | # when it is not told to be quiet: it is quiet when it prints the reply |
| 797 | # on standard output, and it is not when the reply goes to a file. |
| 798 | # |
| @@ -809,15 +801,10 @@ | |
| 809 | file delete out.txt |
| 810 | url_httpmsg [list [url_crlf $urlReply]] --out out.txt |
| 811 | test url-http-message-$urlName \ |
| 812 | {$CODE == 1 && [string first $urlMessage $RESULT] >= 0} |
| 813 | url_httpmsg [list [url_crlf $urlReply]] |
| 814 | if {$urlName eq "redirect-to-file" && $::sanitizerBuild} { |
| 815 | test_skip_part "url-http-message-quiet-redirect-to-file: a sanitizer\ |
| 816 | reports the fault that 71f60497bb fixes, which is not on trunk" |
| 817 | continue |
| 818 | } |
| 819 | test url-http-message-quiet-$urlName {$CODE == 1 && $RESULT eq ""} |
| 820 | } |
| 821 | |
| 822 | # A reply that is shorter than its Content-Length is an error, and only |
| 823 | # the bytes that came are printed. |
| @@ -826,11 +813,11 @@ | |
| 826 | file delete out.txt |
| 827 | url_httpmsg [list $urlShort] --out out.txt |
| 828 | test url-http-message-truncated {$CODE == 1 && |
| 829 | [string first "response truncated: got 5 bytes of 6" $RESULT] >= 0} |
| 830 | url_httpmsg [list $urlShort] |
| 831 | test url-http-truncated-bytes {$RESULT eq "hello"} $::trunkMark |
| 832 | |
| 833 | # A redirect is followed three times, with the same method and payload, |
| 834 | # and the fourth is refused. 301, 302, 307 and 308 are followed. A |
| 835 | # Location that ends in /xfer is used without that ending. |
| 836 | # |
| @@ -1173,12 +1160,11 @@ | |
| 1173 | payload.txt --xfer {*}$args |
| 1174 | test_listen_stop |
| 1175 | } |
| 1176 | url_xfer_reply text/html "<p>no <b>such</b> page</p>" -v |
| 1177 | test url-xfer-error-verbose {$CODE == 1 && |
| 1178 | [string first "server sends error: no such page" $RESULT] >= 0} \ |
| 1179 | $::trunkMark |
| 1180 | url_xfer_reply text/html "plain text, no tags" -v |
| 1181 | test url-xfer-error-plain-text {$CODE == 1 && |
| 1182 | [string first "server sends error: plain text, no tags" $RESULT] >= 0} |
| 1183 | url_xfer_reply text/html "cut short <b" -v |
| 1184 | test url-xfer-error-open-tag {$CODE == 1 && |
| @@ -1263,20 +1249,19 @@ | |
| 1263 | url_sync pull http://example.invalid/repo [list \ |
| 1264 | [url_crlf "HTTP/1.1 302 Found\nLocation: http://127.0.0.1:PORT/moved\n\n"] \ |
| 1265 | $urlNotFound] --once --proxy http://127.0.0.1:PORT |
| 1266 | test url-sync-proxy-redirect {[llength $urlRequests] == 2 && |
| 1267 | [string match "POST http://127.0.0.1:*/moved HTTP/1.1" \ |
| 1268 | [url_request_line 1]]} $::trunkMark |
| 1269 | |
| 1270 | # A proxy is an http: or https: URL. With any other value fossil must |
| 1271 | # not talk to the repository that the value names in place of the |
| 1272 | # remote. |
| 1273 | # |
| 1274 | fossil_raw -seconds 60 clone http://example.invalid/repo proxyclone.fossil \ |
| 1275 | --proxy file://$urlRepo |
| 1276 | test url-sync-proxy-file {$CODE == 1 && ![file exists proxyclone.fossil]} \ |
| 1277 | $::trunkMark |
| 1278 | file delete proxyclone.fossil |
| 1279 | |
| 1280 | # A pull through a proxy remembers the URL of the remote, not of the |
| 1281 | # proxy. A proxy is not used for a file: URL. |
| 1282 | # |
| @@ -1406,12 +1391,11 @@ | |
| 1406 | --httptrace |
| 1407 | test url-sync-clone-httptrace-no-reply {$CODE == 1 && |
| 1408 | ![file exists traceclone.fossil] && |
| 1409 | [string first "cannot connect to host 127.0.0.1:$urlPort" $RESULT] >= 0} |
| 1410 | test url-sync-clone-httptrace-no-reply-message \ |
| 1411 | {[string first "server returned an error - clone aborted" $RESULT] >= 0} \ |
| 1412 | $::trunkMark |
| 1413 | file delete {*}[glob -nocomplain http-request-*.txt http-reply-*.txt] |
| 1414 | |
| 1415 | # --transport-command with --httptrace prints the command. A command |
| 1416 | # that fails, or writes no reply, is an error. |
| 1417 | # |
| @@ -1459,12 +1443,11 @@ | |
| 1459 | url_config last-sync-url 'http://[email protected]:$urlPort/repo' |
| 1460 | fossil_raw -seconds 60 http --in xfersetup.txt --ipaddr 127.0.0.1 $urlRepo \ |
| 1461 | --localauth |
| 1462 | test_listen_stop |
| 1463 | test url-web-sync-no-password {[string first "HTTP/1.0 200 OK" $RESULT] == 0 && |
| 1464 | [string first "incorrect or missing password for user bob" $RESULT] >= 0} \ |
| 1465 | $::trunkMark |
| 1466 | fossil sql "DELETE FROM config WHERE name GLOB 'last-sync-*'" |
| 1467 | |
| 1468 | ############################################################################### |
| 1469 | # Links that web pages build from their own query parameters. Each row |
| 1470 | # is a page and regular expressions for links that the page must have. |
| @@ -1739,15 +1722,15 @@ | |
| 1739 | url_ssh [list $urlSshPull] pull ssh://hh/dir/r.fossil --once \ |
| 1740 | --proxy http://127.0.0.1:1 |
| 1741 | test url-ssh-proxy-not-used {$CODE == 0 && [url_ssh_runs] == 1 && |
| 1742 | [string first "via proxy" $RESULT] < 0} |
| 1743 | url_ssh [list] pull http://example.invalid/repo --once --proxy ssh://hh/x |
| 1744 | test url-ssh-proxy-is-ssh-url {[url_ssh_runs] == 0} $::trunkMark |
| 1745 | |
| 1746 | set env(PATH) $urlSavedPath |
| 1747 | unset env(URL_SSH_DIR) |
| 1748 | } |
| 1749 | |
| 1750 | ############################################################################### |
| 1751 | |
| 1752 | array set env [array get urlSavedEnv] |
| 1753 | test_cleanup |
| 1754 |
| --- test/url.test | |
| +++ test/url.test | |
| @@ -35,11 +35,10 @@ | |
| 35 | unset env($urlVar) |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | test_setup |
| 40 | set urlRepo [file join [pwd] .rep.fossil] |
| 41 | set urlDir [pwd] |
| 42 | |
| 43 | ############################################################################### |
| 44 | # The parts of a URL. |
| @@ -220,12 +219,11 @@ | |
| 219 | port-letters http://h:80x/ {url missing '/' after port number} |
| 220 | port-ipv6-junk {http://[::1]:8x} {url missing '/' after port number} |
| 221 | } { |
| 222 | fossil_raw test-urlparser $urlText --proxy off |
| 223 | test url-parse-refused-$urlName \ |
| 224 | {$CODE == 1 && [string first $urlMessage $RESULT] >= 0} |
| 225 | } |
| 226 | |
| 227 | # An ssh: URL with a host and no path has an empty path, and fossil |
| 228 | # prints nothing but the parts of the URL. |
| 229 | # |
| @@ -240,33 +238,28 @@ | |
| 238 | user-host-port ssh://u@h:2222 |
| 239 | {isSsh 1 name h port 2222 path {} canonical ssh://u@h:2222} |
| 240 | scheme-only ssh:// |
| 241 | {isSsh 1 name {} path {} canonical ssh://} |
| 242 | } { |
| 243 | url_parse_test url-parse-ssh-no-path-$urlName $urlText {} $urlExpected |
| 244 | test url-parse-ssh-no-path-$urlName-output {$CODE == 0 && |
| 245 | [regexp -all -line {^(g\.url\.\w+ +|url_full\(g\.url\) )= } $RESULT] == |
| 246 | [llength [split [string trim $RESULT] \n]]} |
| 247 | } |
| 248 | |
| 249 | # The complete URL of an ssh: remote has the "/" between the host and |
| 250 | # the path. |
| 251 | # |
| 252 | url_parse_test url-parse-ssh-full ssh://u@h/dir/r.fossil {} \ |
| 253 | {full ssh://u@h/dir/r.fossil} |
| 254 | |
| 255 | # A second fossil= parameter is refused. |
| 256 | # |
| 257 | fossil_raw test-urlparser ssh://h/r.fossil?fossil=/a/fossil&fossil=/b/fossil \ |
| 258 | --proxy off |
| 259 | test url-parse-ssh-fossil-twice {$CODE == 1 && |
| 260 | [string match "*more than one fossil= query parameter*" $RESULT]} |
| 261 | |
| 262 | # A very long user name, password, host and path. The four together stay |
| 263 | # under the 128 KB that Linux allows for one argument. |
| 264 | # |
| 265 | set urlLong [string repeat a 30000] |
| @@ -778,21 +771,20 @@ | |
| 771 | status-401 "HTTP/1.1 401 Unauthorized\n\n" \ |
| 772 | {server says: 401 Unauthorized} \ |
| 773 | ] { |
| 774 | url_httpmsg [list [url_crlf $urlReply]] -v |
| 775 | test_match url-http-refused-$urlName "$CODE $RESULT" \ |
| 776 | "^1 (?:.*\n)*.*$urlMessage" |
| 777 | url_httpmsg [list [url_crlf $urlReply]] |
| 778 | test url-http-refused-quiet-$urlName {$CODE == 1} |
| 779 | } |
| 780 | |
| 781 | # A redirect to an ssh: URL with no path is refused. |
| 782 | # |
| 783 | url_httpmsg [list [url_crlf "HTTP/1.1 302 Found\nLocation: ssh://h\n\n"]] -v |
| 784 | test_match url-http-refused-redirect-to-ssh-no-path "$CODE $RESULT" \ |
| 785 | {^1 (?:.*\n)*.*cannot redirect to ssh://h} |
| 786 | |
| 787 | # A status line that test-httpmsg prints an error for without -v only |
| 788 | # when it is not told to be quiet: it is quiet when it prints the reply |
| 789 | # on standard output, and it is not when the reply goes to a file. |
| 790 | # |
| @@ -809,15 +801,10 @@ | |
| 801 | file delete out.txt |
| 802 | url_httpmsg [list [url_crlf $urlReply]] --out out.txt |
| 803 | test url-http-message-$urlName \ |
| 804 | {$CODE == 1 && [string first $urlMessage $RESULT] >= 0} |
| 805 | url_httpmsg [list [url_crlf $urlReply]] |
| 806 | test url-http-message-quiet-$urlName {$CODE == 1 && $RESULT eq ""} |
| 807 | } |
| 808 | |
| 809 | # A reply that is shorter than its Content-Length is an error, and only |
| 810 | # the bytes that came are printed. |
| @@ -826,11 +813,11 @@ | |
| 813 | file delete out.txt |
| 814 | url_httpmsg [list $urlShort] --out out.txt |
| 815 | test url-http-message-truncated {$CODE == 1 && |
| 816 | [string first "response truncated: got 5 bytes of 6" $RESULT] >= 0} |
| 817 | url_httpmsg [list $urlShort] |
| 818 | test url-http-truncated-bytes {$RESULT eq "hello"} |
| 819 | |
| 820 | # A redirect is followed three times, with the same method and payload, |
| 821 | # and the fourth is refused. 301, 302, 307 and 308 are followed. A |
| 822 | # Location that ends in /xfer is used without that ending. |
| 823 | # |
| @@ -1173,12 +1160,11 @@ | |
| 1160 | payload.txt --xfer {*}$args |
| 1161 | test_listen_stop |
| 1162 | } |
| 1163 | url_xfer_reply text/html "<p>no <b>such</b> page</p>" -v |
| 1164 | test url-xfer-error-verbose {$CODE == 1 && |
| 1165 | [string first "server sends error: no such page" $RESULT] >= 0} |
| 1166 | url_xfer_reply text/html "plain text, no tags" -v |
| 1167 | test url-xfer-error-plain-text {$CODE == 1 && |
| 1168 | [string first "server sends error: plain text, no tags" $RESULT] >= 0} |
| 1169 | url_xfer_reply text/html "cut short <b" -v |
| 1170 | test url-xfer-error-open-tag {$CODE == 1 && |
| @@ -1263,20 +1249,19 @@ | |
| 1249 | url_sync pull http://example.invalid/repo [list \ |
| 1250 | [url_crlf "HTTP/1.1 302 Found\nLocation: http://127.0.0.1:PORT/moved\n\n"] \ |
| 1251 | $urlNotFound] --once --proxy http://127.0.0.1:PORT |
| 1252 | test url-sync-proxy-redirect {[llength $urlRequests] == 2 && |
| 1253 | [string match "POST http://127.0.0.1:*/moved HTTP/1.1" \ |
| 1254 | [url_request_line 1]]} |
| 1255 | |
| 1256 | # A proxy is an http: or https: URL. With any other value fossil must |
| 1257 | # not talk to the repository that the value names in place of the |
| 1258 | # remote. |
| 1259 | # |
| 1260 | fossil_raw -seconds 60 clone http://example.invalid/repo proxyclone.fossil \ |
| 1261 | --proxy file://$urlRepo |
| 1262 | test url-sync-proxy-file {$CODE == 1 && ![file exists proxyclone.fossil]} |
| 1263 | file delete proxyclone.fossil |
| 1264 | |
| 1265 | # A pull through a proxy remembers the URL of the remote, not of the |
| 1266 | # proxy. A proxy is not used for a file: URL. |
| 1267 | # |
| @@ -1406,12 +1391,11 @@ | |
| 1391 | --httptrace |
| 1392 | test url-sync-clone-httptrace-no-reply {$CODE == 1 && |
| 1393 | ![file exists traceclone.fossil] && |
| 1394 | [string first "cannot connect to host 127.0.0.1:$urlPort" $RESULT] >= 0} |
| 1395 | test url-sync-clone-httptrace-no-reply-message \ |
| 1396 | {[string first "server returned an error - clone aborted" $RESULT] >= 0} |
| 1397 | file delete {*}[glob -nocomplain http-request-*.txt http-reply-*.txt] |
| 1398 | |
| 1399 | # --transport-command with --httptrace prints the command. A command |
| 1400 | # that fails, or writes no reply, is an error. |
| 1401 | # |
| @@ -1459,12 +1443,11 @@ | |
| 1443 | url_config last-sync-url 'http://[email protected]:$urlPort/repo' |
| 1444 | fossil_raw -seconds 60 http --in xfersetup.txt --ipaddr 127.0.0.1 $urlRepo \ |
| 1445 | --localauth |
| 1446 | test_listen_stop |
| 1447 | test url-web-sync-no-password {[string first "HTTP/1.0 200 OK" $RESULT] == 0 && |
| 1448 | [string first "incorrect or missing password for user bob" $RESULT] >= 0} |
| 1449 | fossil sql "DELETE FROM config WHERE name GLOB 'last-sync-*'" |
| 1450 | |
| 1451 | ############################################################################### |
| 1452 | # Links that web pages build from their own query parameters. Each row |
| 1453 | # is a page and regular expressions for links that the page must have. |
| @@ -1739,15 +1722,15 @@ | |
| 1722 | url_ssh [list $urlSshPull] pull ssh://hh/dir/r.fossil --once \ |
| 1723 | --proxy http://127.0.0.1:1 |
| 1724 | test url-ssh-proxy-not-used {$CODE == 0 && [url_ssh_runs] == 1 && |
| 1725 | [string first "via proxy" $RESULT] < 0} |
| 1726 | url_ssh [list] pull http://example.invalid/repo --once --proxy ssh://hh/x |
| 1727 | test url-ssh-proxy-is-ssh-url {[url_ssh_runs] == 0} |
| 1728 | |
| 1729 | set env(PATH) $urlSavedPath |
| 1730 | unset env(URL_SSH_DIR) |
| 1731 | } |
| 1732 | |
| 1733 | ############################################################################### |
| 1734 | |
| 1735 | array set env [array get urlSavedEnv] |
| 1736 | test_cleanup |
| 1737 |
+1
-3
| --- test/xfer-client.test | ||
| +++ test/xfer-client.test | ||
| @@ -16,11 +16,10 @@ | ||
| 16 | 16 | if {$::tcl_platform(platform) eq "windows"} { |
| 17 | 17 | test_skip "the stand-in for a server is a shell script" |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | test_setup |
| 21 | -source [file join $::testfiledir trunk-fixes.tcl] | |
| 22 | 21 | |
| 23 | 22 | write_file a.txt "hello world\n" |
| 24 | 23 | fossil add a.txt |
| 25 | 24 | fossil commit -m one --no-warnings |
| 26 | 25 | fossil sha3sum a.txt |
| @@ -411,12 +410,11 @@ | ||
| 411 | 410 | ] { |
| 412 | 411 | fossil sql "DELETE FROM config WHERE name LIKE 'link:%'" |
| 413 | 412 | xferclient_run pull $xferclientCard --share-links |
| 414 | 413 | fossil sql "SELECT count(*) FROM config WHERE name LIKE 'link:%'" |
| 415 | 414 | test_eq xfer-client-mcdc-link-$xferclientName \ |
| 416 | - "$xferclientCode [string trim $RESULT]" "0 $xferclientKept" \ | |
| 417 | - [trunk_mark $xferclientName {ftp no-scheme}] | |
| 415 | + "$xferclientCode [string trim $RESULT]" "0 $xferclientKept" | |
| 418 | 416 | } |
| 419 | 417 | |
| 420 | 418 | ############################################################################### |
| 421 | 419 | # A "private" card makes the next file private. A client that does not sync |
| 422 | 420 | # private content ignores that file, whatever its content; one that does |
| 423 | 421 |
| --- test/xfer-client.test | |
| +++ test/xfer-client.test | |
| @@ -16,11 +16,10 @@ | |
| 16 | if {$::tcl_platform(platform) eq "windows"} { |
| 17 | test_skip "the stand-in for a server is a shell script" |
| 18 | } |
| 19 | |
| 20 | test_setup |
| 21 | source [file join $::testfiledir trunk-fixes.tcl] |
| 22 | |
| 23 | write_file a.txt "hello world\n" |
| 24 | fossil add a.txt |
| 25 | fossil commit -m one --no-warnings |
| 26 | fossil sha3sum a.txt |
| @@ -411,12 +410,11 @@ | |
| 411 | ] { |
| 412 | fossil sql "DELETE FROM config WHERE name LIKE 'link:%'" |
| 413 | xferclient_run pull $xferclientCard --share-links |
| 414 | fossil sql "SELECT count(*) FROM config WHERE name LIKE 'link:%'" |
| 415 | test_eq xfer-client-mcdc-link-$xferclientName \ |
| 416 | "$xferclientCode [string trim $RESULT]" "0 $xferclientKept" \ |
| 417 | [trunk_mark $xferclientName {ftp no-scheme}] |
| 418 | } |
| 419 | |
| 420 | ############################################################################### |
| 421 | # A "private" card makes the next file private. A client that does not sync |
| 422 | # private content ignores that file, whatever its content; one that does |
| 423 |
| --- test/xfer-client.test | |
| +++ test/xfer-client.test | |
| @@ -16,11 +16,10 @@ | |
| 16 | if {$::tcl_platform(platform) eq "windows"} { |
| 17 | test_skip "the stand-in for a server is a shell script" |
| 18 | } |
| 19 | |
| 20 | test_setup |
| 21 | |
| 22 | write_file a.txt "hello world\n" |
| 23 | fossil add a.txt |
| 24 | fossil commit -m one --no-warnings |
| 25 | fossil sha3sum a.txt |
| @@ -411,12 +410,11 @@ | |
| 410 | ] { |
| 411 | fossil sql "DELETE FROM config WHERE name LIKE 'link:%'" |
| 412 | xferclient_run pull $xferclientCard --share-links |
| 413 | fossil sql "SELECT count(*) FROM config WHERE name LIKE 'link:%'" |
| 414 | test_eq xfer-client-mcdc-link-$xferclientName \ |
| 415 | "$xferclientCode [string trim $RESULT]" "0 $xferclientKept" |
| 416 | } |
| 417 | |
| 418 | ############################################################################### |
| 419 | # A "private" card makes the next file private. A client that does not sync |
| 420 | # private content ignores that file, whatever its content; one that does |
| 421 |
+6
-8
| --- test/xfer-server.test | ||
| +++ test/xfer-server.test | ||
| @@ -12,11 +12,10 @@ | ||
| 12 | 12 | # The first sections run at every level, and the rest need |
| 13 | 13 | # -assurance stress. |
| 14 | 14 | require_no_open_checkout |
| 15 | 15 | |
| 16 | 16 | test_setup |
| 17 | -source [file join $::testfiledir trunk-fixes.tcl] | |
| 18 | 17 | |
| 19 | 18 | write_file a.txt "hello world\n" |
| 20 | 19 | fossil add a.txt |
| 21 | 20 | fossil commit -m one --no-warnings |
| 22 | 21 | fossil sha3sum a.txt |
| @@ -202,14 +201,13 @@ | ||
| 202 | 201 | {[xferserver_count \ |
| 203 | 202 | "config WHERE name GLOB 'syncfrom:*example.org*'"] == 1} |
| 204 | 203 | # A client URL that is not http or https is ignored and the request goes |
| 205 | 204 | # on; it is not read as a path on the server. |
| 206 | 205 | foreach {xferserverName xferserverUrl} {ftp ftp://example.org/y path /} { |
| 207 | - xferserver_send "${xferserverPush}pragma client-url $xferserverUrl\n" | |
| 208 | - test xfer-server-write-client-url-$xferserverName {$::CODE == 0 && | |
| 209 | - [holds_strings $::RESULT {{!unknown repository} {errors 0}}]} \ | |
| 210 | - $::trunkMark | |
| 206 | + xferserver_expect write-client-url-$xferserverName \ | |
| 207 | + "${xferserverPush}pragma client-url $xferserverUrl\n" \ | |
| 208 | + "!unknown repository" "errors 0" | |
| 211 | 209 | } |
| 212 | 210 | |
| 213 | 211 | # A first word that has the length of a card name and is not it selects no |
| 214 | 212 | # card. A pragma with a name of the length of a known one that is not it |
| 215 | 213 | # does nothing. |
| @@ -440,16 +438,16 @@ | ||
| 440 | 438 | xferserver_set gitpush:https://git.example.org/someone/mirror.git "{}" |
| 441 | 439 | xferserver_set gitpush:[email protected]:someone/other.git "{}" |
| 442 | 440 | xferserver_set gitpush:[email protected]:someone/other.git "{}" |
| 443 | 441 | xferserver_send "${xferserverPull}pragma req-links\n" |
| 444 | 442 | test xfer-server-read-req-links-git-address \ |
| 445 | - {$CODE == 0 && [string first "errors 0" $RESULT] >= 0} $::trunkMark | |
| 443 | + {$CODE == 0 && [string first "errors 0" $RESULT] >= 0} | |
| 446 | 444 | test xfer-server-read-req-links-git-https \ |
| 447 | 445 | {[string match "*pragma link https://git.example.org/someone/mirror.git*" \ |
| 448 | - $RESULT]} $::trunkMark | |
| 446 | + $RESULT]} | |
| 449 | 447 | test xfer-server-read-req-links-git-other-left-out \ |
| 450 | - {![string match "*other.git*" $RESULT]} $::trunkMark | |
| 448 | + {![string match "*other.git*" $RESULT]} | |
| 451 | 449 | xferserver_unset gitpush:* |
| 452 | 450 | |
| 453 | 451 | # The address configuration is given only to a client that may read |
| 454 | 452 | # addresses. |
| 455 | 453 | xferserver_caps "oe" |
| 456 | 454 |
| --- test/xfer-server.test | |
| +++ test/xfer-server.test | |
| @@ -12,11 +12,10 @@ | |
| 12 | # The first sections run at every level, and the rest need |
| 13 | # -assurance stress. |
| 14 | require_no_open_checkout |
| 15 | |
| 16 | test_setup |
| 17 | source [file join $::testfiledir trunk-fixes.tcl] |
| 18 | |
| 19 | write_file a.txt "hello world\n" |
| 20 | fossil add a.txt |
| 21 | fossil commit -m one --no-warnings |
| 22 | fossil sha3sum a.txt |
| @@ -202,14 +201,13 @@ | |
| 202 | {[xferserver_count \ |
| 203 | "config WHERE name GLOB 'syncfrom:*example.org*'"] == 1} |
| 204 | # A client URL that is not http or https is ignored and the request goes |
| 205 | # on; it is not read as a path on the server. |
| 206 | foreach {xferserverName xferserverUrl} {ftp ftp://example.org/y path /} { |
| 207 | xferserver_send "${xferserverPush}pragma client-url $xferserverUrl\n" |
| 208 | test xfer-server-write-client-url-$xferserverName {$::CODE == 0 && |
| 209 | [holds_strings $::RESULT {{!unknown repository} {errors 0}}]} \ |
| 210 | $::trunkMark |
| 211 | } |
| 212 | |
| 213 | # A first word that has the length of a card name and is not it selects no |
| 214 | # card. A pragma with a name of the length of a known one that is not it |
| 215 | # does nothing. |
| @@ -440,16 +438,16 @@ | |
| 440 | xferserver_set gitpush:https://git.example.org/someone/mirror.git "{}" |
| 441 | xferserver_set gitpush:[email protected]:someone/other.git "{}" |
| 442 | xferserver_set gitpush:[email protected]:someone/other.git "{}" |
| 443 | xferserver_send "${xferserverPull}pragma req-links\n" |
| 444 | test xfer-server-read-req-links-git-address \ |
| 445 | {$CODE == 0 && [string first "errors 0" $RESULT] >= 0} $::trunkMark |
| 446 | test xfer-server-read-req-links-git-https \ |
| 447 | {[string match "*pragma link https://git.example.org/someone/mirror.git*" \ |
| 448 | $RESULT]} $::trunkMark |
| 449 | test xfer-server-read-req-links-git-other-left-out \ |
| 450 | {![string match "*other.git*" $RESULT]} $::trunkMark |
| 451 | xferserver_unset gitpush:* |
| 452 | |
| 453 | # The address configuration is given only to a client that may read |
| 454 | # addresses. |
| 455 | xferserver_caps "oe" |
| 456 |
| --- test/xfer-server.test | |
| +++ test/xfer-server.test | |
| @@ -12,11 +12,10 @@ | |
| 12 | # The first sections run at every level, and the rest need |
| 13 | # -assurance stress. |
| 14 | require_no_open_checkout |
| 15 | |
| 16 | test_setup |
| 17 | |
| 18 | write_file a.txt "hello world\n" |
| 19 | fossil add a.txt |
| 20 | fossil commit -m one --no-warnings |
| 21 | fossil sha3sum a.txt |
| @@ -202,14 +201,13 @@ | |
| 201 | {[xferserver_count \ |
| 202 | "config WHERE name GLOB 'syncfrom:*example.org*'"] == 1} |
| 203 | # A client URL that is not http or https is ignored and the request goes |
| 204 | # on; it is not read as a path on the server. |
| 205 | foreach {xferserverName xferserverUrl} {ftp ftp://example.org/y path /} { |
| 206 | xferserver_expect write-client-url-$xferserverName \ |
| 207 | "${xferserverPush}pragma client-url $xferserverUrl\n" \ |
| 208 | "!unknown repository" "errors 0" |
| 209 | } |
| 210 | |
| 211 | # A first word that has the length of a card name and is not it selects no |
| 212 | # card. A pragma with a name of the length of a known one that is not it |
| 213 | # does nothing. |
| @@ -440,16 +438,16 @@ | |
| 438 | xferserver_set gitpush:https://git.example.org/someone/mirror.git "{}" |
| 439 | xferserver_set gitpush:[email protected]:someone/other.git "{}" |
| 440 | xferserver_set gitpush:[email protected]:someone/other.git "{}" |
| 441 | xferserver_send "${xferserverPull}pragma req-links\n" |
| 442 | test xfer-server-read-req-links-git-address \ |
| 443 | {$CODE == 0 && [string first "errors 0" $RESULT] >= 0} |
| 444 | test xfer-server-read-req-links-git-https \ |
| 445 | {[string match "*pragma link https://git.example.org/someone/mirror.git*" \ |
| 446 | $RESULT]} |
| 447 | test xfer-server-read-req-links-git-other-left-out \ |
| 448 | {![string match "*other.git*" $RESULT]} |
| 449 | xferserver_unset gitpush:* |
| 450 | |
| 451 | # The address configuration is given only to a client that may read |
| 452 | # addresses. |
| 453 | xferserver_caps "oe" |
| 454 |