sapling/tests/test-check-execute.t
Adam Simpkins 55a457de69 tests: use the system hg for examining the local repository
Most test scripts use "hg" to interact with a temporary test repository.
However a few tests also want to run hg commands to interact with the local
repository containing the mercurial source code.  Notably, many of the
test-check-* tests want to check local files and commit messages.

These tests were previously using the version of hg being tested to query the
source repository.  However, this will fail if the source repository requires
extensions or other settings not supported by the version of mercurial being
tested.  The source repository was typically initially cloned using the system
hg installation, so we should use the system hg installation to query it.

There was already a helpers-testrepo.sh script designed to help cope with
different requirements for the source repository versus the test repositories.
However, it only handled the evolve extension.  This new behavior works with
any extensions that are different between the system installation and the test
installation.
2017-06-27 17:24:31 -07:00

25 lines
610 B
Perl

#require test-repo execbit
$ . "$TESTDIR/helpers-testrepo.sh"
$ cd "`dirname "$TESTDIR"`"
look for python scripts without the execute bit
$ syshg files 'set:**.py and not exec() and grep(r"^#!.*?python")'
[1]
look for python scripts with execute bit but not shebang
$ syshg files 'set:**.py and exec() and not grep(r"^#!.*?python")'
[1]
look for shell scripts with execute bit but not shebang
$ syshg files 'set:**.sh and exec() and not grep(r"^#!.*(ba)?sh")'
[1]
look for non scripts with no shebang
$ syshg files 'set:exec() and not **.sh and not **.py and not grep(r"^#!")'
[1]