# HG changeset patch # User timeless # Date 2016-02-08 22:50:19 # Node ID 54c896f8bb799e98f1bfe0a4eb087a72b7e7345d # Parent b5069c2b6f623d738cc27adb3686313bef92a828 run-tests: warn about symlinks to non hg scripts If you symlink /usr/bin/true to /something/hg and try to run --with-hg=/something/hg, run-tests will end up running /usr/bin/hg, not /usr/bin/true. diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -285,7 +285,7 @@ def parseargs(args, parser): options.pure = True if options.with_hg: - options.with_hg = os.path.expanduser(options.with_hg) + options.with_hg = os.path.realpath(os.path.expanduser(options.with_hg)) if not (os.path.isfile(options.with_hg) and os.access(options.with_hg, os.X_OK)): parser.error('--with-hg must specify an executable hg script') diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -21,6 +21,27 @@ Define a helper to avoid the install ste > run-tests.py --with-hg=`which hg` "$@" > } +error paths + +#if symlink + $ ln -s `which true` hg + $ run-tests.py --with-hg=./hg + warning: --with-hg should specify an hg script + + # Ran 0 tests, 0 skipped, 0 warned, 0 failed. + $ rm hg +#endif + +#if execbit + $ touch hg + $ run-tests.py --with-hg=./hg + Usage: run-tests.py [options] [tests] + + run-tests.py: error: --with-hg must specify an executable hg script + [2] + $ rm hg +#endif + a succesful test =======================