[ZCM] [ZC] 1904/ 6 Resolve "zopectl test now (slightly) broken under OS X"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Mon Dec 5 11:56:43 EST 2005


Issue #1904 Update (Resolve) "zopectl test now (slightly) broken under OS X"
 Status Resolved, Zope/bug medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/1904

==============================================================
= Resolve - Entry #6 by efge on Dec 5, 2005 11:56 am

 Status: Pending => Resolved

Checked in for 2.9 and trunk:
http://svn.zope.org/?view=rev&rev=40547
________________________________________
= Comment - Entry #5 by jens on Nov 23, 2005 11:12 am

P.S.: It also correctly preserves the behavior Tres was fixing with his patch, meaning when tests are run inside the zopectl shell you will stay in that shell after the test has finished.

________________________________________
= Comment - Entry #4 by jens on Nov 23, 2005 11:10 am

Light testing with zopectl fg/start/test is looking good, the annoying traceback at the end of a zopectl test run is gone and no processes are left hanging around.

________________________________________
= Comment - Entry #3 by mcdonc on Nov 23, 2005 10:45 am


Uploaded:  "zopectl-macos-eintr.diff"
 - http://www.zope.org/Collectors/Zope/1904/zopectl-macos-eintr.diff/view
An attached patch is a workaround, although it's not clear that it's the right workaround.  Maybe a couple of people can try it out and let me know if you see inappropriate processes cluttering up your process table after zopectl usage on MacOS X.
________________________________________
= Comment - Entry #2 by mcdonc on Nov 23, 2005 10:14 am

FWIW, I think the poster at http://twistedmatrix.com/pipermail/twisted-bugs/2004-September/000444.html has the right idea.  If we were able to register a sigchild signal handler withe SA_RESTART signal flag (which Python does not have the API for apparently), I think this would go away.  Not sure if there's a workaround that does involve writing C.
________________________________________
= Request - Entry #1 by jens on Sep 17, 2005 12:22 pm

Tres checked in a change recently to ensure that a zopectl shell will not exit if you run tests from within it:

svn diff -r 37700:37701 zopectl.py 
Index: zopectl.py
===================================================================
--- zopectl.py  (revision 37700)
+++ zopectl.py  (revision 37701)
@@ -259,7 +259,11 @@
         args.insert(0, self.options.python)
 
         print 'Running tests via: %s' % ' '.join(args)
-        os.execv(self.options.python, args)
+        pid = os.fork()
+        if pid == 0:  # child
+            os.execv(self.options.python, args)
+        else:
+            os.waitpid(pid, 0) 

Unfortunately, this patch will lead to an exit and nasty traceback on OS X, regardless of how zopectl test is run (from a zopectl shell or using "zopectl test --dir FOO, for example):

----------------------------------------------
tiny:/usr/local/zope/28Instance jens$ bin/zopectl test --dir Products/CMFLDAP/
Running tests via: /usr/local/bin/python /usr/local/zope/opt/Zope-2.8.1/bin/test.py -v --config-file /usr/local/zope/28Instance/etc/zope.conf --libdir Products --dir Products/CMFLDAP/
Running unit tests at level 1
Running unit tests from /usr/local/zope/28Instance/Products/CMFLDAP
Parsing /usr/local/zope/28Instance/etc/zope.conf
...................
----------------------------------------------------------------------
Ran 19 tests in 3.510s

OK
Traceback (most recent call last):
  File "/usr/local/zope/opt/Zope-2.8.1/lib/python/Zope2/Startup/zopectl.py", line 314, in ?
    main()
  File "/usr/local/zope/opt/Zope-2.8.1/lib/python/Zope2/Startup/zopectl.py", line 283, in main
    c.onecmd(" ".join(options.args))
  File "/usr/local/lib/python2.3/cmd.py", line 210, in onecmd
    return func(arg)
  File "/usr/local/zope/opt/Zope-2.8.1/lib/python/Zope2/Startup/zopectl.py", line 268, in do_test
    os.waitpid(pid, 0)
OSError: [Errno 4] Interrupted system call
---------------------------------------------

I have played around with a couple different combinations to replace the patch, but could not come up with a combination that prevents the traceback *and* fixes the "testing exits zopectl shell" issue this patch was designed to fix :(

==============================================================



More information about the Zope-Collector-Monitor mailing list