subversion-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <eric.b...@barclayscapital.com>
Subject RE: Hooks That Use Perl Test::Builder Having Problems with STDERR
Date Thu, 06 Jan 2011 15:51:30 GMT

________________________________
From: David Weintraub [mailto:qazwart@gmail.com]
Sent: Wednesday, January 05, 2011 6:04 PM
To: Berg, Eric: IT (NYK)
Cc: users@subversion.apache.org
Subject: Re: Hooks That Use Perl Test::Builder Having Problems with STDERR
On Wed, Jan 5, 2011 at 5:03 PM, <eric.berg@barclayscapital.com<mailto:eric.berg@barclayscapital.com>>
wrote:
Dave, if you look into how the hooks work, basically, they are passed a repo path and a transaction
id that, using svnlook, gives you access to copies of the working files, so it doesn't matter
where the hooks run, nor is there any requirement for server/client communication.

I've written quite a few hooks. I have a hook script that implements watches.  8<8<

However, I take it that in order to run the tests, you need these files written to a directory,
and you may need dependent files there too. That starts getting a bit more complex than what
"svnlook" was built for. In theory, you could checkout a working directory on a hook script,
then use "svnlook cat" to update the files that are being committed, and run your tests. It's
complex, and can take a long time.

Nonissue.  We've been doing this with CVS hooks for almost 10 years.  It's "just a port" ;(....
 and I'm not even going to bring up the issues that I will undoubtedly run into when I get
to work on the DEPLOYMENT piece.

Even after all of that, Subversion captures STDOUT and STDERR and they don't get printed out
to a console. If you want to see them, you'll have to capture them and then either write them
to a logfile, or email them.

This is a larger issue for us, specifically WRT the Test::Builder tests that we've implemented.
 The way this was done was to make any Perl class which required tests to be a subclass of
our UnitTest class, which runs any subroutines with names that begin with "test_".  Each of
these has some number of Test::* tests.  With CVS, we see the progress of the tests as they
complete -- whether they succeed or fail.  With SVN, we'd only see failures.

This is where I'm having some issues with the STDERR output.  I haven't dug down deeply enough
understand the impace of the "stacked redirection" of SVN's doing a STDERR/OUT capture, then
the Test::* mods doing their own redirect.  What i have seen is that the only place that the
stderr appears once these tests are run is the web server logs.  A simple test which simply
dies in my precommit hook shows up fine to the client's stderr.

Though I do love immediate checkins, I'm not sure where you're going when you suggest that
our validations might be better handled some way other than by hooks.  That appears to be
the whole reason to have such hooks:  to validate files before allowing a checkin.

How long does it take your pre-commit hook to run? Even a few seconds can seem like an eternity
to a developer who is making a few minor changes. If every time a developer does a commit,
they have to wait, they simply will stop making commits when they should. And, they'll learn
to hate Subversion because it is slow and buggy.

Don't forget that this has been the standard for our checkins here since time immemorial.
  Developers are pretty much used to it, if not simply resigned.  I appreciate the stringent
code validation regime that enforces a number of checks in addition to the unit tests.

It can take from 30 seconds up to several minutes.  For database code, often, actual temporary
deploys are followed by tests to validate what's been deployed are  valid before allowing
the checkins to continue.  Again, this seems like a good place NOT to mention our CVS tag-based
deploys, which can take a VERY long time to deploy to our ~40 db's, etc.
Remember that Subversion is a version control system which means you can undo stuff that should
never have been committed in the first place. Doing tests during the build cycle has lots
of advantages:

I'm in the middle here, being the developer responsible for this porting project.  I mentioned
the deployment stuff too, which I fear, and which I fear is far less appropriate to be implemented
via SVN hooks.  Your input is appreciated.  We could go back-and-forth endlessly, but ultimately,
it's not my decision.  There's a lot of inertia influencing this as well, not to mention that
this is just one of my projects, and that our organization has discontinued support for CVS,
so we're kind of working without a net at the moment.

Not sure how this is going to go, but the input is, again, appreciated.

* You have room to checkout your entire project and have access to all the files. That can
make running your tests much simpler to do.
* You can use Hudson as your framework (or another build server). That means the reporting,
running, and checking the results are all done for you. There's no reinventing the wheel.
 * Your commits are now much faster.
* Your tests have their own environment and won't interfere with Subversion
* You have a complete log of your tests, and you can review it and see if things are improving.
* You have time and resources for more thorough testing
* You can notify the entire team when there's an issue. There's always a good chance that
the problem isn't in the file being committed, but is located elsewhere.
* Most importantly, you'll make your life a lot easier. All you have to do is write the tests
and not worry about how you'll run the tests, or how you'll get the output from the tests.

It is definitely possible to do what you want, but it will take a lot of work and will probably
cause more problems than it is worth..

--
David Weintraub
qazwart@gmail.com<mailto:qazwart@gmail.com>

_______________________________________________

This e-mail may contain information that is confidential, privileged or otherwise protected
from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or
redistribute it by any means. Please delete it and any attachments and notify the sender that
you have received it in error. Unless specifically indicated, this e-mail is not an offer
to buy or sell or a solicitation to buy or sell any securities, investment products or other
financial product or service, an official confirmation of any transaction, or an official
statement of Barclays. Any views or opinions presented are solely those of the author and
do not necessarily represent those of Barclays. This e-mail is subject to terms available
at the following link: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent
to the foregoing.  Barclays Capital is the investment banking division of Barclays Bank PLC,
a company registered in England (number 1026167) with its registered office at 1 Churchill
Place, London, E14 5HP.  This email may relate to or be sent from other members of the Barclays
Group.
_______________________________________________

Mime
View raw message