mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 17:27:53 +03:00
0c36fd8b5e
Summary: Those tests were converted using: echo *.t | xargs -P20 -n1 python -m testutil.dott.translate --black --verify They run 5x faster (via run-tests.py), and 10x faster (via python directly). run-tests.py on old .t files, 652 CPU seconds: % time ./run-tests.py `cat list-t.txt` --noprogress ................................................................................................................................. # Ran 129 tests, 0 skipped, 0 failed. ./run-tests.py `cat list-t.txt` --noprogress 505.30s user 146.37s system 1451% cpu 44.899 total run-tests.py on new py tests, 135 CPU seconds: % time ./run-tests.py `cat list-py.txt` --noprogress ............................................................................................................................. # Ran 125 tests, 0 skipped, 0 failed. ./run-tests.py `cat list-py.txt` --noprogress 55.73s user 78.80s system 744% cpu 18.061 total vanilla python on new tests, 59 CPU seconds: % time (for i in `cat list-py.txt`; do python $i; done;) ( for i in `cat list-py.txt`; do; python $i; done; ) 41.61s user 17.47s system 90% cpu 1:05.31 total The new tests also have auto fix ability. `python test-foo-t.py --fix` will autofix the code. Reviewed By: xavierd Differential Revision: D16172902 fbshipit-source-id: dda53990a7dfff5ac214c1237e4206a4d67e8e48
195 lines
3.3 KiB
Python
195 lines
3.3 KiB
Python
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
# Copyright (c) Mercurial Contributors.
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2 or any later version.
|
|
|
|
from __future__ import absolute_import
|
|
|
|
from testutil.dott import feature, sh, testtmp # noqa: F401
|
|
|
|
|
|
sh % "mkdir folder"
|
|
sh % "cd folder"
|
|
sh % "hg init"
|
|
sh % "mkdir x x/l x/m x/n x/l/u x/l/u/a"
|
|
sh % "touch a b x/aa.o x/bb.o"
|
|
sh % "hg status" == r"""
|
|
? a
|
|
? b
|
|
? x/aa.o
|
|
? x/bb.o"""
|
|
|
|
sh % "hg status --terse u" == r"""
|
|
? a
|
|
? b
|
|
? x/"""
|
|
sh % "hg status --terse maudric" == r"""
|
|
? a
|
|
? b
|
|
? x/"""
|
|
sh % "hg status --terse madric" == r"""
|
|
? a
|
|
? b
|
|
? x/aa.o
|
|
? x/bb.o"""
|
|
sh % "hg status --terse f" == r"""
|
|
abort: 'f' not recognized
|
|
[255]"""
|
|
|
|
# Add a .gitignore so that we can also have ignored files
|
|
|
|
sh % "echo '*\\.o'" > ".gitignore"
|
|
sh % "hg status" == r"""
|
|
? .gitignore
|
|
? a
|
|
? b"""
|
|
sh % "hg status -i" == r"""
|
|
I x/aa.o
|
|
I x/bb.o"""
|
|
|
|
# Tersing ignored files
|
|
sh % "hg status -t i --ignored" == "I x/"
|
|
|
|
# Adding more files
|
|
sh % "mkdir y"
|
|
sh % "touch x/aa x/bb y/l y/m y/l.o y/m.o"
|
|
sh % "touch x/l/aa x/m/aa x/n/aa x/l/u/bb x/l/u/a/bb"
|
|
|
|
sh % "hg status" == r"""
|
|
? .gitignore
|
|
? a
|
|
? b
|
|
? x/aa
|
|
? x/bb
|
|
? x/l/aa
|
|
? x/l/u/a/bb
|
|
? x/l/u/bb
|
|
? x/m/aa
|
|
? x/n/aa
|
|
? y/l
|
|
? y/m"""
|
|
|
|
sh % "hg status --terse u" == r"""
|
|
? .gitignore
|
|
? a
|
|
? b
|
|
? x/
|
|
? y/"""
|
|
|
|
sh % "hg add x/aa x/bb .gitignore"
|
|
sh % "hg status --terse au" == r"""
|
|
A .gitignore
|
|
A x/aa
|
|
A x/bb
|
|
? a
|
|
? b
|
|
? x/l/
|
|
? x/m/
|
|
? x/n/
|
|
? y/"""
|
|
|
|
# Including ignored files
|
|
|
|
sh % "hg status --terse aui" == r"""
|
|
A .gitignore
|
|
A x/aa
|
|
A x/bb
|
|
? a
|
|
? b
|
|
? x/l/
|
|
? x/m/
|
|
? x/n/
|
|
? y/l
|
|
? y/m"""
|
|
sh % "hg status --terse au -i" == r"""
|
|
I x/aa.o
|
|
I x/bb.o
|
|
I y/l.o
|
|
I y/m.o"""
|
|
|
|
# Committing some of the files
|
|
|
|
sh % "hg commit x/aa x/bb .gitignore -m 'First commit'"
|
|
sh % "hg status" == r"""
|
|
? a
|
|
? b
|
|
? x/l/aa
|
|
? x/l/u/a/bb
|
|
? x/l/u/bb
|
|
? x/m/aa
|
|
? x/n/aa
|
|
? y/l
|
|
? y/m"""
|
|
sh % "hg status --terse mardu" == r"""
|
|
? a
|
|
? b
|
|
? x/l/
|
|
? x/m/
|
|
? x/n/
|
|
? y/"""
|
|
|
|
# Modifying already committed files
|
|
|
|
sh % "echo Hello" >> "x/aa"
|
|
sh % "echo World" >> "x/bb"
|
|
sh % "hg status --terse maurdc" == r"""
|
|
M x/aa
|
|
M x/bb
|
|
? a
|
|
? b
|
|
? x/l/
|
|
? x/m/
|
|
? x/n/
|
|
? y/"""
|
|
|
|
# Respecting other flags
|
|
|
|
sh % "hg status --terse marduic --all" == r"""
|
|
M x/aa
|
|
M x/bb
|
|
? a
|
|
? b
|
|
? x/l/
|
|
? x/m/
|
|
? x/n/
|
|
? y/l
|
|
? y/m
|
|
I x/aa.o
|
|
I x/bb.o
|
|
I y/l.o
|
|
I y/m.o
|
|
C .gitignore"""
|
|
sh % "hg status --terse marduic -a"
|
|
sh % "hg status --terse marduic -c" == "C .gitignore"
|
|
sh % "hg status --terse marduic -m" == r"""
|
|
M x/aa
|
|
M x/bb"""
|
|
|
|
# Passing 'i' in terse value will consider the ignored files while tersing
|
|
|
|
sh % "hg status --terse marduic -u" == r"""
|
|
? a
|
|
? b
|
|
? x/l/
|
|
? x/m/
|
|
? x/n/
|
|
? y/l
|
|
? y/m"""
|
|
|
|
# Omitting 'i' in terse value does not consider ignored files while tersing
|
|
|
|
sh % "hg status --terse marduc -u" == r"""
|
|
? a
|
|
? b
|
|
? x/l/
|
|
? x/m/
|
|
? x/n/
|
|
? y/"""
|
|
|
|
# Trying with --rev
|
|
|
|
sh % "hg status --terse marduic --rev 0 --rev 1" == r"""
|
|
abort: cannot use --terse with --rev
|
|
[255]"""
|