sapling/eden/scm/tests/test-parseindex.t
Zeyi (Rice) Fan 92f6f35e7a mark all tests requiring Python 2
Summary:
This diff marks **ALL** mercurial tests requiring Python 2 feature.

After you fixes some tests, simply remove the `py2` feature requirement and that tests will be continuously run after your diff is landed.

To bypass this feature requirement, run the tests command with `HGTEST_FORCE_PY2=1`. For example:

```
HGTEST_FORCE_PY2=1 buck test //eden/scm/tests:hg_run_tests
```

or

```
HGTEST_FORCE_PY2=1 python run-tests.py
```

----

Basically this diff are created with the following commands:

```
$ sed -i 's/import feature\(.*\)$/import feature\1\n\nfeature.require(["py2"])/' test-*-t.py
$ sed -i '1s/^/#require py2\n/' test-*.t
$ ls | grep -P "^test.*(?<\!-t)\.py$" > list && vim -p $(cat list)
# manually adding feature requires for these Python tests.
```

(Note: this ignores all push blocking failures!)

ignore-conflict-markers

Reviewed By: singhsrb

Differential Revision: D19655148

fbshipit-source-id: 985e3ccb4010cc559049f1d89f8909bc2d9b5e20
2020-01-30 18:49:21 -08:00

67 lines
1.8 KiB
Perl

#require py2
#chg-compatible
$ disable treemanifest
$ hg init a
$ cd a
$ echo abc > foo
$ hg add foo
$ hg commit -m 'add foo'
$ echo >> foo
$ hg commit -m 'change foo'
Test SEGV caused by bad revision passed to reachableroots() (issue4775):
$ hg debugpython -- <<EOF
> from __future__ import print_function
> from edenscm.mercurial import changelog, uiconfig, vfs
> cl = changelog.changelog(vfs.vfs('.hg/store'), uiconfig.uiconfig())
> print('good heads:')
> for head in [0, len(cl) - 1, -1]:
> print('%s: %r' % (head, cl.reachableroots(0, [head], [0])))
> print('bad heads:')
> for head in [len(cl), 10000, -2, -10000, None]:
> print('%s:' % head, end=' ')
> try:
> cl.reachableroots(0, [head], [0])
> print('uncaught buffer overflow?')
> except (IndexError, TypeError) as inst:
> print(inst)
> print('good roots:')
> for root in [0, len(cl) - 1, -1]:
> print('%s: %r' % (root, cl.reachableroots(root, [len(cl) - 1], [root])))
> print('out-of-range roots are ignored:')
> for root in [len(cl), 10000, -2, -10000]:
> print('%s: %r' % (root, cl.reachableroots(root, [len(cl) - 1], [root])))
> print('bad roots:')
> for root in [None]:
> print('%s:' % root, end=' ')
> try:
> cl.reachableroots(root, [len(cl) - 1], [root])
> print('uncaught error?')
> except TypeError as inst:
> print(inst)
> EOF
good heads:
0: [0]
1: [0]
-1: []
bad heads:
2: head out of range
10000: head out of range
-2: head out of range
-10000: head out of range
None: an integer is required
good roots:
0: [0]
1: [1]
-1: [-1]
out-of-range roots are ignored:
2: []
10000: []
-2: []
-10000: []
bad roots:
None: an integer is required