##// END OF EJS Templates
tests: alias syshg and syshgenv so they can be switched conditionally
Yuya Nishihara -
r33199:ddd65b4f default
parent child Browse files
Show More
@@ -27,11 +27,10 b' syshgenv () {'
27 # in ancient versions of hg. So we double check if "syshg files" works and
27 # in ancient versions of hg. So we double check if "syshg files" works and
28 # fallback to hg bundled in the repo.
28 # fallback to hg bundled in the repo.
29 syshg files -h >/dev/null 2>/dev/null
29 syshg files -h >/dev/null 2>/dev/null
30 if [ $? -ne 0 ]; then
30 if [ $? -eq 0 ]; then
31 syshg() {
31 alias testrepohg=syshg
32 hg "$@"
32 alias testrepohgenv=syshgenv
33 }
33 else
34 syshgenv() {
34 alias testrepohg=hg
35 :
35 alias testrepohgenv=:
36 }
37 fi
36 fi
@@ -7,7 +7,8 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 $ syshg locate -X contrib/python-zstandard -X hgext/fsmonitor/pywatchman |
10 $ testrepohg locate -X contrib/python-zstandard \
11 > -X hgext/fsmonitor/pywatchman |
11 > sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false
12 > sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false
12 Skipping i18n/polib.py it has no-che?k-code (glob)
13 Skipping i18n/polib.py it has no-che?k-code (glob)
13 Skipping mercurial/httpclient/__init__.py it has no-che?k-code (glob)
14 Skipping mercurial/httpclient/__init__.py it has no-che?k-code (glob)
@@ -33,7 +34,7 b' New errors are not allowed. Warnings are'
33
34
34 Prevent adding new files in the root directory accidentally.
35 Prevent adding new files in the root directory accidentally.
35
36
36 $ syshg files 'glob:*'
37 $ testrepohg files 'glob:*'
37 .editorconfig
38 .editorconfig
38 .hgignore
39 .hgignore
39 .hgsigs
40 .hgsigs
@@ -8,8 +8,9 b' Go back in the hg repo'
8
8
9 $ cd $TESTDIR/..
9 $ cd $TESTDIR/..
10
10
11 $ for node in `syshg log --rev 'not public() and ::. and not desc("# no-check-commit")' --template '{node|short}\n'`; do
11 $ for node in `testrepohg log --rev 'not public() and ::. and not desc("# no-check-commit")' --template '{node|short}\n'`; do
12 > syshg export --git $node | contrib/check-commit > ${TESTTMP}/check-commit.out
12 > testrepohg export --git $node \
13 > | contrib/check-commit > ${TESTTMP}/check-commit.out
13 > if [ $? -ne 0 ]; then
14 > if [ $? -ne 0 ]; then
14 > echo "Revision $node does not comply with rules"
15 > echo "Revision $node does not comply with rules"
15 > echo '------------------------------------------------------'
16 > echo '------------------------------------------------------'
@@ -43,5 +43,5 b' Sanity check check-config.py'
43
43
44 New errors are not allowed. Warnings are strongly discouraged.
44 New errors are not allowed. Warnings are strongly discouraged.
45
45
46 $ syshg files "set:(**.py or **.txt) - tests/**" | sed 's|\\|/|g' |
46 $ testrepohg files "set:(**.py or **.txt) - tests/**" | sed 's|\\|/|g' |
47 > $PYTHON contrib/check-config.py
47 > $PYTHON contrib/check-config.py
@@ -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 $ syshg files 'set:**.py and not exec() and grep(r"^#!.*?python")'
8 $ testrepohg 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 $ syshg files 'set:**.py and exec() and not grep(r"^#!.*?python")'
13 $ testrepohg 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 $ syshg files 'set:**.sh and exec() and not grep(r"^#!.*(ba)?sh")'
18 $ testrepohg 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 $ syshg files 'set:exec() and not **.sh and not **.py and not grep(r"^#!")'
23 $ testrepohg files 'set:exec() and not **.sh and not **.py and not grep(r"^#!")'
24 [1]
24 [1]
@@ -23,7 +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 $ syshg files 'glob:{hgdemandimport,hgext,mercurial}/**/*.py' \
26 $ testrepohg files 'glob:{hgdemandimport,hgext,mercurial}/**/*.py' \
27 > | sed 's|\\|/|g' \
27 > | sed 's|\\|/|g' \
28 > | xargs $PYTHON "$TESTTMP/scanhelptopics.py" \
28 > | xargs $PYTHON "$TESTTMP/scanhelptopics.py" \
29 > | 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 $ syshg locate 'set:**.py or grep(r"^#!.*?python")' \
17 $ testrepohg 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,8 b''
3 $ . "$TESTDIR/helpers-testrepo.sh"
3 $ . "$TESTDIR/helpers-testrepo.sh"
4 $ cd "$TESTDIR"/..
4 $ cd "$TESTDIR"/..
5
5
6 $ syshg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON contrib/check-py3-compat.py
6 $ testrepohg files 'set:(**.py)' | sed 's|\\|/|g' \
7 > | xargs $PYTHON contrib/check-py3-compat.py
7 contrib/python-zstandard/setup.py not using absolute_import
8 contrib/python-zstandard/setup.py not using absolute_import
8 contrib/python-zstandard/setup_zstd.py not using absolute_import
9 contrib/python-zstandard/setup_zstd.py not using absolute_import
9 contrib/python-zstandard/tests/common.py not using absolute_import
10 contrib/python-zstandard/tests/common.py not using absolute_import
@@ -22,7 +23,8 b''
22 tests/test-demandimport.py not using absolute_import
23 tests/test-demandimport.py not using absolute_import
23
24
24 #if py3exe
25 #if py3exe
25 $ syshg files 'set:(**.py) - grep(pygments)' -X hgext/fsmonitor/pywatchman \
26 $ testrepohg files 'set:(**.py) - grep(pygments)' \
27 > -X hgext/fsmonitor/pywatchman \
26 > | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py \
28 > | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py \
27 > | sed 's/[0-9][0-9]*)$/*)/'
29 > | sed 's/[0-9][0-9]*)$/*)/'
28 hgext/convert/transport.py: error importing: <*Error> No module named 'svn.client' (error at transport.py:*) (glob)
30 hgext/convert/transport.py: error importing: <*Error> No module named 'svn.client' (error at transport.py:*) (glob)
@@ -38,7 +40,7 b''
38 #endif
40 #endif
39
41
40 #if py3exe py3pygments
42 #if py3exe py3pygments
41 $ syshg files 'set:(**.py) and grep(pygments)' | sed 's|\\|/|g' \
43 $ testrepohg files 'set:(**.py) and grep(pygments)' | sed 's|\\|/|g' \
42 > | xargs $PYTHON3 contrib/check-py3-compat.py \
44 > | xargs $PYTHON3 contrib/check-py3-compat.py \
43 > | sed 's/[0-9][0-9]*)$/*)/'
45 > | sed 's/[0-9][0-9]*)$/*)/'
44 #endif
46 #endif
@@ -6,7 +6,7 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 $ syshg locate 'set:**.py or grep("^#!.*python")' \
9 $ testrepohg locate 'set:**.py or grep("^#!.*python")' \
10 > -X hgext/fsmonitor/pywatchman \
10 > -X hgext/fsmonitor/pywatchman \
11 > -X mercurial/pycompat.py -X contrib/python-zstandard \
11 > -X mercurial/pycompat.py -X contrib/python-zstandard \
12 > 2>/dev/null \
12 > 2>/dev/null \
@@ -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 $ syshg files 'set:grep(r"^#!.*?python") and not grep(r"^#!/usr/bi{1}n/env python") - **/*.t'
8 $ testrepohg 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 $ syshg files 'set:grep(r"#!.*?python") and **/*.t' \
12 $ testrepohg 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 $ syshg files 'set:grep(r"^#!.*/bi{1}n/sh") and not grep(r"^#!/bi{1}n/sh")'
24 $ testrepohg 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 $ (syshg files -r 1.2 glob:mercurial/*.c glob:mercurial/*.py;
173 $ (testrepohg files -r 1.2 glob:mercurial/*.c glob:mercurial/*.py;
174 > syshg files -r tip glob:mercurial/*.c glob:mercurial/*.py) |
174 > testrepohg 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,7 +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 $ testrepohgenv
5
5
6 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.
7 $ DEB_BUILD_OPTIONS=nocheck
7 $ DEB_BUILD_OPTIONS=nocheck
@@ -1,7 +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 $ testrepohgenv
5
5
6 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.
7 $ DEB_BUILD_OPTIONS=nocheck
7 $ DEB_BUILD_OPTIONS=nocheck
@@ -21,7 +21,7 b' Testing hghave extensibility for third p'
21 > foo
21 > foo
22 > EOF
22 > EOF
23 $ ( \
23 $ ( \
24 > syshgenv; \
24 > testrepohgenv; \
25 > $TESTDIR/run-tests.py $HGTEST_RUN_TESTS_PURE test-hghaveaddon.t \
25 > $TESTDIR/run-tests.py $HGTEST_RUN_TESTS_PURE test-hghaveaddon.t \
26 > )
26 > )
27 .
27 .
@@ -1,7 +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 $ testrepohgenv
5 $ import_checker="$TESTDIR"/../contrib/import-checker.py
5 $ import_checker="$TESTDIR"/../contrib/import-checker.py
6
6
7 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 $ (syshgenv; $PYTHON wixxml.py help )
162 $ ( testrepohgenv; $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 $ ( syshgenv; $PYTHON wixxml.py templates )
171 $ ( testrepohgenv; $PYTHON wixxml.py templates )
172 Not installed:
172 Not installed:
173 Not tracked:
173 Not tracked:
174
174
@@ -1,7 +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 $ testrepohgenv
5
5
6 $ OUTPUTDIR="`pwd`"
6 $ OUTPUTDIR="`pwd`"
7 $ export OUTPUTDIR
7 $ export OUTPUTDIR
General Comments 0
You need to be logged in to leave comments. Login now