Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial commit

  • Loading branch information...
commit 3781d4f6312cc097e424548a9396cd3d4b216e93 0 parents
Chris Williams authored
37 Changes
@@ -0,0 +1,37 @@
+minismokebox
+============
+
+0.16 Sun Feb 22 21:32:38 GMT 2009
+ - Specify the POE::Loop::Event dependency explicitly
+ if the user wants Event.
+
+0.14 Fri Feb 6 12:27:53 GMT 2009
+ - Fixed refcount leaks.
+ - Updated dependencies to fixed versions.
+
+0.12 Mon Feb 2 22:12:15 GMT 2009
+ - Added some more env vars that needed setting.
+
+0.10 Mon Feb 2 13:14:06 GMT 2009
+ - Always set AUTOMATED_TESTING env var. Some backends
+ don't set it, so we must. *sigh*
+
+0.08 Thu Jan 29 21:16:38 GMT 2009
+ - added --reverse option
+ - Improved tests
+ - Refined Makefile.PL
+
+0.06 Tue Jan 13 21:04:40 GMT 2009
+ - Fixed META.yml, abstract was wrong.
+
+0.04 Mon Jan 12 16:20:11 GMT 2009
+ - Print out the options we are going to use
+
+0.02 Mon Jan 12 09:48:15 GMT 2009
+ - Initial CPAN 'stable' release
+
+0.01_02 Sat Jan 10 22:47:01 GMT 2009
+ - Slight issue with commandline options. Fixed.
+
+0.01_01 Sat Jan 10 22:09:09 GMT 2009
+ - Initial CPAN developer release
377 LICENSE
@@ -0,0 +1,377 @@
+This software is copyright (c) 2009 by Chris Williams.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as perl itself.
+
+Terms of Perl itself
+
+a) the GNU General Public License as published by the Free
+ Software Foundation; either version 1, or (at your option) any
+ later version, or
+b) the "Artistic License"
+
+--- The GNU General Public License, Version 1, February 1989 ---
+
+This software is Copyright (c) 2009 by Chris Williams.
+
+This is free software, licensed under:
+
+ The GNU General Public License, Version 1, February 1989
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 1, February 1989
+
+ Copyright (C) 1989 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The license agreements of most software companies try to keep users
+at the mercy of those companies. By contrast, our General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. The
+General Public License applies to the Free Software Foundation's
+software and to any other program whose authors commit to using it.
+You can use it for your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Specifically, the General Public License is designed to make
+sure that you have the freedom to give away or sell copies of free
+software, that you receive source code or can get it if you want it,
+that you can change the software or use pieces of it in new free
+programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of a such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must tell them their rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any program or other work which
+contains a notice placed by the copyright holder saying it may be
+distributed under the terms of this General Public License. The
+"Program", below, refers to any such program or work, and a "work based
+on the Program" means either the Program or any work containing the
+Program or a portion of it, either verbatim or with modifications. Each
+licensee is addressed as "you".
+
+ 1. You may copy and distribute verbatim copies of the Program's source
+code as you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this
+General Public License and to the absence of any warranty; and give any
+other recipients of the Program a copy of this General Public License
+along with the Program. You may charge a fee for the physical act of
+transferring a copy.
+
+ 2. You may modify your copy or copies of the Program or any portion of
+it, and copy and distribute such modifications under the terms of Paragraph
+1 above, provided that you also do the following:
+
+ a) cause the modified files to carry prominent notices stating that
+ you changed the files and the date of any change; and
+
+ b) cause the whole of any work that you distribute or publish, that
+ in whole or in part contains the Program or any part thereof, either
+ with or without modifications, to be licensed at no charge to all
+ third parties under the terms of this General Public License (except
+ that you may choose to grant warranty protection to some or all
+ third parties, at your option).
+
+ c) If the modified program normally reads commands interactively when
+ run, you must cause it, when started running for such interactive use
+ in the simplest and most usual way, to print or display an
+ announcement including an appropriate copyright notice and a notice
+ that there is no warranty (or else, saying that you provide a
+ warranty) and that users may redistribute the program under these
+ conditions, and telling the user how to view a copy of this General
+ Public License.
+
+ d) You may charge a fee for the physical act of transferring a
+ copy, and you may at your option offer warranty protection in
+ exchange for a fee.
+
+Mere aggregation of another independent work with the Program (or its
+derivative) on a volume of a storage or distribution medium does not bring
+the other work under the scope of these terms.
+
+ 3. You may copy and distribute the Program (or a portion or derivative of
+it, under Paragraph 2) in object code or executable form under the terms of
+Paragraphs 1 and 2 above provided that you also do one of the following:
+
+ a) accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of
+ Paragraphs 1 and 2 above; or,
+
+ b) accompany it with a written offer, valid for at least three
+ years, to give any third party free (except for a nominal charge
+ for the cost of distribution) a complete machine-readable copy of the
+ corresponding source code, to be distributed under the terms of
+ Paragraphs 1 and 2 above; or,
+
+ c) accompany it with the information you received as to where the
+ corresponding source code may be obtained. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form alone.)
+
+Source code for a work means the preferred form of the work for making
+modifications to it. For an executable file, complete source code means
+all the source code for all modules it contains; but, as a special
+exception, it need not include source code for modules which are standard
+libraries that accompany the operating system on which the executable
+file runs, or for standard header files or definitions files that
+accompany that operating system.
+
+ 4. You may not copy, modify, sublicense, distribute or transfer the
+Program except as expressly provided under this General Public License.
+Any attempt otherwise to copy, modify, sublicense, distribute or transfer
+the Program is void, and will automatically terminate your rights to use
+the Program under this License. However, parties who have received
+copies, or rights to use copies, from you under this General Public
+License will not have their licenses terminated so long as such parties
+remain in full compliance.
+
+ 5. By copying, distributing or modifying the Program (or any work based
+on the Program) you indicate your acceptance of this license to do so,
+and all its terms and conditions.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the original
+licensor to copy, distribute or modify the Program subject to these
+terms and conditions. You may not impose any further restrictions on the
+recipients' exercise of the rights granted herein.
+
+ 7. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of the license which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+the license, you may choose any version ever published by the Free Software
+Foundation.
+
+ 8. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to humanity, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these
+terms.
+
+ To do so, attach the following notices to the program. It is safest to
+attach them to the start of each source file to most effectively convey
+the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19xx name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the
+appropriate parts of the General Public License. Of course, the
+commands you use may be called something other than `show w' and `show
+c'; they could even be mouse-clicks or menu items--whatever suits your
+program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ program `Gnomovision' (a program to direct compilers to make passes
+ at assemblers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
+--- The Artistic License 1.0 ---
+
+This software is Copyright (c) 2009 by Chris Williams.
+
+This is free software, licensed under:
+
+ The Artistic License 1.0
+
+The Artistic License
+
+Preamble
+
+The intent of this document is to state the conditions under which a Package
+may be copied, such that the Copyright Holder maintains some semblance of
+artistic control over the development of the package, while giving the users of
+the package the right to use and distribute the Package in a more-or-less
+customary fashion, plus the right to make reasonable modifications.
+
+Definitions:
+
+ - "Package" refers to the collection of files distributed by the Copyright
+ Holder, and derivatives of that collection of files created through
+ textual modification.
+ - "Standard Version" refers to such a Package if it has not been modified,
+ or has been modified in accordance with the wishes of the Copyright
+ Holder.
+ - "Copyright Holder" is whoever is named in the copyright or copyrights for
+ the package.
+ - "You" is you, if you're thinking about copying or distributing this Package.
+ - "Reasonable copying fee" is whatever you can justify on the basis of media
+ cost, duplication charges, time of people involved, and so on. (You will
+ not be required to justify it to the Copyright Holder, but only to the
+ computing community at large as a market that must bear the fee.)
+ - "Freely Available" means that no fee is charged for the item itself, though
+ there may be fees involved in handling the item. It also means that
+ recipients of the item may redistribute it under the same conditions they
+ received it.
+
+1. You may make and give away verbatim copies of the source form of the
+Standard Version of this Package without restriction, provided that you
+duplicate all of the original copyright notices and associated disclaimers.
+
+2. You may apply bug fixes, portability fixes and other modifications derived
+from the Public Domain or from the Copyright Holder. A Package modified in such
+a way shall still be considered the Standard Version.
+
+3. You may otherwise modify your copy of this Package in any way, provided that
+you insert a prominent notice in each changed file stating how and when you
+changed that file, and provided that you do at least ONE of the following:
+
+ a) place your modifications in the Public Domain or otherwise make them
+ Freely Available, such as by posting said modifications to Usenet or an
+ equivalent medium, or placing the modifications on a major archive site
+ such as ftp.uu.net, or by allowing the Copyright Holder to include your
+ modifications in the Standard Version of the Package.
+
+ b) use the modified Package only within your corporation or organization.
+
+ c) rename any non-standard executables so the names do not conflict with
+ standard executables, which must also be provided, and provide a separate
+ manual page for each non-standard executable that clearly documents how it
+ differs from the Standard Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+4. You may distribute the programs of this Package in object code or executable
+form, provided that you do at least ONE of the following:
+
+ a) distribute a Standard Version of the executables and library files,
+ together with instructions (in the manual page or equivalent) on where to
+ get the Standard Version.
+
+ b) accompany the distribution with the machine-readable source of the Package
+ with your modifications.
+
+ c) accompany any non-standard executables with their corresponding Standard
+ Version executables, giving the non-standard executables non-standard
+ names, and clearly documenting the differences in manual pages (or
+ equivalent), together with instructions on where to get the Standard
+ Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+5. You may charge a reasonable copying fee for any distribution of this
+Package. You may charge any fee you choose for support of this Package. You
+may not charge a fee for this Package itself. However, you may distribute this
+Package in aggregate with other (possibly commercial) programs as part of a
+larger (possibly commercial) software distribution provided that you do not
+advertise this Package as a product of your own.
+
+6. The scripts and library files supplied as input to or produced as output
+from the programs of this Package do not automatically fall under the copyright
+of this Package, but belong to whomever generated them, and may be sold
+commercially, and may be aggregated with this Package.
+
+7. C or perl subroutines supplied by you and linked into this Package shall not
+be considered part of this Package.
+
+8. The name of the Copyright Holder may not be used to endorse or promote
+products derived from this software without specific prior written permission.
+
+9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+The End
+
28 MANIFEST
@@ -0,0 +1,28 @@
+bin/minismokebox
+Changes
+examples/synopsis.pl
+inc/Module/Install.pm
+inc/Module/Install/Base.pm
+inc/Module/Install/Can.pm
+inc/Module/Install/Fetch.pm
+inc/Module/Install/Makefile.pm
+inc/Module/Install/Metadata.pm
+inc/Module/Install/Scripts.pm
+inc/Module/Install/Win32.pm
+inc/Module/Install/WriteAll.pm
+lib/App/SmokeBox/Mini.pm
+lib/POE/Component/SmokeBox/Backend/Test/SmokeBox/Mini.pm
+LICENSE
+Makefile.PL
+MANIFEST This list of files
+META.yml
+README
+t/00_compile.t
+t/01_smokebox_dir.t
+t/02_config_file.t
+t/03_jobs_file.t
+t/04_run.t
+t/05_minismokebox.t
+t/06_xobekomsinim.t
+t/99_pod.t
+t/99_pod_coverage.t
47 Makefile.PL
@@ -0,0 +1,47 @@
+use strict;
+use inc::Module::Install;
+name 'minismokebox';
+author 'Chris Williams <chris@bingosnet.co.uk>';
+version_from 'lib/App/SmokeBox/Mini.pm';
+abstract_from 'bin/minismokebox';
+install_script 'bin/minismokebox';
+license 'perl';
+perl_version '5.006';
+build_requires 'Test::More' => 0.47;
+build_requires 'Test::POE::Server::TCP' => 0.12;
+build_requires 'POE::Filter::HTTP::Parser' => 0.08;
+build_requires 'HTTP::Response' => 0;
+build_requires 'HTTP::Date' => 0;
+requires 'Config::Tiny' => 2.12;
+requires 'File::Spec' => 0;
+requires 'Pod::Usage' => '1.00';
+requires 'Time::Duration' => 1.06;
+requires 'POE' => 1.0001;
+requires 'POE::Component::SmokeBox' => 0.14;
+requires 'POE::Component::SmokeBox::Recent' => 1.12;
+requires 'POE::Component::SmokeBox::Dists' => 0.08;
+if ( !( can_use('Event') and can_use('POE::XS::Queue::Array') ) and can_cc() ) {
+print <<NOTICE;
+
+\a--------------------------------------------------------------
+Hey,
+
+You appear to have a working compiler. I can include 'Event'
+and 'POE::XS::Queue::Array' which will make POE work a lot
+faster.
+
+--------------------------------------------------------------
+
+NOTICE
+
+my $prompt = prompt( 'Do you want to install \'Event\' and \'POE::XS::Queue::Array\' [Y/n]?', 'Y' );
+
+if ( $prompt =~ /^Y/i ) {
+ requires 'POE::Loop::Event' => 0;
+ requires 'Event' => 1.11;
+ requires 'POE::XS::Queue::Array' => 0.005;
+}
+
+}
+clean_files '.smokebox jobs.txt';
+WriteAll();
45 README
@@ -0,0 +1,45 @@
+minismokebox
+============
+
+POE-based framework for automated CPAN Testing.
+
+Supports multiple backends, including:
+
+ - CPAN::YACSmoke
+ - CPANPLUS::YACSmoke
+ - CPAN::Reporter
+
+Installation:
+=============
+
+The minimum version of perl supported is 5.6. This does not preclude CPAN testing of
+perls less than this, as the testing framework and the testing targets are two distinct
+environments.
+
+The included test-suite requires the following modules:
+
+ Test::More 0.47
+ File::Spec 0
+ Test::POE::Server::TCP 0.12
+
+The following modules are required:
+
+ Config::Tiny => 2.12
+ File::Spec => 0
+ Pod::Usage => 1.00
+ Time::Duration => 1.06
+ POE => 1.0001
+ POE::Component::SmokeBox => 0.06
+ POE::Component::SmokeBox::Recent => 1.00;
+ POE::Component::SmokeBox::Dists => 0.08;
+
+The recommended method of installation as always is to use either CPAN or CPANPLUS
+so that the dependencies are automagically dealt with for you and you have the option
+of sending test reports during installation >:)
+
+Status:
+=======
+
+Currently a testing release. Feel free to have a look, try it out, etc.
+
+Any bug reports, feature requests, send an email to bug-minismokebox@rt.cpan.org
281 bin/minismokebox
@@ -0,0 +1,281 @@
+#!perl
+use strict;
+use warnings;
+BEGIN { eval "use Event;"; }
+use App::SmokeBox::Mini;
+$|=1; # Make STDOUT hot
+App::SmokeBox::Mini->run();
+
+__END__
+
+=head1 NAME
+
+minismokebox - a small lightweight SmokeBox
+
+=head1 SYNOPSIS
+
+ minismokebox [options]
+
+ Options:
+ --debug - display all the output from tests as they are run;
+ --help - Display program usage;
+ --version - Display program version;
+ --perl PERL - specify the perl executable to use for testing;
+ --indices - Reload indices before proceeding with testing;
+ --recent - Explictly smoke recent uploads, usually the default;
+ --jobs FILE - Specify a file with modules to be smoked;
+ --backend BACKEND - specify a SmokeBox backend to use;
+ --author PATTERN - specify a CPAN ID to search for modules to smoke;
+ --package PATTERN - specify a search pattern to match against distributions;
+ --phalanx - smoke the Phalanx 100 distributions;
+ --reverse - specify that RECENT uploads are smoked in reverse order;
+ --url URI - The URI of a CPAN mirror to use, default is Funet FTP;
+
+=head1 DESCRIPTION
+
+C<minismokebox> is a lightweight version of SmokeBox that performs CPAN testing on a single
+C<perl> installation.
+
+It is usually installed into a separate C<perl> installation than the C<perl> which is being
+tested, the system C<perl> for instance.
+
+ /usr/bin/minismokebox --perl /home/cpan/sandbox/perl-5.10.0/bin/perl
+
+The above command will run C<minismokebox> which will obtain a list of recently uploaded distributions
+to CPAN and then proceed to C<smoke> each of these distributions against the indicated C<perl>.
+
+C<minismokebox> supports a number of different CPAN Tester frameworks ( in L<POE::Component::SmokeBox>
+parlance a C<backend> ), currently, L<CPANPLUS::YACSmoke>, L<CPAN::Reporter> and L<CPAN::YACSmoke>.
+
+ /usr/bin/minismokebox --perl /home/cpan/sandbox/perl-5.10.0/bin/perl # uses default 'CPANPLUS::YACSmoke'
+
+ /usr/bin/minismokebox --perl /home/cpan/sandbox/perl-5.10.0/bin/perl --backend CPAN::Reporter
+
+ /usr/bin/minismokebox --perl /home/cpan/sandbox/perl-5.10.0/bin/perl --backend CPAN::YACSmoke
+
+C<minismokebox> will C<check> that the selected backend exists in the indicated C<perl> before proceeding
+with the C<smoke> phase. This is very simple check and does not test whether the smoke environment is
+properly configured to send test reports, etc. Consult the applicable documentation for instructions on
+how to configure the testing environment. ( See the links below in L</"SEE ALSO"> ).
+
+=head1 WARNING
+
+There are risks associated with CPAN smoke testing. You are effectively downloading and executing arbitary
+code on your system.
+
+Here are some tips to mitigate the risks:
+
+=over
+
+=item Use a C<sandbox> account
+
+Don't run smoke tests as C<root> or other priviledged user. Create a separate user account to smoke test
+under. For the even more paranoid you can give the C<HOME> directory for this user account a separate
+filesystem.
+
+=item Use a virtualised system
+
+Virtualise your testing environment with Xen, Vmware, VirtualBox, etc. If the system does get hosed you can
+recover it from a snapshot backup very quickly.
+
+=item Chown the C<perl> installation to C<root>
+
+Making sure that the user who is running the smoke testing can't write to the C<perl> installation is a very good
+plan. There have been incidents in the past where a recalcitrant module has managed to trash smoke test
+environments.
+
+=item Monitor your C<TEMP> file area
+
+Keep an eye on the C</tmp> directory, a lot of test-suites leave droppings behind.
+
+=back
+
+=head1 COMMAND LINE OPTIONS
+
+Command line options override options given in the L</"CONFIGURATION FILE">
+
+=over
+
+=item C<--debug>
+
+Turns on all output from the L<POE::Component::SmokeBox::Backend> as distributions are smoked.
+
+=item C<--help>
+
+Displays program usage and exits.
+
+=item C<--version>
+
+Displays the program version and exits.
+
+=item C<--perl PERL>
+
+The path to a C<perl> executable to run the smoke testing against. If this isn't specified C<minismokebox> will
+use C<$^X> to determine the current C<perl> and use that.
+
+=item C<--backend BACKEND>
+
+Specify a particular L<POE::Component::SmokeBox::Backend> to use for smoking. This can be L<CPANPLUS::YACSmoke>,
+L<CPAN::YACSmoke> or L<CPAN::Reporter>. The default if this isn't specified is L<CPANPLUS::YACSmoke>.
+
+=item C<--indices>
+
+Indicates that C<minismokebox> should reindex the particular backend before proceeding with the smoke testing.
+
+=item C<--url URI>
+
+The URI of a CPAN Mirror that C<minismokebox> will use to obtain the recent uploads from or perform C<package>,
+C<author> and C<phalanx> searches against. For consistency this should really match the CPAN Mirror configured in
+the applicable backend you are using.
+
+=back
+
+The following options control where C<minismokebox> obtains a list of distributions to smoke. If none of these are
+specified the default behaviour is C<--recent>. These options are cumulative. For example:
+
+ minismokebox --perl /home/cpan/perl-5.10.0/bin/perl --recent --package '^POE' --author '^BI' --phalanx
+
+This would smoke a list of recent uploads, all distributions that begin with C<POE>, the distributions for each
+CPAN author whose CPAN ID begins with C<BI> and a list of the Phalanx 100 distributions.
+
+=over
+
+=item C<--recent>
+
+Explicitly tell C<minismokebox> to smoke the recent uploads to CPAN. This is the default action if none of the following
+actions are given.
+
+=item C<--reverse>
+
+If specified C<minismokebox> will smoke recent uploads in reverse order.
+
+=item C<--jobs FILE>
+
+Indicate a file where C<minismokebox> should get a list of distributions to smoke from, eg.
+
+ C/CH/CHROMATIC/Acme-Incorporated-1.00.tar.gz
+ B/BI/BINGOS/POE-Component-IRC-5.12.tar.gz
+
+=item C<--package PATTERN>
+
+Specify a string representing a package search to find distributions to smoke. The pattern is a regular expression and is
+applied to the package or distribution name plus version number ( the so called distvname, see L<CPAN::DistnameInfo> ), eg.
+
+ --package '^POE' # find all distributions that begin with POE
+ --package 'IRC' # find all IRC related distributions
+ --package '0.01' # find all distributions that are version 0.01
+ --package '_\d+$' # find all development releases
+
+=item C<--author PATTERN>
+
+Specify a string representing an author search to find distributions to smoke. The pattern is a regular expression and is
+applied to the CPAN ID of CPAN authors. eg.
+
+ --author '^BINGOS$' # find all distributions that belong to BINGOS
+ --author '^BI' # find all distributions that belong to authors beginning with BI
+ --author '^B' # find all distributions for the 'B' authors
+
+=item C<--phalanx>
+
+Specify that you want to smoke the Phalanx '100' distributions, L<http://qa.perl.org/phalanx>.
+
+=back
+
+=head1 CONFIGURATION FILE
+
+A number of the above options may be specified in a configuration file, C<minismokebox>, that is stored in the C<.smokebox>
+directory. See L</"ENVIRONMENT"> for where the C<.smokebox> directory is located and how to effect its location.
+
+Command line options will override options from the configuration file.
+
+The configuration file is parsed using L<Config::Tiny>.
+
+A subset of the command line options can be specified in the configuration file:
+
+=over
+
+=item C<debug>
+
+Set to a true value to turn on all output from the L<POE::Component::SmokeBox::Backend> as distributions are smoked.
+
+ debug=1
+
+=item C<indices>
+
+Set to a true value to indicate that C<minismokebox> should reindex the particular backend before proceeding
+with the smoke testing.
+
+ indices=1
+
+=item C<recent>
+
+Set to a true value to explicitly tell C<minismokebox> to smoke recent uploads to CPAN.
+
+ recent=1
+
+=item C<perl>
+
+Specify the path to the C<perl> executable to use for smoke testing.
+
+ perl=/home/cpan/rel/perl-5.10.0/bin/perl
+
+=item C<backend>
+
+Specify the L<POE::Component::SmokeBox::Backend> to use for smoke testing
+
+ backend=CPAN::Reporter
+
+=item C<url>
+
+The URI of a CPAN Mirror that C<minismokebox> will use to obtain the recent uploads from or perform C<package>,
+C<author> and C<phalanx> searches against. For consistency this should really match the CPAN Mirror configured in
+the applicable backend you are using.
+
+ url=http://www.cpan.org/
+
+=back
+
+=head1 ENVIRONMENT
+
+C<minismokebox> uses the C<.smokebox> directory to locate the configuration file, C<minismokebox>.
+
+This is usually located in the current user's home directory. Setting the environment variable C<PERL5_SMOKEBOX_DIR> will
+effect where the C<.smokebox> directory is located.
+
+=head1 KUDOS
+
+Thanks go to Ricardo SIGNES for L<CPAN::Mini> which inspired the design of this script/module.
+
+=head1 AUTHOR
+
+Chris C<BinGOs> Williams <chris@bingosnet.co.uk>
+
+=head1 LICENSE
+
+Copyright E<copy> Chris Williams
+
+This module may be used, modified, and distributed under the same terms as Perl itself. Please see the license that came with your Perl distribution for details.
+
+=head1 SEE ALSO
+
+L<http://www.cpantesters.org/> - CPAN Testers: Index
+
+L<http://wiki.cpantesters.org/> - CPAN Testers Wiki
+
+L<http://stats.cpantesters.org/> - CPAN Testers Statistics
+
+L<http://lists.cpan.org/showlist.cgi?name=cpan-testers-discuss> - CPAN Testers Discussion Mailing List
+
+L<CPAN::Testers>
+
+L<CPANPLUS::YACSmoke>
+
+L<CPAN::Reporter>
+
+L<CPAN::Reporter::Smoker>
+
+L<CPAN::YACSmoke>
+
+L<POE::Component::SmokeBox>
+
+=cut
6 examples/synopsis.pl
@@ -0,0 +1,6 @@
+#!/usr/binperl
+use strict;
+use warnings;
+BEGIN { eval "use Event;"; }
+use App::SmokeBox::Mini;
+App::SmokeBox::Mini->run();
336 lib/App/SmokeBox/Mini.pm
@@ -0,0 +1,336 @@
+package App::SmokeBox::Mini;
+
+use strict;
+use warnings;
+use Pod::Usage;
+use Config::Tiny;
+use File::Spec;
+use Cwd;
+use Getopt::Long;
+use Time::Duration qw(duration_exact);
+use POE;
+use POE::Component::SmokeBox;
+use POE::Component::SmokeBox::Smoker;
+use POE::Component::SmokeBox::Job;
+use POE::Component::SmokeBox::Dists;
+use POE::Component::SmokeBox::Recent;
+
+use vars qw($VERSION);
+
+use constant CPANURL => 'ftp://ftp.funet.fi/pub/CPAN/';
+
+$VERSION = '0.16';
+
+$ENV{PERL5_MINISMOKEBOX} = $VERSION;
+
+sub _smokebox_dir {
+ return $ENV{PERL5_SMOKEBOX_DIR}
+ if exists $ENV{PERL5_SMOKEBOX_DIR}
+ && defined $ENV{PERL5_SMOKEBOX_DIR};
+
+ my @os_home_envs = qw( APPDATA HOME USERPROFILE WINDIR SYS$LOGIN );
+
+ for my $env ( @os_home_envs ) {
+ next unless exists $ENV{ $env };
+ next unless defined $ENV{ $env } && length $ENV{ $env };
+ return $ENV{ $env } if -d $ENV{ $env };
+ }
+
+ return cwd();
+}
+
+sub _read_config {
+ my $smokebox_dir = File::Spec->catdir( _smokebox_dir(), '.smokebox' );
+ return unless -d $smokebox_dir;
+ my $conf_file = File::Spec->catfile( $smokebox_dir, 'minismokebox' );
+ return unless -e $conf_file;
+ my $Config = Config::Tiny->read( $conf_file );
+ if ( defined $Config->{_} ) {
+ return map { $_, $Config->{_}->{$_} } grep { exists $Config->{_}->{$_} }
+ qw(debug perl indices recent backend url);
+ }
+ return;
+}
+
+sub _get_jobs_from_file {
+ my $jobs = shift || return;
+ unless ( open JOBS, "< $jobs" ) {
+ warn "Could not open '$jobs' '$!'\n";
+ return;
+ }
+ my @jobs;
+ while (<JOBS>) {
+ chomp;
+ push @jobs, $_;
+ }
+ close JOBS;
+ return @jobs;
+}
+
+sub _display_version {
+ print "minismokebox version ", $VERSION,
+ ", powered by POE::Component::SmokeBox ", POE::Component::SmokeBox->VERSION, "\n\n";
+ print <<EOF;
+Copyright (C) 2009 Chris 'BinGOs' Williams
+This module may be used, modified, and distributed under the same terms as Perl itself.
+Please see the license that came with your Perl distribution for details.
+EOF
+ exit;
+}
+
+sub run {
+ my $package = shift;
+ my %config = _read_config();
+ my $version;
+ GetOptions(
+ "h|help" => sub { pod2usage(1); },
+ "v|version" => sub { $version = 1 },
+ "d|debug" => \$config{debug},
+ "p|perl=s" => \$config{perl},
+ "i|indices" => \$config{indices},
+ "r|recent" => \$config{recent},
+ "j|jobs=s" => \$config{jobs},
+ "b|backend=s" => \$config{backend},
+ "a|author=s" => \$config{author},
+ "D|package=s" => \$config{package},
+ "P|phalanx" => \$config{phalanx},
+ "u|url=s" => \$config{url},
+ "R|reverse" => \$config{reverse},
+ ) or pod2usage(2);
+
+ _display_version() if $version;
+
+ $config{perl} = $^X unless $config{perl} and -e $config{perl};
+ $ENV{PERL5_SMOKEBOX_DEBUG} = 1 if $config{debug};
+ $ENV{AUTOMATED_TESTING} = 1; # We need this because some backends do not set it.
+ $ENV{PERL_MM_USE_DEFAULT} = 1; # And this.
+ $ENV{PERL_EXTUTILS_AUTOINSTALL} = '--defaultdeps'; # Got this from CPAN::Reporter::Smoker. Cheers, xdg!
+
+ if ( $config{jobs} and -e $config{jobs} ) {
+ my @jobs = _get_jobs_from_file( $config{jobs} );
+ $config{jobs} = \@jobs if scalar @jobs;
+ }
+
+ print "Running minismokebox with options:\n";
+ printf("%-20s %s\n", $_, $config{$_})
+ for grep { defined $config{$_} } qw(debug indices perl jobs backend author package phalanx reverse url);
+
+ my $self = bless \%config, $package;
+
+ $self->{sbox} = POE::Component::SmokeBox->spawn(
+ smokers => [
+ POE::Component::SmokeBox::Smoker->new(
+ perl => $self->{perl},
+ ),
+ ],
+ );
+
+ $self->{session_id} = POE::Session->create(
+ object_states => [
+ $self => { recent => '_submission', dists => '_submission', },
+ $self => [qw(_start _stop _check _indices _smoke _search)],
+ ],
+ heap => $self,
+ )->ID();
+
+ $poe_kernel->run();
+ return 1;
+}
+
+sub _start {
+ my ($kernel,$self) = @_[KERNEL,OBJECT];
+ $self->{session_id} = $_[SESSION]->ID();
+ # Run a check to make sure the backend exists in the designated perl
+ $kernel->post( $self->{sbox}->session_id(), 'submit', event => '_check', job =>
+ POE::Component::SmokeBox::Job->new(
+ ( $self->{backend} ? ( type => $self->{backend} ) : () ),
+ command => 'check',
+ ),
+ );
+ $self->{stats} = {
+ started => time(),
+ totaljobs => 0,
+ avg_run => 0,
+ min_run => 0,
+ max_run => 0,
+ _sum => 0,
+ idle => 0,
+ excess => 0,
+ };
+ return;
+}
+
+sub _stop {
+ my ($kernel,$self) = @_[KERNEL,OBJECT];
+ $kernel->call( $self->{sbox}->session_id(), 'shutdown' );
+ my $finish = time();
+ my $cumulative = duration_exact( $finish - $self->{stats}->{started} );
+ my @stats = map { $self->{stats}->{$_} } qw(totaljobs idle excess avg_run min_run max_run);
+ $stats[$_] = duration_exact( $stats[$_] ) for 3 .. 5;
+ print "minismokebox started at: \t", scalar localtime($self->{stats}->{started}), "\n";
+ print "minismokebox finished at: \t", scalar localtime($finish), "\n";
+ print "minismokebox ran for: \t", $cumulative, "\n";
+ print "minismokebox tot jobs:\t", $stats[0], "\n";
+ print "minismokebox idle kills:\t", $stats[1], "\n" if $stats[1];
+ print "minismokebox excess kills:\t", $stats[2], "\n" if $stats[2];
+ print "minismokebox avg run: \t", $stats[3], "\n";
+ print "minismokebox min run: \t", $stats[4], "\n";
+ print "minismokebox max run: \t", $stats[5], "\n";
+ return;
+}
+
+sub _check {
+ my ($kernel,$self,$data) = @_[KERNEL,OBJECT,ARG0];
+ my ($result) = $data->{result}->results;
+ unless ( $result->{status} == 0 ) {
+ my $backend = $self->{backend} || 'CPANPLUS::YACSmoke';
+ warn "The specified perl '$self->{perl}' does not have backend '$backend' installed, aborting\n";
+ return;
+ }
+ if ( $self->{indices} ) {
+ $kernel->post( $self->{sbox}->session_id(), 'submit', event => '_indices', job =>
+ POE::Component::SmokeBox::Job->new(
+ ( $self->{backend} ? ( type => $self->{backend} ) : () ),
+ command => 'index',
+ ),
+ );
+ return;
+ }
+ $kernel->yield( '_search' );
+ return;
+}
+
+sub _indices {
+ my ($kernel,$self,$data) = @_[KERNEL,OBJECT,ARG0];
+ my ($result) = $data->{result}->results;
+ unless ( $result->{status} == 0 ) {
+ my $backend = $self->{backend} || 'CPANPLUS::YACSmoke';
+ warn "There was a problem with the reindexing\n";
+ return;
+ }
+ $kernel->yield( '_search' );
+ return;
+}
+
+sub _search {
+ my ($kernel,$self) = @_[KERNEL,OBJECT];
+ if ( $self->{jobs} and ref $self->{jobs} eq 'ARRAY' ) {
+ foreach my $distro ( @{ $self->{jobs} } ) {
+ print "Submitting: $distro\n";
+ $kernel->post( $self->{sbox}->session_id(), 'submit', event => '_smoke', job =>
+ POE::Component::SmokeBox::Job->new(
+ ( $self->{backend} ? ( type => $self->{backend} ) : () ),
+ command => 'smoke',
+ module => $distro,
+ ),
+ );
+ }
+ }
+ if ( $self->{recent} ) {
+ POE::Component::SmokeBox::Recent->recent(
+ url => $self->{url} || CPANURL,
+ event => 'recent',
+ );
+ }
+ if ( $self->{package} ) {
+ warn "Doing a distro search, this may take a little while\n";
+ POE::Component::SmokeBox::Dists->distro(
+ event => 'dists',
+ search => $self->{package},
+ url => $self->{url} || CPANURL,
+ );
+ }
+ if ( $self->{author} ) {
+ warn "Doing an author search, this may take a little while\n";
+ POE::Component::SmokeBox::Dists->author(
+ event => 'dists',
+ search => $self->{author},
+ url => $self->{url} || CPANURL,
+ );
+ }
+ if ( $self->{phalanx} ) {
+ warn "Doing a phalanx search, this may take a little while\n";
+ POE::Component::SmokeBox::Dists->phalanx(
+ event => 'dists',
+ url => $self->{url} || CPANURL,
+ );
+ }
+ return if !$self->{recent} and ( $self->{package} or $self->{author} or $self->{phalanx} or ( $self->{jobs} and ref $self->{jobs} eq 'ARRAY' ) );
+ POE::Component::SmokeBox::Recent->recent(
+ url => $self->{url} || CPANURL,
+ event => 'recent',
+ );
+ return;
+}
+
+sub _submission {
+ my ($kernel,$self,$state,$data) = @_[KERNEL,OBJECT,STATE,ARG0];
+ if ( $data->{error} ) {
+ warn $data->{error}, "\n";
+ return;
+ }
+ if ( $state eq 'recent' and $self->{reverse} ) {
+ @{ $data->{$state} } = reverse @{ $data->{$state} };
+ }
+ foreach my $distro ( @{ $data->{$state} } ) {
+ print "Submitting: $distro\n";
+ $kernel->post( $self->{sbox}->session_id(), 'submit', event => '_smoke', job =>
+ POE::Component::SmokeBox::Job->new(
+ ( $self->{backend} ? ( type => $self->{backend} ) : () ),
+ command => 'smoke',
+ module => $distro,
+ ),
+ );
+ }
+ return;
+}
+
+sub _smoke {
+ my ($kernel,$self,$data) = @_[KERNEL,OBJECT,ARG0];
+ my $dist = $data->{job}->module();
+ my ($result) = $data->{result}->results;
+ print "Distribution: '$dist' finished with status '$result->{status}'\n";
+ my $run_time = $result->{end_time} - $result->{start_time};
+ $self->{stats}->{max_run} = $run_time if $run_time > $self->{stats}->{max_run};
+ $self->{stats}->{min_run} = $run_time if $self->{stats}->{min_run} == 0;
+ $self->{stats}->{min_run} = $run_time if $run_time < $self->{stats}->{min_run};
+ $self->{stats}->{_sum} += $run_time;
+ $self->{stats}->{totaljobs}++;
+ $self->{stats}->{avg_run} = $self->{stats}->{_sum} / $self->{stats}->{totaljobs};
+ $self->{stats}->{idle}++ if $result->{idle_kill};
+ $self->{stats}->{excess}++ if $result->{excess_kill};
+ $self->{_jobs}--;
+ return;
+}
+
+'smoke it!';
+__END__
+
+=head1 NAME
+
+App::SmokeBox::Mini - the guts of the minismokebox command
+
+=head1 SYNOPSIS
+
+ #!/usr/bin/perl
+ use strict;
+ use warnings;
+ BEGIN { eval "use Event;"; }
+ use App::SmokeBox::Mini;
+ App::SmokeBox::Mini->run();
+
+=head2 run
+
+This method is called by L<minismokebox> to do all the work.
+
+=head1 AUTHOR
+
+Chris C<BinGOs> Williams <chris@bingosnet.co.uk>
+
+=head1 LICENSE
+
+Copyright E<copy> Chris Williams
+
+This module may be used, modified, and distributed under the same terms as Perl itself. Please see the license that came with your Perl distribution for details.
+
+=cut
51 lib/POE/Component/SmokeBox/Backend/Test/SmokeBox/Mini.pm
@@ -0,0 +1,51 @@
+package POE::Component::SmokeBox::Backend::Test::SmokeBox::Mini;
+
+use strict;
+use warnings;
+use base qw(POE::Component::SmokeBox::Backend::Base);
+use vars qw($VERSION);
+
+$VERSION = '0.01';
+
+sub _data {
+ my $self = shift;
+ $self->{_data} =
+ {
+ check => [ '-e', 1 ],
+ index => [ '-e', 1 ],
+ smoke => [ '-e', '$|=1; my $module = shift; print $module, qq{\n}; sleep 5; exit 0;' ],
+ };
+ return;
+}
+
+1;
+__END__
+
+=head1 NAME
+
+POE::Component::SmokeBox::Backend::Test::SmokeBox::Mini - a backend to App::SmokeBox::Mini.
+
+=head1 DESCRIPTION
+
+POE::Component::SmokeBox::Backend::Test::SmokeBox::Mini is a L<POE::Component::SmokeBox::Backend> plugin used during the
+L<App::SmokeBox::Mini> tests.
+
+It contains no moving parts.
+
+=head1 AUTHOR
+
+Chris C<BinGOs> Williams
+
+=head1 LICENSE
+
+Copyright C<(c)> Chris Williams.
+
+This module may be used, modified, and distributed under the same terms as Perl itself. Please see the license that came with your Perl distribution for details.
+
+=head1 SEE ALSO
+
+L<POE::Component::SmokeBox::Backend>
+
+=cut
+
+
5 t/00_compile.t
@@ -0,0 +1,5 @@
+use strict;
+use warnings;
+use Test::More tests => 1;
+BEGIN { use_ok( 'App::SmokeBox::Mini' ); };
+diag( "Testing App::SmokeBox::Mini-$App::SmokeBox::Mini::VERSION, Perl $], $^X" );
13 t/01_smokebox_dir.t
@@ -0,0 +1,13 @@
+use strict;
+use warnings;
+use Test::More tests => 1;
+use App::SmokeBox::Mini;
+use Cwd;
+
+$ENV{PERL5_SMOKEBOX_DIR} = cwd();
+
+my $smokebox_dir = App::SmokeBox::Mini::_smokebox_dir();
+
+diag("SmokeBox directory is in '$smokebox_dir'\n");
+
+ok( $smokebox_dir eq cwd(), 'PERL5_SMOKEBOX_DIR' );
34 t/02_config_file.t
@@ -0,0 +1,34 @@
+use strict;
+use warnings;
+use Test::More tests => 7;
+use App::SmokeBox::Mini;
+use File::Spec;
+use Cwd;
+
+$ENV{PERL5_SMOKEBOX_DIR} = cwd();
+my $smokebox_dir = File::Spec->catdir( App::SmokeBox::Mini::_smokebox_dir(), '.smokebox' );
+
+mkdir $smokebox_dir unless -d $smokebox_dir;
+die "$!\n" unless -d $smokebox_dir;
+
+open CONFIG, '> ' . File::Spec->catfile( $smokebox_dir, 'minismokebox' ) or die "$!\n";
+print CONFIG <<EOF;
+debug=1
+perl=/MADE/UP/PATH/TO/perl
+url=http://www.cpan.org/
+backend=CPAN::YACSmoke
+recent=1
+indices=1
+wtf=1
+EOF
+close CONFIG;
+
+my %config = App::SmokeBox::Mini::_read_config();
+
+ok( $config{debug}, 'Debug flag' );
+ok( $config{indices}, 'Indices flag' );
+ok( $config{recent}, 'Recent flag' );
+ok( !$config{wtf}, 'No wtf flag, good' );
+ok( $config{backend} eq 'CPAN::YACSmoke', 'Backend defined' );
+ok( $config{url} eq 'http://www.cpan.org/', 'URL defined' );
+ok( $config{perl} eq '/MADE/UP/PATH/TO/perl', 'perl defined' );
25 t/03_jobs_file.t
@@ -0,0 +1,25 @@
+use strict;
+use warnings;
+use Test::More tests => 5;
+use App::SmokeBox::Mini;
+
+my @tests = qw(
+A/AA/AAU/MRIM/Net-MRIM-1.10.tar.gz
+A/AD/ADAMK/ORLite-1.17.tar.gz
+A/AD/ADAMK/Test-NeedsDisplay-1.06.tar.gz
+A/AD/ADAMK/Test-NeedsDisplay-1.07.tar.gz
+A/AD/ADAMK/YAML-Tiny-1.36.tar.gz
+);
+
+open JOBS, '> jobs.txt' or die "$!\n";
+print JOBS $_, "\n" for @tests;
+close JOBS;
+
+my @jobs = App::SmokeBox::Mini::_get_jobs_from_file( 'jobs.txt' );
+
+foreach my $test ( @tests ) {
+ my $job = shift @jobs;
+ ok( $test eq $job, "$test" );
+}
+
+unlink 'jobs.txt';
37 t/04_run.t
@@ -0,0 +1,37 @@
+use strict;
+use warnings;
+use Test::More tests => 1;
+use App::SmokeBox::Mini;
+use File::Spec;
+use Cwd;
+
+$ENV{PERL5_SMOKEBOX_DIR} = cwd();
+my $smokebox_dir = File::Spec->catdir( App::SmokeBox::Mini::_smokebox_dir(), '.smokebox' );
+
+mkdir $smokebox_dir unless -d $smokebox_dir;
+die "$!\n" unless -d $smokebox_dir;
+
+open CONFIG, '> ' . File::Spec->catfile( $smokebox_dir, 'minismokebox' ) or die "$!\n";
+print CONFIG <<EOF;
+debug=0
+indices=1
+backend=Test::SmokeBox::Mini
+EOF
+close CONFIG;
+
+my @tests = qw(
+A/AA/AAU/MRIM/Net-MRIM-1.10.tar.gz
+A/AD/ADAMK/ORLite-1.17.tar.gz
+A/AD/ADAMK/Test-NeedsDisplay-1.06.tar.gz
+A/AD/ADAMK/Test-NeedsDisplay-1.07.tar.gz
+A/AD/ADAMK/YAML-Tiny-1.36.tar.gz
+);
+
+open JOBS, '> jobs.txt' or die "$!\n";
+print JOBS $_, "\n" for @tests;
+close JOBS;
+
+@ARGV = qw(--jobs jobs.txt);
+ok( App::SmokeBox::Mini->run(), 'App::SmokeBox::Mini->run()' );
+unlink 'jobs.txt';
+exit 0;
160 t/05_minismokebox.t
@@ -0,0 +1,160 @@
+use strict;
+use warnings;
+use Test::More tests => 11;
+use File::Spec;
+use Cwd;
+use POE qw(Wheel::Run Filter::HTTP::Parser);
+use App::SmokeBox::Mini;
+use Test::POE::Server::TCP;
+use HTTP::Date qw( time2str );
+use HTTP::Response;
+
+$ENV{PERL5_SMOKEBOX_DIR} = cwd();
+my $smokebox_dir = File::Spec->catdir( App::SmokeBox::Mini::_smokebox_dir(), '.smokebox' );
+
+mkdir $smokebox_dir unless -d $smokebox_dir;
+die "$!\n" unless -d $smokebox_dir;
+
+open CONFIG, '> ' . File::Spec->catfile( $smokebox_dir, 'minismokebox' ) or die "$!\n";
+print CONFIG <<EOF;
+debug=0
+indices=1
+backend=Test::SmokeBox::Mini
+EOF
+close CONFIG;
+
+my @data = qw(
+MIRRORING.FROM
+RECENT
+RECENT.html
+authors/00whois.html
+authors/00whois.xml
+authors/01mailrc.txt.gz
+authors/02STAMP
+authors/RECENT-1M.yaml
+authors/RECENT-1Q.yaml
+authors/RECENT-1W.yaml
+authors/RECENT-1d.yaml
+authors/RECENT-1h.yaml
+authors/RECENT-6h.yaml
+authors/id/A/AA/AAU/MRIM/CHECKSUMS
+authors/id/A/AA/AAU/MRIM/Net-MRIM-1.10.meta
+authors/id/A/AA/AAU/MRIM/Net-MRIM-1.10.tar.gz
+authors/id/A/AD/ADAMK/CHECKSUMS
+authors/id/A/AD/ADAMK/ORLite-1.17.meta
+authors/id/A/AD/ADAMK/ORLite-1.17.readme
+authors/id/A/AD/ADAMK/ORLite-1.17.tar.gz
+authors/id/A/AD/ADAMK/Test-NeedsDisplay-1.06.meta
+authors/id/A/AD/ADAMK/Test-NeedsDisplay-1.06.readme
+authors/id/A/AD/ADAMK/Test-NeedsDisplay-1.06.tar.gz
+authors/id/A/AD/ADAMK/Test-NeedsDisplay-1.07.meta
+authors/id/A/AD/ADAMK/Test-NeedsDisplay-1.07.readme
+authors/id/A/AD/ADAMK/Test-NeedsDisplay-1.07.tar.gz
+authors/id/A/AD/ADAMK/YAML-Tiny-1.36.meta
+authors/id/A/AD/ADAMK/YAML-Tiny-1.36.readme
+authors/id/A/AD/ADAMK/YAML-Tiny-1.36.tar.gz
+);
+
+my @tests = qw(
+A/AA/AAU/MRIM/Net-MRIM-1.10.tar.gz
+A/AD/ADAMK/ORLite-1.17.tar.gz
+A/AD/ADAMK/Test-NeedsDisplay-1.06.tar.gz
+A/AD/ADAMK/Test-NeedsDisplay-1.07.tar.gz
+A/AD/ADAMK/YAML-Tiny-1.36.tar.gz
+);
+
+POE::Session->create(
+ package_states => [
+ main => [qw(_start _timeout testd_registered testd_client_input _stdout _stderr _child_closed _oops _sig_child)],
+ ],
+);
+
+$poe_kernel->run();
+exit 0;
+
+sub _start {
+ my $heap = $_[HEAP];
+ $heap->{testd} = Test::POE::Server::TCP->spawn(
+ filter => POE::Filter::HTTP::Parser->new( type => 'server' ),
+ address => '127.0.0.1',
+ );
+ my $port = $heap->{testd}->port;
+ $heap->{url} = "http://127.0.0.1:$port/";
+ return;
+}
+
+sub testd_registered {
+ my ($kernel,$heap) = @_[KERNEL,HEAP];
+ $heap->{wheel} = POE::Wheel::Run->new(
+ Program => $^X,
+ ProgramArgs => [ 'bin/minismokebox', '--backend', 'Test::SmokeBox::Mini', '--url', $heap->{url} ],
+ StdoutEvent => '_stdout', # Received data from the child's STDOUT.
+ StderrEvent => '_stderr', # Received data from the child's STDERR.
+ ErrorEvent => '_oops', # An I/O error occurred.
+ CloseEvent => '_child_closed', # Child closed all output handles.
+
+ );
+ $kernel->sig_child( $heap->{wheel}->PID(), '_sig_child' );
+ $kernel->delay( '_timeout', 240 );
+ return;
+}
+
+sub testd_client_input {
+ my ($kernel, $heap, $id, $input) = @_[KERNEL, HEAP, ARG0, ARG1];
+ diag($input->as_string);
+ pass('Got a recent file request');
+ my $resp = HTTP::Response->new( 200 );
+ $resp->protocol('HTTP/1.1');
+ $resp->header('Content-Type', 'text/plain');
+ $resp->header('Date', time2str(time));
+ $resp->header('Server', 'Test-POE-Server-TCP/' . $Test::POE::Server::TCP::VERSION);
+ $resp->header('Connection', 'close');
+ $resp->content( join "\n", @data );
+ use bytes;
+ $resp->header('Content-Length', length $resp->content);
+ $heap->{testd}->send_to_client( $id, $resp );
+ return;
+}
+
+sub _oops {
+ my ($operation, $errnum, $errstr, $wheel_id) = @_[ARG0..ARG3];
+ $errstr = "remote end closed" if $operation eq "read" and !$errnum;
+# warn "Wheel $wheel_id generated $operation error $errnum: $errstr\n";
+# delete $_[HEAP]->{wheel};
+ return;
+}
+
+sub _child_closed {
+ my ($heap, $wheel_id) = @_[HEAP, ARG0];
+ delete $heap->{wheel};
+ return;
+}
+
+sub _stdout {
+ my ($heap, $input, $wheel_id) = @_[HEAP, ARG0, ARG1];
+# print "Child process in wheel $wheel_id wrote to STDOUT: $input\n";
+ if ( $input !~ /^(Submitting|Distribution)/ ) {
+ diag("$input\n");
+ return;
+ }
+ ok( ( scalar grep { $input =~ /\Q$_\E/ } @tests ), $input );
+ return;
+}
+
+sub _stderr {
+ my ($heap, $input, $wheel_id) = @_[HEAP, ARG0, ARG1];
+# diag("Child process in wheel $wheel_id wrote to STDERR: $input\n");
+ diag($input);
+ return;
+}
+
+sub _sig_child {
+ $_[HEAP]->{testd}->shutdown();
+ $poe_kernel->delay( '_timeout' );
+ return $poe_kernel->sig_handled();
+}
+
+sub _timeout {
+ $_[HEAP]->{wheel}->kill();
+ return;
+}
160 t/06_xobekomsinim.t
@@ -0,0 +1,160 @@
+use strict;
+use warnings;
+use Test::More tests => 11;
+use File::Spec;
+use Cwd;
+use POE qw(Wheel::Run Filter::HTTP::Parser);
+use App::SmokeBox::Mini;
+use Test::POE::Server::TCP;
+use HTTP::Date qw( time2str );
+use HTTP::Response;
+
+$ENV{PERL5_SMOKEBOX_DIR} = cwd();
+my $smokebox_dir = File::Spec->catdir( App::SmokeBox::Mini::_smokebox_dir(), '.smokebox' );
+
+mkdir $smokebox_dir unless -d $smokebox_dir;
+die "$!\n" unless -d $smokebox_dir;
+
+open CONFIG, '> ' . File::Spec->catfile( $smokebox_dir, 'minismokebox' ) or die "$!\n";
+print CONFIG <<EOF;
+debug=0
+indices=1
+backend=Test::SmokeBox::Mini
+EOF
+close CONFIG;
+
+my @data = qw(
+MIRRORING.FROM
+RECENT
+RECENT.html
+authors/00whois.html
+authors/00whois.xml
+authors/01mailrc.txt.gz
+authors/02STAMP
+authors/RECENT-1M.yaml
+authors/RECENT-1Q.yaml
+authors/RECENT-1W.yaml
+authors/RECENT-1d.yaml
+authors/RECENT-1h.yaml
+authors/RECENT-6h.yaml
+authors/id/A/AA/AAU/MRIM/CHECKSUMS
+authors/id/A/AA/AAU/MRIM/Net-MRIM-1.10.meta
+authors/id/A/AA/AAU/MRIM/Net-MRIM-1.10.tar.gz
+authors/id/A/AD/ADAMK/CHECKSUMS
+authors/id/A/AD/ADAMK/ORLite-1.17.meta
+authors/id/A/AD/ADAMK/ORLite-1.17.readme
+authors/id/A/AD/ADAMK/ORLite-1.17.tar.gz
+authors/id/A/AD/ADAMK/Test-NeedsDisplay-1.06.meta
+authors/id/A/AD/ADAMK/Test-NeedsDisplay-1.06.readme
+authors/id/A/AD/ADAMK/Test-NeedsDisplay-1.06.tar.gz
+authors/id/A/AD/ADAMK/Test-NeedsDisplay-1.07.meta
+authors/id/A/AD/ADAMK/Test-NeedsDisplay-1.07.readme
+authors/id/A/AD/ADAMK/Test-NeedsDisplay-1.07.tar.gz
+authors/id/A/AD/ADAMK/YAML-Tiny-1.36.meta
+authors/id/A/AD/ADAMK/YAML-Tiny-1.36.readme
+authors/id/A/AD/ADAMK/YAML-Tiny-1.36.tar.gz
+);
+
+my @tests = qw(
+A/AA/AAU/MRIM/Net-MRIM-1.10.tar.gz
+A/AD/ADAMK/ORLite-1.17.tar.gz
+A/AD/ADAMK/Test-NeedsDisplay-1.06.tar.gz
+A/AD/ADAMK/Test-NeedsDisplay-1.07.tar.gz
+A/AD/ADAMK/YAML-Tiny-1.36.tar.gz
+);
+
+POE::Session->create(
+ package_states => [
+ main => [qw(_start _timeout testd_registered testd_client_input _stdout _stderr _child_closed _oops _sig_child)],
+ ],
+);
+
+$poe_kernel->run();
+exit 0;
+
+sub _start {
+ my $heap = $_[HEAP];
+ $heap->{testd} = Test::POE::Server::TCP->spawn(
+ filter => POE::Filter::HTTP::Parser->new( type => 'server' ),
+ address => '127.0.0.1',
+ );
+ my $port = $heap->{testd}->port;
+ $heap->{url} = "http://127.0.0.1:$port/";
+ return;
+}
+
+sub testd_registered {
+ my ($kernel,$heap) = @_[KERNEL,HEAP];
+ $heap->{wheel} = POE::Wheel::Run->new(
+ Program => $^X,
+ ProgramArgs => [ 'bin/minismokebox', '--backend', 'Test::SmokeBox::Mini', '--url', $heap->{url}, '--reverse' ],
+ StdoutEvent => '_stdout', # Received data from the child's STDOUT.
+ StderrEvent => '_stderr', # Received data from the child's STDERR.
+ ErrorEvent => '_oops', # An I/O error occurred.
+ CloseEvent => '_child_closed', # Child closed all output handles.
+
+ );
+ $kernel->sig_child( $heap->{wheel}->PID(), '_sig_child' );
+ $kernel->delay( '_timeout', 240 );
+ return;
+}
+
+sub testd_client_input {
+ my ($kernel, $heap, $id, $input) = @_[KERNEL, HEAP, ARG0, ARG1];
+ diag($input->as_string);
+ pass('Got a recent file request');
+ my $resp = HTTP::Response->new( 200 );
+ $resp->protocol('HTTP/1.1');
+ $resp->header('Content-Type', 'text/plain');
+ $resp->header('Date', time2str(time));
+ $resp->header('Server', 'Test-POE-Server-TCP/' . $Test::POE::Server::TCP::VERSION);
+ $resp->header('Connection', 'close');
+ $resp->content( join "\n", @data );
+ use bytes;
+ $resp->header('Content-Length', length $resp->content);
+ $heap->{testd}->send_to_client( $id, $resp );
+ return;
+}
+
+sub _oops {
+ my ($operation, $errnum, $errstr, $wheel_id) = @_[ARG0..ARG3];
+ $errstr = "remote end closed" if $operation eq "read" and !$errnum;
+# warn "Wheel $wheel_id generated $operation error $errnum: $errstr\n";
+# delete $_[HEAP]->{wheel};
+ return;
+}
+
+sub _child_closed {
+ my ($heap, $wheel_id) = @_[HEAP, ARG0];
+ delete $heap->{wheel};
+ return;
+}
+
+sub _stdout {
+ my ($heap, $input, $wheel_id) = @_[HEAP, ARG0, ARG1];
+# print "Child process in wheel $wheel_id wrote to STDOUT: $input\n";
+ if ( $input !~ /^(Submitting|Distribution)/ ) {
+ diag("$input\n");
+ return;
+ }
+ ok( ( scalar grep { $input =~ /\Q$_\E/ } @tests ), $input );
+ return;
+}
+
+sub _stderr {
+ my ($heap, $input, $wheel_id) = @_[HEAP, ARG0, ARG1];
+# diag("Child process in wheel $wheel_id wrote to STDERR: $input\n");
+ diag($input);
+ return;
+}
+
+sub _sig_child {
+ $_[HEAP]->{testd}->shutdown();
+ $poe_kernel->delay( '_timeout' );
+ return $poe_kernel->sig_handled();
+}
+
+sub _timeout {
+ $_[HEAP]->{wheel}->kill();
+ return;
+}
4 t/99_pod.t
@@ -0,0 +1,4 @@
+use Test::More;
+eval "use Test::Pod 1.00";
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+all_pod_files_ok();
4 t/99_pod_coverage.t
@@ -0,0 +1,4 @@
+use Test::More;
+eval "use Test::Pod::Coverage 1.00";
+plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@;
+all_pod_coverage_ok();
Please sign in to comment.
Something went wrong with that request. Please try again.