From patchwork Mon Feb 8 23:00:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3,of,3,v3] run-tests: warn about symlinks to non hg scripts From: timeless@mozdev.org X-Patchwork-Id: 13059 Message-Id: <24db61450c0f759843d3.1454972419@waste.org> To: mercurial-devel@mercurial-scm.org Date: Mon, 08 Feb 2016 17:00:19 -0600 # HG changeset patch # User timeless # Date 1454971819 0 # Mon Feb 08 22:50:19 2016 +0000 # Node ID 24db61450c0f759843d34eb07407be703c40880b # Parent d3f1b7ee5e7091afa7bf8059013ddfb3b385a37c 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 @@ 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,22 @@ > run-tests.py --with-hg=`which hg` "$@" > } +error paths + + $ 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 + $ 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 + a succesful test =======================