[PATCH 0 of 3 RFC] Improve inotify test coverage

Gilles Moris gilles.moris at free.fr
Mon Nov 30 02:30:17 CST 2009


On Saturday 28 November 2009 04:40:09 am Nicolas Dumazet wrote:
> Hello -devel!
>
> I'm trying to run mercurial tests with inotify extension activated.
> This should greatly improve inotify reliability.
>

Thanks for taking a look at this. I think this is a great advance towards 
reliability of the inotify extension, though you already made great 
progresses.

> The first patch adds an --inotify option to run-tests.
> The change to run-tests.py is quite straightforwards. I am however not
> satisfied by the change to cmdutil.py:service(). I need to register all
> pids of daemonized inotify servers to make sure tests do not "bleed" on
> each others. But service() just overwrites the pid-file with the new pid,
> which is not good enough.
> It makes sense on most contexts to keep only one pid per service, but here
> we run several instances, and will need to append the pid instead.
> I am not sure of the right approach here.

I cannot comment too much about this, as I don't know that part of code. I can 
only say that without the --inotify option, 3 tests are already failing due 
to patch 1 (append to PID file):
Failed test-pull-http: output changed
Failed test-push-http: output changed
Failed test-serve: output changed

You have the detail at the end if needed.

FYI, here the errors I have with:
./run-tests.py --inotify --blacklist inotify-failures

Skipped test-casefolding: missing feature: case insensitive file system
Skipped test-convert-baz: missing feature: GNU Arch baz client
Skipped test-convert-bzr: missing feature: Canonical's Bazaar client
Skipped test-convert-bzr-114: missing feature: Canonical's Bazaar client >= 
1.14
Skipped test-convert-bzr-directories: missing feature: Canonical's Bazaar 
client
Skipped test-convert-bzr-ghosts: missing feature: Canonical's Bazaar client
Skipped test-convert-bzr-merges: missing feature: Canonical's Bazaar client
Skipped test-convert-bzr-treeroot: missing feature: Canonical's Bazaar client
Skipped test-convert-darcs: missing feature: darcs client
Skipped test-convert-git: missing feature: git command line client
Skipped test-convert-mtn: missing feature: monotone client (> 0.31)
Skipped test-convert-p4: missing feature: Perforce server and client
Skipped test-convert-p4-filetypes: missing feature: Perforce server and client
Skipped test-convert-tagsbranch-topology: missing feature: git command line 
client
Skipped test-convert-tla: missing feature: GNU Arch tla client
Skipped test-debugcomplete: blacklisted (inotify-failures section)
Skipped test-empty: blacklisted (inotify-failures section)
Skipped test-fncache: blacklisted (inotify-failures section)
Skipped test-globalopts: blacklisted (inotify-failures section)
Skipped test-help: blacklisted (inotify-failures section)
Skipped test-hgrc: blacklisted (inotify-failures section)
Skipped test-inherit-mode: blacklisted (inotify-failures section)
Skipped test-inotify: blacklisted (inotify-failures section)
Skipped test-inotify-debuginotify: blacklisted (inotify-failures section)
Skipped test-inotify-dirty-dirstate: blacklisted (inotify-failures section)
Skipped test-inotify-issue1208: blacklisted (inotify-failures section)
Skipped test-inotify-issue1371: blacklisted (inotify-failures section)
Skipped test-inotify-issue1542: blacklisted (inotify-failures section)
Skipped test-inotify-issue1556: blacklisted (inotify-failures section)
Skipped test-inotify-lookup: blacklisted (inotify-failures section)
Skipped test-no-symlinks: system supports symbolic links
Skipped test-qrecord: blacklisted (inotify-failures section)
Skipped test-strict: blacklisted (inotify-failures section)
Failed test-addremove: output changed
Failed test-branches: output changed
Failed test-children: output changed
Failed test-churn: output changed
Failed test-commit: output changed
Failed test-context.py: output changed
Failed test-convert-hg-source: output changed
Failed test-diff-hashes: output changed
Failed test-dispatch.py: output changed
Failed test-extension: output changed
Failed test-git-export: output changed
Failed test-hgignore: output changed
Failed test-import-eol: output changed
Failed test-issue660: output changed
Failed test-keyword: output changed
Failed test-merge-prompt: output changed
Failed test-merge-types: output changed
Failed test-mq: output changed
Failed test-mq-missingfiles: output changed
Failed test-mq-pull-from-bundle: output changed
Failed test-mq-qnew: output changed
Failed test-mq-symlinks: output changed
Failed test-permissions: output changed
Failed test-pull-http: output changed
Failed test-purge: output changed
Failed test-push-http: output changed
Failed test-rebase-collapse: output changed
Failed test-rebase-parameters: output changed
Failed test-rebase-scenario-global: output changed
Failed test-record: output changed
Failed test-remove: output changed
Failed test-rename: output changed
Failed test-rename-after-merge: output changed and returned error code 1
Failed test-rename-merge1: output changed
Failed test-revert: output changed
Failed test-revlog-ancestry.py: output changed
Failed test-serve: output changed
Failed test-ssh: output changed and returned error code -15
Failed test-ssh-clone-r: output changed and returned error code -15
Failed test-status: output changed
Failed test-status-color: output changed
Failed test-subrepo: output changed
Failed test-symlink-basic: output changed
Failed test-symlink-os-yes-fs-no.py: output changed
Failed test-symlinks: output changed
Failed test-tags: output changed
Failed test-transplant: output changed
# Ran 338 tests, 33 skipped, 47 failed.


>
> I thought of a "appendpid" file parameter:
>
> diff --git a/hgext/inotify/server.py b/hgext/inotify/server.py
> --- a/hgext/inotify/server.py
> +++ b/hgext/inotify/server.py
> @@ -483,4 +483,4 @@
>      service = service()
>      logfile = ui.config('inotify', 'log')
>      cmdutil.service(opts, initfn=service.init, runfn=service.run,
> -                    logfile=logfile, runargs=runargs)
> +                    logfile=logfile, runargs=runargs, appendpid=True)
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -558,7 +558,7 @@
>      return errors
>
>  def service(opts, parentfn=None, initfn=None, runfn=None, logfile=None,
> -    runargs=None):
> +    runargs=None, appendpid=False):
>      '''Run a command as a service.'''
>
>      if opts['daemon'] and not opts['daemon_pipefds']:
> @@ -588,7 +588,8 @@
>          initfn()
>
>      if opts['pid_file']:
> -        fp = open(opts['pid_file'], 'a')
> +        mode = appendpid and 'a' or 'w'
> +        fp = open(opts['pid_file'], mode)
>          fp.write(str(os.getpid()) + '\n')
>          fp.close()
>
>
> but it does not make sense for users launching explicitely
> "hg inserve --pid-file existing" to have a pid appended to "existing".
>
> I am probably looking for something too elegant here, but I'm stuck.
> What would be a good way to implement this? Yet another option to
> inserve command, just for tests?
>
>
> The second patch is an attempt at a test blacklist feature. If I want to
> make inotify tests accessible and useful for you, I need some external
> mechanism to specify which tests are suitable for inotify, otherwise the
> output of run-tests.py --inotify will include unrelated/expected failures.
> The third patch is an example on how I would use this feature, to show what
> kind of expected failures happen with "--inotify". This "blacklist" is
> incomplete, as I'm not done yet with triaging inotify test failures
> (progress is here: http://bitbucket.org/nicdumz/mercurial-crew-mq/wiki/Home
> )
>
> How would you feel about such "blacklists"? If the concept is not
> appropriate, how else can I expose an useful inotify test-suite?
>

I would prefer having separate files for blacklist, with a flat list of test 
names, one per line. This way, we could keep some black list file under 
revision control and other not. For instance, I would like to have a separate 
blacklist for each OS, especially regarding convert sources I do not use. 
The format would also be easier. You can keep the '#' sign for the comments if 
you wish.

> Thanks for your help +)
>
> Nicolas
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Regards.
Gilles.

Errors without --inotify option:

ERROR: test-pull-http output changed
--- Expected output
+++ Test output
@@ -9,4 +9,5 @@
 abort: authorization failed
 pulling from http://localhost/
 searching for changes
+/home/morisgi/Documents/hg.crew/tests/test-pull-http: line 30: kill: 
(14304) - No such process
 % serve errors
!.......
ERROR: test-push-http output changed
--- Expected output
+++ Test output
@@ -10,11 +10,14 @@
 abort: authorization failed
 pushing to http://localhost/
 searching for changes
+/home/morisgi/Documents/hg.crew/tests/test-push-http: line 20: kill: 
(14498) - No such process
 % serve errors
 % expect authorization error: must have authorized user
 abort: authorization failed
 pushing to http://localhost/
 searching for changes
+/home/morisgi/Documents/hg.crew/tests/test-push-http: line 20: kill: 
(14498) - No such process
+/home/morisgi/Documents/hg.crew/tests/test-push-http: line 20: kill: 
(14506) - No such process
 % serve errors
 % expect success
 pushing to http://localhost/
@@ -23,6 +26,9 @@
 adding manifests
 adding file changes
 added 1 changesets with 1 changes to 1 files
+/home/morisgi/Documents/hg.crew/tests/test-push-http: line 20: kill: 
(14498) - No such process
+/home/morisgi/Documents/hg.crew/tests/test-push-http: line 20: kill: 
(14506) - No such process
+/home/morisgi/Documents/hg.crew/tests/test-push-http: line 20: kill: 
(14514) - No such process
 % serve errors
 changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 
HG_SOURCE=serve HG_URL=remote:http
 rolling back last transaction
@@ -30,9 +36,18 @@
 abort: authorization failed
 pushing to http://localhost/
 searching for changes
+/home/morisgi/Documents/hg.crew/tests/test-push-http: line 20: kill: 
(14498) - No such process
+/home/morisgi/Documents/hg.crew/tests/test-push-http: line 20: kill: 
(14506) - No such process
+/home/morisgi/Documents/hg.crew/tests/test-push-http: line 20: kill: 
(14514) - No such process
+/home/morisgi/Documents/hg.crew/tests/test-push-http: line 20: kill: 
(14537) - No such process
 % serve errors
 % expect authorization error: some users denied, users must be authenticated
 abort: authorization failed
 pushing to http://localhost/
 searching for changes
+/home/morisgi/Documents/hg.crew/tests/test-push-http: line 20: kill: 
(14498) - No such process
+/home/morisgi/Documents/hg.crew/tests/test-push-http: line 20: kill: 
(14506) - No such process
+/home/morisgi/Documents/hg.crew/tests/test-push-http: line 20: kill: 
(14514) - No such process
+/home/morisgi/Documents/hg.crew/tests/test-push-http: line 20: kill: 
(14537) - No such process
+/home/morisgi/Documents/hg.crew/tests/test-push-http: line 20: kill: 
(14548) - No such process
 % serve errors
!.....................................
ERROR: test-serve output changed
--- Expected output
+++ Test output
@@ -7,12 +7,26 @@
 % With --prefix foo
 listening at http://localhost/foo/ (bound to 127.0.0.1)
 % errors
+/home/morisgi/Documents/hg.crew/tests/test-serve: line 11: kill: (16663) - No 
such process
+/home/morisgi/Documents/hg.crew/tests/test-serve: line 11: kill: (16668) - No 
such process
 % With --prefix /foo
 listening at http://localhost/foo/ (bound to 127.0.0.1)
 % errors
+/home/morisgi/Documents/hg.crew/tests/test-serve: line 11: kill: (16663) - No 
such process
+/home/morisgi/Documents/hg.crew/tests/test-serve: line 11: kill: (16668) - No 
such process
+/home/morisgi/Documents/hg.crew/tests/test-serve: line 11: kill: (16676) - No 
such process
 % With --prefix foo/
 listening at http://localhost/foo/ (bound to 127.0.0.1)
 % errors
+/home/morisgi/Documents/hg.crew/tests/test-serve: line 11: kill: (16663) - No 
such process
+/home/morisgi/Documents/hg.crew/tests/test-serve: line 11: kill: (16668) - No 
such process
+/home/morisgi/Documents/hg.crew/tests/test-serve: line 11: kill: (16676) - No 
such process
+/home/morisgi/Documents/hg.crew/tests/test-serve: line 11: kill: (16685) - No 
such process
 % With --prefix /foo/
 listening at http://localhost/foo/ (bound to 127.0.0.1)
 % errors
+/home/morisgi/Documents/hg.crew/tests/test-serve: line 11: kill: (16663) - No 
such process
+/home/morisgi/Documents/hg.crew/tests/test-serve: line 11: kill: (16668) - No 
such process
+/home/morisgi/Documents/hg.crew/tests/test-serve: line 11: kill: (16676) - No 
such process
+/home/morisgi/Documents/hg.crew/tests/test-serve: line 11: kill: (16685) - No 
such process
+/home/morisgi/Documents/hg.crew/tests/test-serve: line 11: kill: (16693) - No 
such process
!...................................


More information about the Mercurial-devel mailing list