##// END OF EJS Templates
tests: use the system hg for examining the local repository...
Adam Simpkins -
r33116:6c113a7d default
parent child Browse files
Show More
@@ -1,19 +1,27 b''
1 # The test-repo is a live hg repository which may have evolution
1 # Invoke the system hg installation (rather than the local hg version being
2 # markers created, e.g. when a ~/.hgrc enabled evolution.
2 # tested).
3 #
3 #
4 # Tests are run using a custom HGRCPATH, which do not
4 # We want to use the hg version being tested when interacting with the test
5 # enable evolution markers by default.
5 # repository, and the system hg when interacting with the mercurial source code
6 # repository.
6 #
7 #
7 # If test-repo includes evolution markers, and we do not
8 # The mercurial source repository was typically orignally cloned with the
8 # enable evolution markers, hg will occasionally complain
9 # system mercurial installation, and may require extensions or settings from
9 # when it notices them, which disrupts tests resulting in
10 # the system installation.
10 # sporadic failures.
11 syshg () {
11 #
12 (
12 # Since we aren't performing any write operations on the
13 syshgenv
13 # test-repo, there's no harm in telling hg that we support
14 exec hg "$@"
14 # evolution markers, which is what the following lines
15 )
15 # for the hgrc file do:
16 }
16 cat >> $HGRCPATH << EOF
17
17 [experimental]
18 # Revert the environment so that running "hg" runs the system hg
18 evolution=createmarkers
19 # rather than the test hg installation.
19 EOF
20 syshgenv () {
21 PATH="$ORIG_PATH"
22 PYTHONPATH="$ORIG_PYTHONPATH"
23 JYTHONPATH="$ORIG_JYTHONPATH"
24 unset HGRCPATH
25 HGPLAIN=1
26 export HGPLAIN
27 }
@@ -7,7 +7,7 b''
7 New errors are not allowed. Warnings are strongly discouraged.
7 New errors are not allowed. Warnings are strongly discouraged.
8 (The writing "no-che?k-code" is for not skipping this file when checking.)
8 (The writing "no-che?k-code" is for not skipping this file when checking.)
9
9
10 $ hg locate -X contrib/python-zstandard -X hgext/fsmonitor/pywatchman |
10 $ syshg locate -X contrib/python-zstandard -X hgext/fsmonitor/pywatchman |
11 > sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false
11 > sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false
12 Skipping i18n/polib.py it has no-che?k-code (glob)
12 Skipping i18n/polib.py it has no-che?k-code (glob)
13 Skipping mercurial/httpclient/__init__.py it has no-che?k-code (glob)
13 Skipping mercurial/httpclient/__init__.py it has no-che?k-code (glob)
@@ -33,7 +33,7 b' New errors are not allowed. Warnings are'
33
33
34 Prevent adding new files in the root directory accidentally.
34 Prevent adding new files in the root directory accidentally.
35
35
36 $ hg files 'glob:*'
36 $ syshg files 'glob:*'
37 .editorconfig
37 .editorconfig
38 .hgignore
38 .hgignore
39 .hgsigs
39 .hgsigs
@@ -8,8 +8,8 b' Go back in the hg repo'
8
8
9 $ cd $TESTDIR/..
9 $ cd $TESTDIR/..
10
10
11 $ for node in `hg log --rev 'not public() and ::. and not desc("# no-check-commit")' --template '{node|short}\n'`; do
11 $ for node in `syshg log --rev 'not public() and ::. and not desc("# no-check-commit")' --template '{node|short}\n'`; do
12 > hg export --git $node | contrib/check-commit > ${TESTTMP}/check-commit.out
12 > syshg export --git $node | contrib/check-commit > ${TESTTMP}/check-commit.out
13 > if [ $? -ne 0 ]; then
13 > if [ $? -ne 0 ]; then
14 > echo "Revision $node does not comply with rules"
14 > echo "Revision $node does not comply with rules"
15 > echo '------------------------------------------------------'
15 > echo '------------------------------------------------------'
@@ -31,7 +31,7 b' Sanity check check-config.py'
31
31
32 New errors are not allowed. Warnings are strongly discouraged.
32 New errors are not allowed. Warnings are strongly discouraged.
33
33
34 $ hg files "set:(**.py or **.txt) - tests/**" | sed 's|\\|/|g' |
34 $ syshg files "set:(**.py or **.txt) - tests/**" | sed 's|\\|/|g' |
35 > $PYTHON contrib/check-config.py
35 > $PYTHON contrib/check-config.py
36 limit = ui.configwith(fraction, 'profiling', 'showmin', 0.05)
36 limit = ui.configwith(fraction, 'profiling', 'showmin', 0.05)
37
37
@@ -5,20 +5,20 b''
5
5
6 look for python scripts without the execute bit
6 look for python scripts without the execute bit
7
7
8 $ hg files 'set:**.py and not exec() and grep(r"^#!.*?python")'
8 $ syshg files 'set:**.py and not exec() and grep(r"^#!.*?python")'
9 [1]
9 [1]
10
10
11 look for python scripts with execute bit but not shebang
11 look for python scripts with execute bit but not shebang
12
12
13 $ hg files 'set:**.py and exec() and not grep(r"^#!.*?python")'
13 $ syshg files 'set:**.py and exec() and not grep(r"^#!.*?python")'
14 [1]
14 [1]
15
15
16 look for shell scripts with execute bit but not shebang
16 look for shell scripts with execute bit but not shebang
17
17
18 $ hg files 'set:**.sh and exec() and not grep(r"^#!.*(ba)?sh")'
18 $ syshg files 'set:**.sh and exec() and not grep(r"^#!.*(ba)?sh")'
19 [1]
19 [1]
20
20
21 look for non scripts with no shebang
21 look for non scripts with no shebang
22
22
23 $ hg files 'set:exec() and not **.sh and not **.py and not grep(r"^#!")'
23 $ syshg files 'set:exec() and not **.sh and not **.py and not grep(r"^#!")'
24 [1]
24 [1]
@@ -23,6 +23,7 b''
23 Check if ":hg:`help TOPIC`" is valid:
23 Check if ":hg:`help TOPIC`" is valid:
24 (use "xargs -n1 -t" to see which help commands are executed)
24 (use "xargs -n1 -t" to see which help commands are executed)
25
25
26 $ hg files 'glob:{hgdemandimport,hgext,mercurial}/**/*.py' | sed 's|\\|/|g' \
26 $ syshg files 'glob:{hgdemandimport,hgext,mercurial}/**/*.py' \
27 > | sed 's|\\|/|g' \
27 > | xargs $PYTHON "$TESTTMP/scanhelptopics.py" \
28 > | xargs $PYTHON "$TESTTMP/scanhelptopics.py" \
28 > | xargs -n1 hg help > /dev/null
29 > | xargs -n1 hg help > /dev/null
@@ -14,7 +14,7 b' these may expose other cycles.'
14 Known-bad files are excluded by -X as some of them would produce unstable
14 Known-bad files are excluded by -X as some of them would produce unstable
15 outputs, which should be fixed later.
15 outputs, which should be fixed later.
16
16
17 $ hg locate 'set:**.py or grep(r"^#!.*?python")' \
17 $ syshg locate 'set:**.py or grep(r"^#!.*?python")' \
18 > 'tests/**.t' \
18 > 'tests/**.t' \
19 > -X contrib/debugshell.py \
19 > -X contrib/debugshell.py \
20 > -X contrib/python-zstandard/ \
20 > -X contrib/python-zstandard/ \
@@ -3,7 +3,7 b''
3 $ . "$TESTDIR/helpers-testrepo.sh"
3 $ . "$TESTDIR/helpers-testrepo.sh"
4 $ cd "$TESTDIR"/..
4 $ cd "$TESTDIR"/..
5
5
6 $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON contrib/check-py3-compat.py
6 $ syshg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON contrib/check-py3-compat.py
7 contrib/python-zstandard/setup.py not using absolute_import
7 contrib/python-zstandard/setup.py not using absolute_import
8 contrib/python-zstandard/setup_zstd.py not using absolute_import
8 contrib/python-zstandard/setup_zstd.py not using absolute_import
9 contrib/python-zstandard/tests/common.py not using absolute_import
9 contrib/python-zstandard/tests/common.py not using absolute_import
@@ -22,7 +22,7 b''
22 tests/test-demandimport.py not using absolute_import
22 tests/test-demandimport.py not using absolute_import
23
23
24 #if py3exe
24 #if py3exe
25 $ hg files 'set:(**.py) - grep(pygments)' -X hgext/fsmonitor/pywatchman \
25 $ syshg files 'set:(**.py) - grep(pygments)' -X hgext/fsmonitor/pywatchman \
26 > | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py \
26 > | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py \
27 > | sed 's/[0-9][0-9]*)$/*)/'
27 > | sed 's/[0-9][0-9]*)$/*)/'
28 hgext/convert/transport.py: error importing: <*Error> No module named 'svn.client' (error at transport.py:*) (glob)
28 hgext/convert/transport.py: error importing: <*Error> No module named 'svn.client' (error at transport.py:*) (glob)
@@ -38,7 +38,7 b''
38 #endif
38 #endif
39
39
40 #if py3exe py3pygments
40 #if py3exe py3pygments
41 $ hg files 'set:(**.py) and grep(pygments)' | sed 's|\\|/|g' \
41 $ syshg files 'set:(**.py) and grep(pygments)' | sed 's|\\|/|g' \
42 > | xargs $PYTHON3 contrib/check-py3-compat.py \
42 > | xargs $PYTHON3 contrib/check-py3-compat.py \
43 > | sed 's/[0-9][0-9]*)$/*)/'
43 > | sed 's/[0-9][0-9]*)$/*)/'
44 #endif
44 #endif
@@ -6,7 +6,8 b''
6 run pyflakes on all tracked files ending in .py or without a file ending
6 run pyflakes on all tracked files ending in .py or without a file ending
7 (skipping binary file random-seed)
7 (skipping binary file random-seed)
8
8
9 $ hg locate 'set:**.py or grep("^#!.*python")' -X hgext/fsmonitor/pywatchman \
9 $ syshg locate 'set:**.py or grep("^#!.*python")' \
10 > -X hgext/fsmonitor/pywatchman \
10 > -X mercurial/pycompat.py -X contrib/python-zstandard \
11 > -X mercurial/pycompat.py -X contrib/python-zstandard \
11 > 2>/dev/null \
12 > 2>/dev/null \
12 > | xargs pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py"
13 > | xargs pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py"
@@ -5,11 +5,11 b''
5
5
6 look for python scripts that do not use /usr/bin/env
6 look for python scripts that do not use /usr/bin/env
7
7
8 $ hg files 'set:grep(r"^#!.*?python") and not grep(r"^#!/usr/bi{1}n/env python") - **/*.t'
8 $ syshg files 'set:grep(r"^#!.*?python") and not grep(r"^#!/usr/bi{1}n/env python") - **/*.t'
9 [1]
9 [1]
10
10
11 In tests, enforce $PYTHON and *not* /usr/bin/env python or similar:
11 In tests, enforce $PYTHON and *not* /usr/bin/env python or similar:
12 $ hg files 'set:grep(r"#!.*?python") and **/*.t' \
12 $ syshg files 'set:grep(r"#!.*?python") and **/*.t' \
13 > -X tests/test-check-execute.t \
13 > -X tests/test-check-execute.t \
14 > -X tests/test-check-module-imports.t \
14 > -X tests/test-check-module-imports.t \
15 > -X tests/test-check-pyflakes.t \
15 > -X tests/test-check-pyflakes.t \
@@ -21,5 +21,5 b" contain Python but don't end in .py - pl"
21
21
22 look for shell scripts that do not use /bin/sh
22 look for shell scripts that do not use /bin/sh
23
23
24 $ hg files 'set:grep(r"^#!.*/bi{1}n/sh") and not grep(r"^#!/bi{1}n/sh")'
24 $ syshg files 'set:grep(r"^#!.*/bi{1}n/sh") and not grep(r"^#!/bi{1}n/sh")'
25 [1]
25 [1]
@@ -170,6 +170,6 b' Check perf.py for historical portability'
170
170
171 $ cd "$TESTDIR/.."
171 $ cd "$TESTDIR/.."
172
172
173 $ (hg files -r 1.2 glob:mercurial/*.c glob:mercurial/*.py;
173 $ (syshg files -r 1.2 glob:mercurial/*.c glob:mercurial/*.py;
174 > hg files -r tip glob:mercurial/*.c glob:mercurial/*.py) |
174 > syshg files -r tip glob:mercurial/*.c glob:mercurial/*.py) |
175 > "$TESTDIR"/check-perf-code.py contrib/perf.py
175 > "$TESTDIR"/check-perf-code.py contrib/perf.py
@@ -1,6 +1,7 b''
1 #require test-repo slow debhelper
1 #require test-repo slow debhelper
2
2
3 $ . "$TESTDIR/helpers-testrepo.sh"
3 $ . "$TESTDIR/helpers-testrepo.sh"
4 $ syshgenv
4
5
5 Ensure debuild doesn't run the testsuite, as that could get silly.
6 Ensure debuild doesn't run the testsuite, as that could get silly.
6 $ DEB_BUILD_OPTIONS=nocheck
7 $ DEB_BUILD_OPTIONS=nocheck
@@ -1,6 +1,7 b''
1 #require test-repo slow docker
1 #require test-repo slow docker
2
2
3 $ . "$TESTDIR/helpers-testrepo.sh"
3 $ . "$TESTDIR/helpers-testrepo.sh"
4 $ syshgenv
4
5
5 Ensure debuild doesn't run the testsuite, as that could get silly.
6 Ensure debuild doesn't run the testsuite, as that could get silly.
6 $ DEB_BUILD_OPTIONS=nocheck
7 $ DEB_BUILD_OPTIONS=nocheck
@@ -1,3 +1,5 b''
1 $ . "$TESTDIR/helpers-testrepo.sh"
2
1 Testing that hghave does not crash when checking features
3 Testing that hghave does not crash when checking features
2
4
3 $ hghave --test-features 2>/dev/null
5 $ hghave --test-features 2>/dev/null
@@ -18,7 +20,10 b' Testing hghave extensibility for third p'
18 > $ echo foo
20 > $ echo foo
19 > foo
21 > foo
20 > EOF
22 > EOF
21 $ run-tests.py $HGTEST_RUN_TESTS_PURE test-hghaveaddon.t
23 $ ( \
24 > syshgenv; \
25 > $TESTDIR/run-tests.py $HGTEST_RUN_TESTS_PURE test-hghaveaddon.t \
26 > )
22 .
27 .
23 # Ran 1 tests, 0 skipped, 0 failed.
28 # Ran 1 tests, 0 skipped, 0 failed.
24
29
@@ -1,6 +1,7 b''
1 #require test-repo
1 #require test-repo
2
2
3 $ . "$TESTDIR/helpers-testrepo.sh"
3 $ . "$TESTDIR/helpers-testrepo.sh"
4 $ syshgenv
4 $ import_checker="$TESTDIR"/../contrib/import-checker.py
5 $ import_checker="$TESTDIR"/../contrib/import-checker.py
5
6
6 Run the doctests from the import checker, and make sure
7 Run the doctests from the import checker, and make sure
@@ -159,7 +159,7 b' path variables are expanded (~ is the sa'
159 > print(' %s' % f)
159 > print(' %s' % f)
160 > EOF
160 > EOF
161
161
162 $ $PYTHON wixxml.py help
162 $ (syshgenv; $PYTHON wixxml.py help )
163 Not installed:
163 Not installed:
164 help/common.txt
164 help/common.txt
165 help/hg-ssh.8.txt
165 help/hg-ssh.8.txt
@@ -168,7 +168,7 b' path variables are expanded (~ is the sa'
168 help/hgrc.5.txt
168 help/hgrc.5.txt
169 Not tracked:
169 Not tracked:
170
170
171 $ $PYTHON wixxml.py templates
171 $ ( syshgenv; $PYTHON wixxml.py templates )
172 Not installed:
172 Not installed:
173 Not tracked:
173 Not tracked:
174
174
@@ -1,6 +1,7 b''
1 #require test-repo slow osx osxpackaging
1 #require test-repo slow osx osxpackaging
2
2
3 $ . "$TESTDIR/helpers-testrepo.sh"
3 $ . "$TESTDIR/helpers-testrepo.sh"
4 $ syshgenv
4
5
5 $ OUTPUTDIR="`pwd`"
6 $ OUTPUTDIR="`pwd`"
6 $ export OUTPUTDIR
7 $ export OUTPUTDIR
General Comments 0
You need to be logged in to leave comments. Login now