tests/test-debugextensions.t
author Kyle Lippincott <spectral@google.com>
Wed, 27 Jan 2021 10:29:21 -0800
branchstable
changeset 46415 8deab876fb59
parent 37342 4e6a6d0dccee
child 49835 4836705ab9ba
permissions -rw-r--r--
wix: tell ComponentSearch that it is finding a directory (not a file) This is to fix an issue we've noticed where fresh installations start at `C:\Program Files\Mercurial`, and then upgrades "walk up" the tree and end up in `C:\Program Files` and finally `C:\` (where they stay). ComponentSearch defaults to finding files, which I think means "it produces a string like `C:\Program Files\Mercurial`", whereas with the type being explicitly a directory, it would return `C:\Program Files\Mercurial\` (note the final trailing backslash). Presumably, a latter step then tries to turn that file name into a proper directory, by removing everything after the last `\`. This could likely also be fixed by actually searching for the component for hg.exe itself. That seemed a lot more complicated, as the GUID for hg.exe isn't known in this file (it's one of the "auto-derived" ones). We could also consider adding a Condition that I think could check the Property and ensure it's either empty or ends in a trailing slash, but that would be an installer runtime check and I'm not convinced it'd actually be useful. This will *not* cause existing installations that are in one of the bad directories to fix themselves. Doing that would require a fair amount more understanding of wix and windows installer than I have, and it *probably* wouldn't be possible to be 100% correct about it either (there's nothing preventing a user from intentionally installing it in C:\, though I don't know why they would do so). If someone wants to tackle fixing existing installations, I think that the first installation is actually the only one that shows up in "Add or Remove Programs", and that its registry keys still exist. You might be able to find something under HKEY_USERS that lists both the "good" and the "bad" InstallDirs. Mine was under `HKEY_USERS\S-1-5-18\Software\Mercurial\InstallDir` (C:\), and `HKEY_USERS\S-1-5-21-..numbers..\Software\Mercurial\InstallDir` (C:\Program Files\Mercurial). If you find exactly two, with one being the default path, and the other being a prefix of it, the user almost certainly hit this bug :D We had originally thought that this bug might be due to unattended installations/upgrades, but I no longer think that's the case. We were able to reproduce the issue by uninstalling all copies of Mercurial I could find, installing one version (it chose the correct location), and then starting the installer for a different version (higher or lower didn't matter). I did not need to deal with an unattended or headless installation/upgrade to trigger the issue, but it's possible that my system was "primed" for this bug to happen because of a previous unattended installation/upgrade. Differential Revision: https://phab.mercurial-scm.org/D9891
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37342
4e6a6d0dccee tests: conditionalize tests based on presence of custom extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 36567
diff changeset
     1
#if no-extraextensions
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
     2
  $ hg debugextensions
37342
4e6a6d0dccee tests: conditionalize tests based on presence of custom extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 36567
diff changeset
     3
#endif
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
     4
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
     5
  $ debugpath=`pwd`/extwithoutinfos.py
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
     6
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
     7
  $ cat > extwithoutinfos.py <<EOF
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
     8
  > EOF
29891
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
     9
  $ cat > extwithinfos.py <<EOF
36567
19ec5da944d5 py3: add missing b prefixes in test-debugextensions.t
Augie Fackler <augie@google.com>
parents: 33525
diff changeset
    10
  > testedwith = b'3.0 3.1 3.2.1'
19ec5da944d5 py3: add missing b prefixes in test-debugextensions.t
Augie Fackler <augie@google.com>
parents: 33525
diff changeset
    11
  > buglink = b'https://example.org/bts'
29891
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
    12
  > EOF
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    13
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    14
  $ cat >> $HGRCPATH <<EOF
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    15
  > [extensions]
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    16
  > histedit=
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    17
  > patchbomb=
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    18
  > rebase=
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    19
  > mq=
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    20
  > ext1 = $debugpath
29891
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
    21
  > ext2 = `pwd`/extwithinfos.py
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    22
  > EOF
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    23
37342
4e6a6d0dccee tests: conditionalize tests based on presence of custom extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 36567
diff changeset
    24
  $ for extension in $HGTESTEXTRAEXTENSIONS; do
4e6a6d0dccee tests: conditionalize tests based on presence of custom extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 36567
diff changeset
    25
  >     echo "$extension=!" >> $HGRCPATH
4e6a6d0dccee tests: conditionalize tests based on presence of custom extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 36567
diff changeset
    26
  > done
4e6a6d0dccee tests: conditionalize tests based on presence of custom extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 36567
diff changeset
    27
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    28
  $ hg debugextensions
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    29
  ext1 (untested!)
29891
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
    30
  ext2 (3.2.1!)
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    31
  histedit
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    32
  mq
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    33
  patchbomb
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    34
  rebase
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    35
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    36
  $ hg debugextensions -v
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    37
  ext1
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
    38
    location: */extwithoutinfos.py* (glob)
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
    39
    bundled: no
29891
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
    40
  ext2
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
    41
    location: */extwithinfos.py* (glob)
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
    42
    bundled: no
29891
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
    43
    tested with: 3.0 3.1 3.2.1
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
    44
    bug reporting: https://example.org/bts
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    45
  histedit
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
    46
    location: */hgext/histedit.py* (glob)
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
    47
    bundled: yes
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    48
  mq
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
    49
    location: */hgext/mq.py* (glob)
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
    50
    bundled: yes
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    51
  patchbomb
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
    52
    location: */hgext/patchbomb.py* (glob)
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
    53
    bundled: yes
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    54
  rebase
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
    55
    location: */hgext/rebase.py* (glob)
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
    56
    bundled: yes
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    57
26430
1f8208a7277e test-debugextensions: sanitize JSON output for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 26351
diff changeset
    58
  $ hg debugextensions -Tjson | sed 's|\\\\|/|g'
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    59
  [
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    60
   {
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    61
    "buglink": "",
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
    62
    "bundled": false,
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    63
    "name": "ext1",
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
    64
    "source": "*/extwithoutinfos.py*", (glob)
29703
3ef9aa7ad1fc debugextension: change "testedwith" to a list (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 28615
diff changeset
    65
    "testedwith": []
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    66
   },
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    67
   {
29891
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
    68
    "buglink": "https://example.org/bts",
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
    69
    "bundled": false,
29891
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
    70
    "name": "ext2",
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
    71
    "source": "*/extwithinfos.py*", (glob)
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
    72
    "testedwith": ["3.0", "3.1", "3.2.1"]
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
    73
   },
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
    74
   {
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    75
    "buglink": "",
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
    76
    "bundled": true,
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    77
    "name": "histedit",
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
    78
    "source": "*/hgext/histedit.py*", (glob)
29893
4c28ddda5d48 debugextensions: hide "ships-with-hg-core" magic string (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 29892
diff changeset
    79
    "testedwith": []
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    80
   },
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    81
   {
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    82
    "buglink": "",
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
    83
    "bundled": true,
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    84
    "name": "mq",
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
    85
    "source": "*/hgext/mq.py*", (glob)
29893
4c28ddda5d48 debugextensions: hide "ships-with-hg-core" magic string (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 29892
diff changeset
    86
    "testedwith": []
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    87
   },
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    88
   {
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    89
    "buglink": "",
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
    90
    "bundled": true,
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    91
    "name": "patchbomb",
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
    92
    "source": "*/hgext/patchbomb.py*", (glob)
29893
4c28ddda5d48 debugextensions: hide "ships-with-hg-core" magic string (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 29892
diff changeset
    93
    "testedwith": []
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    94
   },
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    95
   {
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    96
    "buglink": "",
29892
b64eaf947632 debugextensions: show ships-with-hg-core state as a separate field
Yuya Nishihara <yuya@tcha.org>
parents: 29891
diff changeset
    97
    "bundled": true,
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
    98
    "name": "rebase",
28615
a6573503342d test-debugextensions: passes with byte-compilation disabled (issue5147)
Kevin Bullock <kbullock@ringworld.org>
parents: 26430
diff changeset
    99
    "source": "*/hgext/rebase.py*", (glob)
29893
4c28ddda5d48 debugextensions: hide "ships-with-hg-core" magic string (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 29892
diff changeset
   100
    "testedwith": []
26351
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
   101
   }
8c7d8d5e1e0f mercurial: add debugextensions command (issue4676)
liscju <piotr.listkiewicz@gmail.com>
parents:
diff changeset
   102
  ]
29703
3ef9aa7ad1fc debugextension: change "testedwith" to a list (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 28615
diff changeset
   103
29891
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
   104
  $ hg debugextensions -T '{ifcontains("3.1", testedwith, "{name}\n")}'
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
   105
  ext2
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
   106
  $ hg debugextensions \
ca6940515485 test-debugextensions: add dummy extension to make ifcontains() test more solid
Yuya Nishihara <yuya@tcha.org>
parents: 29703
diff changeset
   107
  > -T '{ifcontains("3.2", testedwith, "no substring match: {name}\n")}'