tests/test-mac-packages.t
author Simon Sapin <simon.sapin@octobus.net>
Fri, 21 Jan 2022 17:54:03 +0100
changeset 48745 94e36b230990
parent 33594 283a7da602ae
child 48988 8d7eaff92f9c
permissions -rw-r--r--
status: prefer relative paths in Rust code … when the repository root is under the current directory, so the kernel needs to traverse fewer directory in every call to `read_dir` or `symlink_metadata`. Better yet would be to use libc functions like `openat` and `fstatat` to remove such repeated traversals entirely, but the standard library does not provide APIs based on those. Maybe with a crate like https://crates.io/crates/openat instead? Benchmarks of `rhg status` show that this patch is neutral in some configurations, and makes the command up to ~20% faster in others. Below is semi-arbitrary subset of results. The four numeric columns are: time (in seconds) with this changeset’s parent, time with this changeset, time difference (negative is better), time ratio (less than 1 is better). ``` mercurial-dirstate-v1 | default-plain-clean.no-iu.pbr | 0.0061 -> 0.0059: -0.0002 (0.97) mercurial-dirstate-v2 | default-plain-clean.no-iu.pbr | 0.0029 -> 0.0028: -0.0001 (0.97) mozilla-dirstate-v1 | default-plain-clean.no-iu.pbr | 0.2110 -> 0.2102: -0.0007 (1.00) mozilla-dirstate-v2 | default-copies-clean.ignored.pbr | 0.0489 -> 0.0401: -0.0088 (0.82) mozilla-dirstate-v2 | default-copies-clean.no-iu.pbr | 0.0479 -> 0.0393: -0.0085 (0.82) mozilla-dirstate-v2 | default-copies-large.all.pbr | 0.1262 -> 0.1210: -0.0051 (0.96) mozilla-dirstate-v2 | default-copies-small.ignored-unknown.pbr | 0.1262 -> 0.1200: -0.0062 (0.95) mozilla-dirstate-v2 | default-copies-small.ignored.pbr | 0.0536 -> 0.0417: -0.0119 (0.78) mozilla-dirstate-v2 | default-copies-small.no-iu.pbr | 0.0482 -> 0.0393: -0.0089 (0.81) mozilla-dirstate-v2 | default-plain-clean.ignored.pbr | 0.0518 -> 0.0402: -0.0116 (0.78) mozilla-dirstate-v2 | default-plain-clean.no-iu.pbr | 0.0481 -> 0.0392: -0.0088 (0.82) mozilla-dirstate-v2 | default-plain-large.all.pbr | 0.1271 -> 0.1218: -0.0052 (0.96) mozilla-dirstate-v2 | default-plain-small.ignored-unknown.pbr | 0.1225 -> 0.1202: -0.0022 (0.98) mozilla-dirstate-v2 | default-plain-small.ignored.pbr | 0.0510 -> 0.0418: -0.0092 (0.82) mozilla-dirstate-v2 | default-plain-small.no-iu.pbr | 0.0480 -> 0.0394: -0.0086 (0.82) netbeans-dirstate-v1 | default-plain-clean.no-iu.pbr | 0.1442 -> 0.1422: -0.0020 (0.99) netbeans-dirstate-v2 | default-plain-clean.no-iu.pbr | 0.0325 -> 0.0282: -0.0043 (0.87) ``` Differential Revision: https://phab.mercurial-scm.org/D12175
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29027
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
     1
#require test-repo slow osx osxpackaging
29219
3c9066ed557c tests: silence test-repo obsolete warning
timeless <timeless@mozdev.org>
parents: 29027
diff changeset
     2
3c9066ed557c tests: silence test-repo obsolete warning
timeless <timeless@mozdev.org>
parents: 29027
diff changeset
     3
  $ . "$TESTDIR/helpers-testrepo.sh"
33204
ddd65b4f3ae6 tests: alias syshg and syshgenv so they can be switched conditionally
Yuya Nishihara <yuya@tcha.org>
parents: 33116
diff changeset
     4
  $ testrepohgenv
29219
3c9066ed557c tests: silence test-repo obsolete warning
timeless <timeless@mozdev.org>
parents: 29027
diff changeset
     5
31610
6dc8caccef8a osx: use more paranoid quoting in test
Augie Fackler <augie@google.com>
parents: 31609
diff changeset
     6
  $ OUTPUTDIR="`pwd`"
29025
f2549b0ba9ab tests: add test for Mac OS X package construction
Augie Fackler <augie@google.com>
parents:
diff changeset
     7
  $ export OUTPUTDIR
f2549b0ba9ab tests: add test for Mac OS X package construction
Augie Fackler <augie@google.com>
parents:
diff changeset
     8
  $ KEEPMPKG=yes
f2549b0ba9ab tests: add test for Mac OS X package construction
Augie Fackler <augie@google.com>
parents:
diff changeset
     9
  $ export KEEPMPKG
f2549b0ba9ab tests: add test for Mac OS X package construction
Augie Fackler <augie@google.com>
parents:
diff changeset
    10
f2549b0ba9ab tests: add test for Mac OS X package construction
Augie Fackler <augie@google.com>
parents:
diff changeset
    11
  $ cd "$TESTDIR"/..
33594
283a7da602ae osx: new script for generating OS X package versions
Augie Fackler <augie@google.com>
parents: 33593
diff changeset
    12
  $ contrib/genosxversion.py --selftest ignoredarg
31610
6dc8caccef8a osx: use more paranoid quoting in test
Augie Fackler <augie@google.com>
parents: 31609
diff changeset
    13
  $ make osx > "$OUTPUTDIR/build.log" 2>&1
6dc8caccef8a osx: use more paranoid quoting in test
Augie Fackler <augie@google.com>
parents: 31609
diff changeset
    14
  $ cd "$OUTPUTDIR"
29027
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    15
  $ ls -d *.pkg
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    16
  Mercurial-*-macosx10.*.pkg (glob)
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    17
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    18
  $ xar -xf Mercurial*.pkg
29025
f2549b0ba9ab tests: add test for Mac OS X package construction
Augie Fackler <augie@google.com>
parents:
diff changeset
    19
f2549b0ba9ab tests: add test for Mac OS X package construction
Augie Fackler <augie@google.com>
parents:
diff changeset
    20
Gather list of all installed files:
29027
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    21
  $ lsbom mercurial.pkg/Bom > boms.txt
29025
f2549b0ba9ab tests: add test for Mac OS X package construction
Augie Fackler <augie@google.com>
parents:
diff changeset
    22
32575
197eb93560b3 osx: override default exclude filter for pkgbuild
Augie Fackler <augie@google.com>
parents: 31610
diff changeset
    23
We've had problems with the filter logic in the past. Make sure no
197eb93560b3 osx: override default exclude filter for pkgbuild
Augie Fackler <augie@google.com>
parents: 31610
diff changeset
    24
.DS_Store files ended up in the final package:
197eb93560b3 osx: override default exclude filter for pkgbuild
Augie Fackler <augie@google.com>
parents: 31610
diff changeset
    25
  $ grep DS_S boms.txt
197eb93560b3 osx: override default exclude filter for pkgbuild
Augie Fackler <augie@google.com>
parents: 31610
diff changeset
    26
  [1]
197eb93560b3 osx: override default exclude filter for pkgbuild
Augie Fackler <augie@google.com>
parents: 31610
diff changeset
    27
29025
f2549b0ba9ab tests: add test for Mac OS X package construction
Augie Fackler <augie@google.com>
parents:
diff changeset
    28
Spot-check some randomly selected files:
29027
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    29
  $ grep bdiff boms.txt | cut -d '	' -f 1,2,3
32470
0e93dc8c0f9f osx: update Mac packaging tests for bdiff.so install location change
Augie Fackler <augie@google.com>
parents: 31610
diff changeset
    30
  ./Library/Python/2.7/site-packages/mercurial/cext/bdiff.so	100755	0/0
33593
441a4550a80a tests: update mac packaging test expectations
Augie Fackler <augie@google.com>
parents: 33204
diff changeset
    31
  ./Library/Python/2.7/site-packages/mercurial/cffi/bdiff.py	100644	0/0
441a4550a80a tests: update mac packaging test expectations
Augie Fackler <augie@google.com>
parents: 33204
diff changeset
    32
  ./Library/Python/2.7/site-packages/mercurial/cffi/bdiff.pyc	100644	0/0
441a4550a80a tests: update mac packaging test expectations
Augie Fackler <augie@google.com>
parents: 33204
diff changeset
    33
  ./Library/Python/2.7/site-packages/mercurial/cffi/bdiff.pyo	100644	0/0
441a4550a80a tests: update mac packaging test expectations
Augie Fackler <augie@google.com>
parents: 33204
diff changeset
    34
  ./Library/Python/2.7/site-packages/mercurial/cffi/bdiffbuild.py	100644	0/0
441a4550a80a tests: update mac packaging test expectations
Augie Fackler <augie@google.com>
parents: 33204
diff changeset
    35
  ./Library/Python/2.7/site-packages/mercurial/cffi/bdiffbuild.pyc	100644	0/0
441a4550a80a tests: update mac packaging test expectations
Augie Fackler <augie@google.com>
parents: 33204
diff changeset
    36
  ./Library/Python/2.7/site-packages/mercurial/cffi/bdiffbuild.pyo	100644	0/0
29027
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    37
  ./Library/Python/2.7/site-packages/mercurial/pure/bdiff.py	100644	0/0
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    38
  ./Library/Python/2.7/site-packages/mercurial/pure/bdiff.pyc	100644	0/0
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    39
  ./Library/Python/2.7/site-packages/mercurial/pure/bdiff.pyo	100644	0/0
32576
501d48bda912 zsh_completion: install as _hg not hg
Kyle Lippincott <spectral@google.com>
parents: 32575
diff changeset
    40
  $ grep zsh/site-functions/_hg boms.txt | cut -d '	' -f 1,2,3
501d48bda912 zsh_completion: install as _hg not hg
Kyle Lippincott <spectral@google.com>
parents: 32575
diff changeset
    41
  ./usr/local/share/zsh/site-functions/_hg	100644	0/0
31142
408dcf7475a7 osx: install bash and zsh completions by default
Augie Fackler <augie@google.com>
parents: 29535
diff changeset
    42
  $ grep hg-completion.bash boms.txt | cut -d '	' -f 1,2,3
31609
8e516f71577a osx: install completion scripts using install(1) to avoid umask badness
Augie Fackler <augie@google.com>
parents: 31142
diff changeset
    43
  ./usr/local/hg/contrib/hg-completion.bash	100644	0/0
29027
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    44
  $ egrep 'man[15]' boms.txt | cut -d '	' -f 1,2,3
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    45
  ./usr/local/share/man/man1	40755	0/0
32472
a38ed42cd23c osx: include chg by default
Augie Fackler <augie@google.com>
parents: 32471
diff changeset
    46
  ./usr/local/share/man/man1/chg.1	100644	0/0
29027
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    47
  ./usr/local/share/man/man1/hg.1	100644	0/0
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    48
  ./usr/local/share/man/man5	40755	0/0
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    49
  ./usr/local/share/man/man5/hgignore.5	100644	0/0
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    50
  ./usr/local/share/man/man5/hgrc.5	100644	0/0
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    51
  $ grep bser boms.txt | cut -d '	' -f 1,2,3
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    52
  ./Library/Python/2.7/site-packages/hgext/fsmonitor/pywatchman/bser.so	100755	0/0
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    53
  ./Library/Python/2.7/site-packages/hgext/fsmonitor/pywatchman/pybser.py	100644	0/0
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    54
  ./Library/Python/2.7/site-packages/hgext/fsmonitor/pywatchman/pybser.pyc	100644	0/0
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    55
  ./Library/Python/2.7/site-packages/hgext/fsmonitor/pywatchman/pybser.pyo	100644	0/0
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    56
  $ grep localrepo boms.txt | cut -d '	' -f 1,2,3
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    57
  ./Library/Python/2.7/site-packages/mercurial/localrepo.py	100644	0/0
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    58
  ./Library/Python/2.7/site-packages/mercurial/localrepo.pyc	100644	0/0
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    59
  ./Library/Python/2.7/site-packages/mercurial/localrepo.pyo	100644	0/0
32472
a38ed42cd23c osx: include chg by default
Augie Fackler <augie@google.com>
parents: 32471
diff changeset
    60
  $ egrep 'bin/' boms.txt | cut -d '	' -f 1,2,3
a38ed42cd23c osx: include chg by default
Augie Fackler <augie@google.com>
parents: 32471
diff changeset
    61
  ./usr/local/bin/chg	100755	0/0
29027
db5084d27df5 osx: create a modern package including manpages
Kevin Bullock <kbullock+mercurial@ringworld.org>
parents: 29025
diff changeset
    62
  ./usr/local/bin/hg	100755	0/0
29025
f2549b0ba9ab tests: add test for Mac OS X package construction
Augie Fackler <augie@google.com>
parents:
diff changeset
    63
29535
da1848f07c6a osx: explicitly build hg with /usr/bin/python2.7
Augie Fackler <augie@google.com>
parents: 29219
diff changeset
    64
Make sure the built binary uses the system Python interpreter
da1848f07c6a osx: explicitly build hg with /usr/bin/python2.7
Augie Fackler <augie@google.com>
parents: 29219
diff changeset
    65
  $ bsdtar xf mercurial.pkg/Payload usr/local/bin
da1848f07c6a osx: explicitly build hg with /usr/bin/python2.7
Augie Fackler <augie@google.com>
parents: 29219
diff changeset
    66
Use a glob to find this to avoid check-code whining about a fixed path.
da1848f07c6a osx: explicitly build hg with /usr/bin/python2.7
Augie Fackler <augie@google.com>
parents: 29219
diff changeset
    67
  $ head -n 1 usr/local/b?n/hg
da1848f07c6a osx: explicitly build hg with /usr/bin/python2.7
Augie Fackler <augie@google.com>
parents: 29219
diff changeset
    68
  #!/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
da1848f07c6a osx: explicitly build hg with /usr/bin/python2.7
Augie Fackler <augie@google.com>
parents: 29219
diff changeset
    69
29025
f2549b0ba9ab tests: add test for Mac OS X package construction
Augie Fackler <augie@google.com>
parents:
diff changeset
    70
Note that we're not currently installing any /etc/mercurial stuff,
f2549b0ba9ab tests: add test for Mac OS X package construction
Augie Fackler <augie@google.com>
parents:
diff changeset
    71
including merge-tool configurations.