Mercurial > hg
changeset 20008:e54a078153f7
tests: skip tests that require not having root (issue4089)
This adds a new root hghave to test against. Almost all of these are a
subset of unix-permissions, but that is also used for checking exec
bit handling.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 14 Nov 2013 18:07:43 -0600 |
parents | 23edc6673f0d |
children | 34d720b3b33e |
files | tests/hghave.py tests/test-blackbox.t tests/test-clone.t tests/test-command-template.t tests/test-convert.t tests/test-journal-exists.t tests/test-lock-badness.t tests/test-permissions.t tests/test-phases-exchange.t tests/test-pull-permission.t tests/test-repair-strip.t tests/test-serve.t |
diffstat | 12 files changed, 26 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/hghave.py Thu Nov 14 17:17:44 2013 -0600 +++ b/tests/hghave.py Thu Nov 14 18:07:43 2013 -0600 @@ -233,6 +233,9 @@ finally: os.rmdir(d) +def has_root(): + return os.geteuid() == 0 + def has_pyflakes(): return matchoutput("sh -c \"echo 'import re' 2>&1 | pyflakes\"", r"<stdin>:1: 're' imported but unused", @@ -312,6 +315,7 @@ "p4": (has_p4, "Perforce server and client"), "pyflakes": (has_pyflakes, "Pyflakes python linter"), "pygments": (has_pygments, "Pygments source highlighting library"), + "root": (has_root, "root permissions"), "serve": (has_serve, "platform and python can manage 'hg serve -d'"), "ssl": (has_ssl, "python >= 2.6 ssl module and python OpenSSL"), "svn": (has_svn, "subversion client and admin tools"),
--- a/tests/test-blackbox.t Thu Nov 14 17:17:44 2013 -0600 +++ b/tests/test-blackbox.t Thu Nov 14 18:07:43 2013 -0600 @@ -65,7 +65,7 @@ $ hg rollback repository tip rolled back to revision 1 (undo pull) -#if unix-permissions +#if unix-permissions no-root $ chmod 000 .hg/blackbox.log $ hg --debug incoming warning: cannot write to blackbox.log: Permission denied @@ -98,7 +98,7 @@ (run 'hg update' to get a working copy) a failure reading from the log is fine -#if unix-permissions +#if unix-permissions no-root $ hg blackbox -l 3 abort: Permission denied: $TESTTMP/blackboxtest2/.hg/blackbox.log [255]
--- a/tests/test-clone.t Thu Nov 14 17:17:44 2013 -0600 +++ b/tests/test-clone.t Thu Nov 14 18:07:43 2013 -0600 @@ -543,7 +543,7 @@ $ rm -rf b # work around bug with http clone -#if unix-permissions +#if unix-permissions no-root Inaccessible source @@ -596,7 +596,7 @@ [255] -#if unix-permissions +#if unix-permissions no-root leave existing directory in place after clone failure
--- a/tests/test-command-template.t Thu Nov 14 17:17:44 2013 -0600 +++ b/tests/test-command-template.t Thu Nov 14 18:07:43 2013 -0600 @@ -447,7 +447,7 @@ Error if style not readable: -#if unix-permissions +#if unix-permissions no-root $ touch q $ chmod 0 q $ hg log --style ./q @@ -479,7 +479,7 @@ Error if include fails: $ echo 'changeset = q' >> t -#if unix-permissions +#if unix-permissions no-root $ hg log --style ./t abort: template file ./q: Permission denied [255]
--- a/tests/test-convert.t Thu Nov 14 17:17:44 2013 -0600 +++ b/tests/test-convert.t Thu Nov 14 18:07:43 2013 -0600 @@ -310,7 +310,7 @@ abort: cannot create new bundle repository [255] -#if unix-permissions +#if unix-permissions no-root conversion to dir without permissions should fail
--- a/tests/test-journal-exists.t Thu Nov 14 17:17:44 2013 -0600 +++ b/tests/test-journal-exists.t Thu Nov 14 18:07:43 2013 -0600 @@ -22,7 +22,7 @@ Check that zero-size journals are correctly aborted: -#if unix-permissions +#if unix-permissions no-root $ hg bundle -qa repo.hg $ chmod -w foo/.hg/store/00changelog.i
--- a/tests/test-lock-badness.t Thu Nov 14 17:17:44 2013 -0600 +++ b/tests/test-lock-badness.t Thu Nov 14 18:07:43 2013 -0600 @@ -1,5 +1,4 @@ - $ "$TESTDIR/hghave" unix-permissions || exit 80 - +#if unix-permissions no-root $ hg init a $ echo a > a/a $ hg -R a ci -A -m a @@ -21,4 +20,4 @@ [255] $ chmod 700 a/.hg/store - +#endif
--- a/tests/test-permissions.t Thu Nov 14 17:17:44 2013 -0600 +++ b/tests/test-permissions.t Thu Nov 14 18:07:43 2013 -0600 @@ -1,4 +1,4 @@ - $ "$TESTDIR/hghave" unix-permissions || exit 80 +#ifdef unix-permissions no-root $ hg init t $ cd t @@ -70,3 +70,5 @@ $ chmod +rx dir $ cd .. + +#endif
--- a/tests/test-phases-exchange.t Thu Nov 14 17:17:44 2013 -0600 +++ b/tests/test-phases-exchange.t Thu Nov 14 18:07:43 2013 -0600 @@ -1062,7 +1062,7 @@ | o 0 public a-A - 054250a37db4 -#if unix-permissions +#if unix-permissions no-root Pushing From an unlockable repo --------------------------------
--- a/tests/test-pull-permission.t Thu Nov 14 17:17:44 2013 -0600 +++ b/tests/test-pull-permission.t Thu Nov 14 18:07:43 2013 -0600 @@ -1,4 +1,4 @@ - $ "$TESTDIR/hghave" unix-permissions || exit 80 +#if unix-permissions no-root $ hg init a $ cd a @@ -30,3 +30,5 @@ 1 files, 1 changesets, 1 total revisions $ cd .. + +#endif
--- a/tests/test-repair-strip.t Thu Nov 14 17:17:44 2013 -0600 +++ b/tests/test-repair-strip.t Thu Nov 14 18:07:43 2013 -0600 @@ -1,4 +1,4 @@ - $ "$TESTDIR/hghave" unix-permissions || exit 80 +#if unix-permissions no-root $ echo "[extensions]" >> $HGRCPATH $ echo "mq=">> $HGRCPATH @@ -130,3 +130,5 @@ 2 files, 2 changesets, 2 total revisions $ cd .. + +#endif
--- a/tests/test-serve.t Thu Nov 14 17:17:44 2013 -0600 +++ b/tests/test-serve.t Thu Nov 14 18:07:43 2013 -0600 @@ -45,12 +45,14 @@ With -v and -p daytime (should fail because low port) +#if no-root $ KILLQUIETLY=Y $ hgserve -p daytime abort: cannot start server at 'localhost:13': Permission denied abort: child process failed to start % errors $ KILLQUIETLY=N +#endif With --prefix foo