sapling/eden/scm/tests/test-hgsql-sqlverify.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

57 lines
1.7 KiB
Perl

#require py2
#chg-compatible
$ . "$TESTDIR/hgsql/library.sh"
$ disable treemanifest
Populate the db with an initial commit
$ initserver master masterrepo
$ cd master
$ echo a > a
$ hg commit -Aqm 'add a'
$ echo b > b
$ hg commit -Aqm 'add b'
$ hg up -q 0
$ echo c > c
$ hg commit -Aqm 'add c'
Run with a correct revlog
$ hg sqlverify
Verification passed
Run with incorrect local revlogs
$ hg debugstrip -r 1 --config hgsql.bypass=True
saved backup bundle to $TESTTMP/master/.hg/strip-backup/7c3bad9141dc-81844e36-backup.hg (glob)
$ hg unbundle --config hgsql.bypass=True $TESTTMP/master/.hg/strip-backup/7c3bad9141dc-81844e36-backup.hg
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
$ hg log -r tip --forcesync -T '{desc}\n'
add b
$ hg sqlverify >$TESTTMP/sqlverify.out 2>&1 || true
$ grep Corruption $TESTTMP/sqlverify.out || cat $TESTTMP/sqlverify.out
CorruptionException: * with linkrev *, disk does not match mysql (glob)
$ hg debugstrip -q -r 1: --config hgsql.bypass=True --no-backup
$ hg log -r tip --forcesync -T '\n'
Run with correct changelog but incorrect revlogs
$ hg sqlverify
Verification passed
$ mkdir .hg/store/backups
$ cp .hg/store/00changelog* .hg/store/backups/
$ echo >> a
$ hg commit -qm "modify a" --config hgsql.bypass=True
$ cp .hg/store/backups/* .hg/store/
$ hg sqlverify
corruption: 'data/a.i:eb2346e7cf59326667069bf8647698840687803d' with linkrev 3 exists on local disk, but not in sql
corruption: '00manifest.i:05e2c764eb21dd7c597aab767cec621af1292344' with linkrev 3 exists on local disk, but not in sql
abort: Verification failed
[255]