##// 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 27 # in ancient versions of hg. So we double check if "syshg files" works and
28 28 # fallback to hg bundled in the repo.
29 29 syshg files -h >/dev/null 2>/dev/null
30 if [ $? -ne 0 ]; then
31 syshg() {
32 hg "$@"
33 }
34 syshgenv() {
35 :
36 }
30 if [ $? -eq 0 ]; then
31 alias testrepohg=syshg
32 alias testrepohgenv=syshgenv
33 else
34 alias testrepohg=hg
35 alias testrepohgenv=:
37 36 fi
@@ -7,7 +7,8 b''
7 7 New errors are not allowed. Warnings are strongly discouraged.
8 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 12 > sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false
12 13 Skipping i18n/polib.py it has no-che?k-code (glob)
13 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 35 Prevent adding new files in the root directory accidentally.
35 36
36 $ syshg files 'glob:*'
37 $ testrepohg files 'glob:*'
37 38 .editorconfig
38 39 .hgignore
39 40 .hgsigs
@@ -8,8 +8,9 b' Go back in the hg repo'
8 8
9 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
12 > syshg export --git $node | contrib/check-commit > ${TESTTMP}/check-commit.out
11 $ for node in `testrepohg log --rev 'not public() and ::. and not desc("# no-check-commit")' --template '{node|short}\n'`; do
12 > testrepohg export --git $node \
13 > | contrib/check-commit > ${TESTTMP}/check-commit.out
13 14 > if [ $? -ne 0 ]; then
14 15 > echo "Revision $node does not comply with rules"
15 16 > echo '------------------------------------------------------'
@@ -43,5 +43,5 b' Sanity check check-config.py'
43 43
44 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 47 > $PYTHON contrib/check-config.py
@@ -5,20 +5,20 b''
5 5
6 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 9 [1]
10 10
11 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 14 [1]
15 15
16 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 19 [1]
20 20
21 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 24 [1]
@@ -23,7 +23,7 b''
23 23 Check if ":hg:`help TOPIC`" is valid:
24 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 27 > | sed 's|\\|/|g' \
28 28 > | xargs $PYTHON "$TESTTMP/scanhelptopics.py" \
29 29 > | xargs -n1 hg help > /dev/null
@@ -14,7 +14,7 b' these may expose other cycles.'
14 14 Known-bad files are excluded by -X as some of them would produce unstable
15 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 18 > 'tests/**.t' \
19 19 > -X contrib/debugshell.py \
20 20 > -X contrib/python-zstandard/ \
@@ -3,7 +3,8 b''
3 3 $ . "$TESTDIR/helpers-testrepo.sh"
4 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 8 contrib/python-zstandard/setup.py not using absolute_import
8 9 contrib/python-zstandard/setup_zstd.py not using absolute_import
9 10 contrib/python-zstandard/tests/common.py not using absolute_import
@@ -22,7 +23,8 b''
22 23 tests/test-demandimport.py not using absolute_import
23 24
24 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 28 > | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py \
27 29 > | sed 's/[0-9][0-9]*)$/*)/'
28 30 hgext/convert/transport.py: error importing: <*Error> No module named 'svn.client' (error at transport.py:*) (glob)
@@ -38,7 +40,7 b''
38 40 #endif
39 41
40 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 44 > | xargs $PYTHON3 contrib/check-py3-compat.py \
43 45 > | sed 's/[0-9][0-9]*)$/*)/'
44 46 #endif
@@ -6,7 +6,7 b''
6 6 run pyflakes on all tracked files ending in .py or without a file ending
7 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 10 > -X hgext/fsmonitor/pywatchman \
11 11 > -X mercurial/pycompat.py -X contrib/python-zstandard \
12 12 > 2>/dev/null \
@@ -5,11 +5,11 b''
5 5
6 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 9 [1]
10 10
11 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 13 > -X tests/test-check-execute.t \
14 14 > -X tests/test-check-module-imports.t \
15 15 > -X tests/test-check-pyflakes.t \
@@ -21,5 +21,5 b" contain Python but don't end in .py - pl"
21 21
22 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 25 [1]
@@ -170,6 +170,6 b' Check perf.py for historical portability'
170 170
171 171 $ cd "$TESTDIR/.."
172 172
173 $ (syshg files -r 1.2 glob:mercurial/*.c glob:mercurial/*.py;
174 > syshg files -r tip glob:mercurial/*.c glob:mercurial/*.py) |
173 $ (testrepohg files -r 1.2 glob:mercurial/*.c glob:mercurial/*.py;
174 > testrepohg files -r tip glob:mercurial/*.c glob:mercurial/*.py) |
175 175 > "$TESTDIR"/check-perf-code.py contrib/perf.py
@@ -1,7 +1,7 b''
1 1 #require test-repo slow debhelper
2 2
3 3 $ . "$TESTDIR/helpers-testrepo.sh"
4 $ syshgenv
4 $ testrepohgenv
5 5
6 6 Ensure debuild doesn't run the testsuite, as that could get silly.
7 7 $ DEB_BUILD_OPTIONS=nocheck
@@ -1,7 +1,7 b''
1 1 #require test-repo slow docker
2 2
3 3 $ . "$TESTDIR/helpers-testrepo.sh"
4 $ syshgenv
4 $ testrepohgenv
5 5
6 6 Ensure debuild doesn't run the testsuite, as that could get silly.
7 7 $ DEB_BUILD_OPTIONS=nocheck
@@ -21,7 +21,7 b' Testing hghave extensibility for third p'
21 21 > foo
22 22 > EOF
23 23 $ ( \
24 > syshgenv; \
24 > testrepohgenv; \
25 25 > $TESTDIR/run-tests.py $HGTEST_RUN_TESTS_PURE test-hghaveaddon.t \
26 26 > )
27 27 .
@@ -1,7 +1,7 b''
1 1 #require test-repo
2 2
3 3 $ . "$TESTDIR/helpers-testrepo.sh"
4 $ syshgenv
4 $ testrepohgenv
5 5 $ import_checker="$TESTDIR"/../contrib/import-checker.py
6 6
7 7 Run the doctests from the import checker, and make sure
@@ -159,7 +159,7 b' path variables are expanded (~ is the sa'
159 159 > print(' %s' % f)
160 160 > EOF
161 161
162 $ (syshgenv; $PYTHON wixxml.py help )
162 $ ( testrepohgenv; $PYTHON wixxml.py help )
163 163 Not installed:
164 164 help/common.txt
165 165 help/hg-ssh.8.txt
@@ -168,7 +168,7 b' path variables are expanded (~ is the sa'
168 168 help/hgrc.5.txt
169 169 Not tracked:
170 170
171 $ ( syshgenv; $PYTHON wixxml.py templates )
171 $ ( testrepohgenv; $PYTHON wixxml.py templates )
172 172 Not installed:
173 173 Not tracked:
174 174
@@ -1,7 +1,7 b''
1 1 #require test-repo slow osx osxpackaging
2 2
3 3 $ . "$TESTDIR/helpers-testrepo.sh"
4 $ syshgenv
4 $ testrepohgenv
5 5
6 6 $ OUTPUTDIR="`pwd`"
7 7 $ export OUTPUTDIR
General Comments 0
You need to be logged in to leave comments. Login now