tests/test-config.t
author Augie Fackler <augie@google.com>
Tue, 30 Jun 2015 19:19:17 -0400
changeset 25708 d3d32643c060
parent 23348 bbe56e07e07a
child 29412 b62bce819d0c
permissions -rw-r--r--
wireproto: correctly escape batched args and responses (issue4739) This issue appears to be as old as wireproto batching itself: I can reproduce the failure as far back as 08ef6b5f3715 trivially by rebasing the test changes in this patch, which was back in the 1.9 era. I didn't test before that change, because prior to that the testfile has a different name and I'm lazy. Note that the test thought it was checking this case, but it actually wasn't: it put a literal ; in the arg and response for its greet command, but the mangle/unmangle step defined in the test meant that instead of "Fo, =;o" going over the wire, "Gp-!><p" went instead, which doesn't contain any special characters (those being [.=;]) and thus not exercising the escaping. The test has been updated to use pre-unmangled special characters, so the request is now "Fo+<:o", which mangles to "Gp,=;p". I have confirmed that the test fails without the adjustment to the escaping rules in wireproto.py. No existing clients of RPC batching were depending on the old behavior in any way. The only *actual* users of batchable RPCs in core were: 1) largefiles, wherein it batches up many statlfile calls. It sends hexlified hashes over the wire and gets a 0, 1, or 2 back as a response. No risk of special characters. 2) setdiscovery, which was using heads() and known(), both of which communicate via hexlified nodes. Again, no risk of special characters. Since the escaping functionality has been completely broken since it was introduced, we know that it has no users. As such, we can change the escaping mechanism without having to worry about backwards compatibility issues. For the curious, this was detected by chance: it happens that the lz4-compressed text of a test file for remotefilelog compressed to something containing a ;, which then caused the failure when I moved remotefilelog to using batching for file content fetching.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17015
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 12082
diff changeset
     1
hide outer repo
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 12082
diff changeset
     2
  $ hg init
73d20de5f30b tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents: 12082
diff changeset
     3
22275
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
     4
Invalid syntax: no value
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
     5
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
     6
  $ cat > .hg/hgrc << EOF
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
     7
  > novaluekey
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
     8
  > EOF
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
     9
  $ hg showconfig
23348
bbe56e07e07a tests: fix globs for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 23172
diff changeset
    10
  hg: parse error at $TESTTMP/.hg/hgrc:1: novaluekey (glob)
22275
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    11
  [255]
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    12
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    13
Invalid syntax: no key
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    14
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    15
  $ cat > .hg/hgrc << EOF
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    16
  > =nokeyvalue
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    17
  > EOF
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    18
  $ hg showconfig
23348
bbe56e07e07a tests: fix globs for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 23172
diff changeset
    19
  hg: parse error at $TESTTMP/.hg/hgrc:1: =nokeyvalue (glob)
22275
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    20
  [255]
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    21
22276
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    22
Test hint about invalid syntax from leading white space
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    23
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    24
  $ cat > .hg/hgrc << EOF
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    25
  >  key=value
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    26
  > EOF
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    27
  $ hg showconfig
23348
bbe56e07e07a tests: fix globs for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 23172
diff changeset
    28
  hg: parse error at $TESTTMP/.hg/hgrc:1:  key=value (glob)
22276
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    29
  unexpected leading whitespace
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    30
  [255]
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    31
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    32
  $ cat > .hg/hgrc << EOF
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    33
  >  [section]
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    34
  > key=value
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    35
  > EOF
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    36
  $ hg showconfig
23348
bbe56e07e07a tests: fix globs for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 23172
diff changeset
    37
  hg: parse error at $TESTTMP/.hg/hgrc:1:  [section] (glob)
22276
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    38
  unexpected leading whitespace
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    39
  [255]
b13b99d39a46 config: highlight parse error caused by leading spaces (issue3214)
Razvan Cojocaru <razvan.cojocaru93@gmail.com>
parents: 22275
diff changeset
    40
22275
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    41
Reset hgrc
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    42
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    43
  $ echo > .hg/hgrc
d9a8017dce10 test-config: add tests for invalid syntax
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 19087
diff changeset
    44
19086
8fb8dce3f9b6 tests: rename from test-config-case.t to test-config.t for centralization
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17015
diff changeset
    45
Test case sensitive configuration
8fb8dce3f9b6 tests: rename from test-config-case.t to test-config.t for centralization
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17015
diff changeset
    46
23172
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22367
diff changeset
    47
  $ cat <<EOF >> $HGRCPATH
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22367
diff changeset
    48
  > [Section]
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22367
diff changeset
    49
  > KeY = Case Sensitive
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22367
diff changeset
    50
  > key = lower case
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22367
diff changeset
    51
  > EOF
3425
ec6f400cff4d Use a case-sensitive version of SafeConfigParser everywhere
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    52
12082
5e2216a35839 tests: unify test-config-case
Adrian Buehlmann <adrian@cadifra.com>
parents: 4528
diff changeset
    53
  $ hg showconfig Section
5e2216a35839 tests: unify test-config-case
Adrian Buehlmann <adrian@cadifra.com>
parents: 4528
diff changeset
    54
  Section.KeY=Case Sensitive
5e2216a35839 tests: unify test-config-case
Adrian Buehlmann <adrian@cadifra.com>
parents: 4528
diff changeset
    55
  Section.key=lower case
3425
ec6f400cff4d Use a case-sensitive version of SafeConfigParser everywhere
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    56
19087
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    57
Test "%unset"
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    58
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    59
  $ cat >> $HGRCPATH <<EOF
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    60
  > [unsettest]
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    61
  > local-hgrcpath = should be unset (HGRCPATH)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    62
  > %unset local-hgrcpath
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    63
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    64
  > global = should be unset (HGRCPATH)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    65
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    66
  > both = should be unset (HGRCPATH)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    67
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    68
  > set-after-unset = should be unset (HGRCPATH)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    69
  > EOF
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    70
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    71
  $ cat >> .hg/hgrc <<EOF
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    72
  > [unsettest]
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    73
  > local-hgrc = should be unset (.hg/hgrc)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    74
  > %unset local-hgrc
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    75
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    76
  > %unset global
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    77
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    78
  > both = should be unset (.hg/hgrc)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    79
  > %unset both
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    80
  > 
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    81
  > set-after-unset = should be unset (.hg/hgrc)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    82
  > %unset set-after-unset
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    83
  > set-after-unset = should be set (.hg/hgrc)
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    84
  > EOF
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    85
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    86
  $ hg showconfig unsettest
7d82ad4b3727 config: discard "%unset" values defined in the other files read in previously
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19086
diff changeset
    87
  unsettest.set-after-unset=should be set (.hg/hgrc)
22316
816be4ca4ae2 config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents: 19087
diff changeset
    88
816be4ca4ae2 config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents: 19087
diff changeset
    89
Test exit code when no config matches
816be4ca4ae2 config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents: 19087
diff changeset
    90
816be4ca4ae2 config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents: 19087
diff changeset
    91
  $ hg config Section.idontexist
816be4ca4ae2 config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents: 19087
diff changeset
    92
  [1]