Compare commits
1 Commits
master
...
stop-on-fa
Author | SHA1 | Date | |
---|---|---|---|
|
27b5e88bde |
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "website"]
|
||||
path = website
|
||||
url = git@github.com:scraperwiki/urchin-website
|
9
AUTHORS
9
AUTHORS
@ -1,9 +0,0 @@
|
||||
Authors
|
||||
-------
|
||||
David Jones
|
||||
Michael Klement
|
||||
Thomas Levine
|
||||
|
||||
Maintainer
|
||||
-------
|
||||
Thomas Levine <_@thomaslevine.com>
|
661
COPYING
661
COPYING
@ -1,661 +0,0 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), 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.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey 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;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero 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 that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
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.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
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.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
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 the public, 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
|
||||
state 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) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, 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 Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
282
HISTORY
282
HISTORY
@ -1,285 +1,5 @@
|
||||
HISTORY
|
||||
=======
|
||||
|
||||
Version 0.2.0 (unstable)
|
||||
---------------------
|
||||
### Cross-OS testing
|
||||
I have started testing Urchin across multiple operating systems.
|
||||
This gives access to more shells, as some shels are easier to install on
|
||||
certain operating systems.
|
||||
|
||||
With this cross-OS test suite, I have extended support to more shells.
|
||||
A later version of Urchin could include a remote testing feature.
|
||||
|
||||
Version 0.1.0 (stable)
|
||||
---------------------
|
||||
This release includes breaking changes.
|
||||
|
||||
### Test root directory
|
||||
We introduce a concept of the root directory of a test suite.
|
||||
Such a concept is important in case you want to run subsets of your
|
||||
test suite, as we need to know how far up to apply the setup
|
||||
and teardown files.
|
||||
|
||||
The Urchin root directory is determined by moving higher in the directory
|
||||
tree in search of a file named `.urchin_root`.
|
||||
The closest directory that contains such a file is considered the root.
|
||||
In the following filesystem, for example, `/a/b/c` would be the root.
|
||||
|
||||
mkdir -p /a/b/c/d
|
||||
touch /a/b/c/d/e
|
||||
chmod +x /a/b/c/d/e
|
||||
touch /a/b/c/.urchin_root
|
||||
urchin /a/b/c/d
|
||||
|
||||
There are two situations in which we would stop looking without having
|
||||
found a `.urchin_root` file.
|
||||
|
||||
1. The system root, `/`, because we can't go any higher
|
||||
2. A directory that starts with a dot, because an urchin call on a higher
|
||||
directory would ignore such a directory
|
||||
|
||||
In either of these cases, Urchin uses the user-specified directory as
|
||||
the root; this is how Urchin `0.0.*` worked.
|
||||
|
||||
### Molly guard
|
||||
The Molly-guard works differently because it now considers the test suite
|
||||
root directory. The point of the Molly-guard originally was to protect
|
||||
you from things like this.
|
||||
|
||||
urchin /
|
||||
|
||||
Urchin would run fine if called on a directory named something like "test",
|
||||
|
||||
urchin test
|
||||
|
||||
and it would fail on directories named something else, like `/`.
|
||||
Unfortunately, it would also fail on directories like this.
|
||||
|
||||
urchin test/database
|
||||
|
||||
It now now looks instead at the basename of the test suite root directory and
|
||||
otherwise ignores the entered directory. Urchin runs without error if the basename contains the phrase "test".
|
||||
|
||||
As before, you can override the Molly guard with `-f`.
|
||||
|
||||
urchin -f build-scripts
|
||||
|
||||
### Consolidation of temporary files in /tmp
|
||||
All of Urchin's temporary files are now stored in /tmp. Urchin previously
|
||||
created `.urchin.log` files alongside the tests, which led to such
|
||||
inconveniences as accidentally commiting them to version control repositories.
|
||||
|
||||
This also means that Urchin will keep all of its temporary files in RAM
|
||||
if you mount a tmpfs on /tmp. On large test suites you may find the tmpfs
|
||||
to be slightly faster than slower storage media like solid-state drives.
|
||||
|
||||
### Skipping of tests
|
||||
Previously, tests were run if they were executable and were otherwise marked
|
||||
as skipped. Now, an executable script can indicate that it is skipped by
|
||||
exiting with code 3. For example, if a test requires some dependancy, it
|
||||
might look for the dependency and then skip if it does not see the dependency.
|
||||
It might look like this.
|
||||
|
||||
#!/bin/sh
|
||||
if ! which inkscape; then
|
||||
exit 3 # status code 3 for skip
|
||||
fi
|
||||
inkscape blah blah ...
|
||||
|
||||
I chose status code 3 sort of arbitrarily at first, but it turns out that it
|
||||
would the appropriate status code if these tests were Nagios plugins, as the
|
||||
concept of skipping a test is similar to the Nagios concept of unknown service
|
||||
status (https://nagios-plugins.org/doc/guidelines.html#AEN78).
|
||||
|
||||
### Parallel test execution
|
||||
Tests now run in parallel when possible.
|
||||
|
||||
Parallel processes come about in two situations when parallel execution is
|
||||
turned on.
|
||||
|
||||
1. All files and immediate subdirectories of one particular directory
|
||||
are run in parallel. This happens recursively; during the execution
|
||||
of each particular subdirectory, that subdirectory's children are
|
||||
also run in parallel.
|
||||
2. When cycling of shells is enabled, execution of a particular file in
|
||||
different shells are run parellel.
|
||||
|
||||
Parallel processing and shell cycling are both enabled by default.
|
||||
|
||||
You may want make only some directories run in series, you can create
|
||||
".urchin_dir" files in those directories.
|
||||
If .urchin_dir contains the phrase "series", run that directory in series
|
||||
rather than in parallel.
|
||||
This is helpful when directories actually need to run in series
|
||||
and also when running all your tests in parallel crashes your computer.
|
||||
|
||||
### Options
|
||||
Long options are now available for all command line flags.
|
||||
For example, the `-s` flag is now available as `--shell` as well.
|
||||
See the help for the full list.
|
||||
|
||||
urchin -h
|
||||
|
||||
### Copyrights
|
||||
Some people had contributed to Urchin but had not been added to the copyright
|
||||
notice. I have updated the copyright notice to include everyone whom I believe
|
||||
to have contributed patches.
|
||||
|
||||
### License
|
||||
I, Thomas Levine, have switched the previous BSD-style license for the Afferro
|
||||
Gnu Public License (AGPL) after determining that the added restrictions in the
|
||||
AGPL shouldn't have any practical legal consequences for people who want to
|
||||
use Urchin. I did not get approval from the other authors as I believe the
|
||||
licenses to be compatible. Here are the considerations that I considered.
|
||||
|
||||
#### History
|
||||
ScraperWiki owns the original version of Urchin (Thomas Levine did the early
|
||||
work as part of his work for ScraperWiki.) and originally licensed it under a
|
||||
BSD-style license with the advertising clauses removed. (This makes it a
|
||||
"2-clause BSD license", similar to the FreeBSD license.) We had the previous
|
||||
license just because that's what ScraperWiki put on everything.
|
||||
|
||||
Other people made changes after this original ScraperWiki version. As of
|
||||
January 2016, they are just Thomas Levine (when he wasn't working for
|
||||
ScraperWiki) and Michael Klement.
|
||||
|
||||
The 2-clause BSD license grants pretty much all rights. It says that you need
|
||||
to attribute when you redistribute source code, but you don't necessarily have
|
||||
to redistribute source code.
|
||||
|
||||
#### License compatibility
|
||||
A copyleft license adds the restriction that modified versions of the code
|
||||
need to be licensed under the same license. GNU licenses in particular require
|
||||
that source code be released if non-source versions are released, and the
|
||||
different GNU licenses differ in what how the non-source version is defined.
|
||||
(The original, GPL, discusses compiled binaries, for example.) Copyleft
|
||||
doesn't mean anything specific for commercial use.
|
||||
|
||||
Code licensed under the 2-clause BSD license can be modified and then licensed
|
||||
as AGPL, because the 2-clause BSD license license allows that, but AGPL code
|
||||
can't be modified as 2-clause BSD, because AGPL doesn't allow that.
|
||||
|
||||
Of course, if we get all of the authors to agree on it, we can always add
|
||||
whatever crazy license we want, regardless of what we have already.
|
||||
|
||||
#### Practical differences
|
||||
The distinction between the permissive 2-clause BSD license and the AGPL seem
|
||||
to matter quite little in the case of Urchin.
|
||||
|
||||
1. Urchin is written in an interpreted language (shell), so it would be
|
||||
hard to distribute usefully without providing the source code.
|
||||
2. Urchin usually just runs tests; it doesn't get compiled with the rest of
|
||||
the code (also because it's in shell). Thus, I think a GPL license on Urchin
|
||||
wouldn't infect the code being tested.
|
||||
|
||||
### Specification of the shell to run tests in
|
||||
Urchin previously had separate methods for setting the TEST_SHELL environment
|
||||
variable and for setting the shell that would run the tests; the former was
|
||||
set as an environment variable, and the latter was set with the -s flag..
|
||||
|
||||
Urchin now uses the -s flag for both of these settings, and it mostly ignores
|
||||
the exported TEST_SHELL variable.
|
||||
|
||||
If you pass -n/--disable-cycling, Urchin will invoke tests ordinarily and will
|
||||
only set the TEST_SHELL variable if it does not exist. If the TEST_SHELL
|
||||
variable is absent, it will be set to /bin/sh.
|
||||
|
||||
Here is how you should write your tests for cross-shell testing, depending on
|
||||
their structure.
|
||||
|
||||
* If you want a test file to run in the same shell every time and to have
|
||||
access to the TEST_SHELL variable, usually for invoking the program that
|
||||
you are testing, then set the file's shebang line.
|
||||
* If you want a test file to be run in a different shell every time, do not
|
||||
set the shebang line. TEST_SHELL variable will be set to correspond with the
|
||||
shell that is presently invoking the test file, though you probably won't
|
||||
need this variable.
|
||||
* If you want a test file to have access to a TEST_SHELL variable that you
|
||||
set yourself, pass -n/--disable-cycling to urchin. Urchin will ignore the
|
||||
shebang lines in this case.
|
||||
|
||||
### Source setup and teardown
|
||||
setup, teardown, setup_dir, and teardown_dir are now sourced instead of
|
||||
executed; they are referenced a bit like this.
|
||||
|
||||
(
|
||||
. ./setup
|
||||
./$thetestfile
|
||||
. ./teardown
|
||||
)
|
||||
|
||||
My intent is that you should be able to export variables in the setup files.
|
||||
I think it would be fine to invoke the teardown files instead of sourcing them,
|
||||
but I chose to source them anyway for consistency.
|
||||
|
||||
The disadvantage of this, and the reason I have been reluctant to do it,
|
||||
is that these files now become much harder to debug, so I recommend keeping
|
||||
your setup and teardown files very simple. I recommend either of the following
|
||||
strategies if your setup file gets complicated.
|
||||
|
||||
1. Rename it to something starting with a dot, and explicitly source it
|
||||
in your test file.
|
||||
2. Export a path in your setup file, rewrite your setup file as a shell
|
||||
program, and put the rewritten file in your path.
|
||||
|
||||
### Run on a file
|
||||
Previously you could run urchin only on a directory (and, in turn, all files
|
||||
in that directory). Now you can run Urchin on a single file.
|
||||
|
||||
This occurred to me when I wanted to run
|
||||
|
||||
urchin test/fast/Unit\ tests/nvm_ls_current
|
||||
|
||||
on the nvm tests. I wound up running this instead.
|
||||
|
||||
urchin test/fast/Unit\ tests/ | grep nvm_ls_current
|
||||
|
||||
But now I don't have to; the first of these commands will work.
|
||||
|
||||
When you run urchin on a file, the test suite root is determined (as with any
|
||||
other Urchin call), and the test suite is recursively descended. Setup and
|
||||
teardown files are sourced, and everything but the specified test file is
|
||||
otherwise ignored.
|
||||
|
||||
If you don't explicitly specify the Urchin root with a .urchin_root file, we
|
||||
consider the test suite root directory to be the parent of the file that
|
||||
you ran Urchin on.
|
||||
|
||||
### Verbose output
|
||||
|
||||
### Timing
|
||||
Urchin now reports the time, in seconds, that each test took and also the
|
||||
total time that it took to run the whole test suite.
|
||||
|
||||
Urchin also allows you to set timeouts, in seconds, with the --timeout flag.
|
||||
If you set a timeout flag and a test file takes longer to run, that run will
|
||||
be killed, and the test will thus fail. The standard error message from the
|
||||
timeout program will show up in the test output.
|
||||
|
||||
Both of these timers use the real time (not the CPU time for example),
|
||||
so the times are not very precise and may be much larger than you expect.
|
||||
|
||||
Version 0.0.6
|
||||
---------------------
|
||||
|
||||
* Produce TAP output with the -t flag.
|
||||
* Add a + sign in front of directories in the normal output so that they
|
||||
line up with non-directories.
|
||||
* Display skipped tests in the normal output and in the TAP output.
|
||||
* Correct some things in the documentation.
|
||||
* Rearrange things in the documentation to be more clear.
|
||||
* Pass the -e flag to exit urchin if any single test fails.
|
||||
* Remove the undocumented, experimental -x flag now that shall exists.
|
||||
* Display version number with the -v flag.
|
||||
* Document why Urchin is called "Urchin"
|
||||
* Update TODO
|
||||
* Support mksh (Change a printf command.)
|
||||
* Make long lines shorter.
|
||||
|
||||
These changes are made somewhat separately in the branches "exit-on-fail",
|
||||
"remove-urchin-x", "tap", and "update-readme". They are rebased into one
|
||||
branch, "tlevine-2016-02", for merging into "master".
|
||||
-------
|
||||
|
||||
Version 0.0.5
|
||||
---------------------
|
||||
|
8
LICENCE
Normal file
8
LICENCE
Normal file
@ -0,0 +1,8 @@
|
||||
Copyright (c) 2012, ScraperWiki Limited
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
8
Makefile
8
Makefile
@ -1,8 +0,0 @@
|
||||
.PHONY: test install
|
||||
|
||||
test:
|
||||
./urchin tests
|
||||
./urchin -s sh -v ./cross-os-tests
|
||||
|
||||
install:
|
||||
cp ./urchin /usr/bin
|
294
TODO
294
TODO
@ -1,294 +0,0 @@
|
||||
Things I want
|
||||
=============
|
||||
|
||||
Wider testing
|
||||
--------------
|
||||
Test in other environments
|
||||
|
||||
* Specify a few different ones with Nix.
|
||||
* Some sort of BSD
|
||||
* Windows
|
||||
|
||||
Packaging
|
||||
------------
|
||||
Package for package managers.
|
||||
|
||||
* I want NixOS, of course.
|
||||
* Debian is probably the big one.
|
||||
|
||||
Other interesting package managers
|
||||
|
||||
* Update the npm package
|
||||
* Homebrew (for Mac)
|
||||
|
||||
Windows
|
||||
----------
|
||||
Try running Urchin in Windows somehow. Interpreters include
|
||||
|
||||
* CygWin (https://www.cygwin.com/)
|
||||
* https://cygwin.com/setup-x86.exe
|
||||
* MSYS (http://mingw.org/wiki/msys)
|
||||
* GNU on Windows (https://github.com/bmatzelle/gow/wiki)
|
||||
* Git for Windows (https://git-scm.com/download/win)
|
||||
* https://github.com/git-for-windows/git/releases/download/v2.7.2.windows.1/Git-2.7.2-32-bit.exe
|
||||
* win-bash (http://win-bash.sourceforge.net/)
|
||||
|
||||
|
||||
shall
|
||||
----------
|
||||
Add shall to my NYC*BUG talk.
|
||||
|
||||
#!/usr/bin/env shall
|
||||
echo This runs in several shells.
|
||||
|
||||
Linters
|
||||
-----------
|
||||
List some shell linters somewhere.
|
||||
|
||||
* ShellCheck
|
||||
* checkbashisms
|
||||
|
||||
|
||||
Rename to something other than "test"?
|
||||
----------
|
||||
Maybe wait until I have a use for this.
|
||||
|
||||
More sort alternatives
|
||||
-----------
|
||||
awk
|
||||
https://stackoverflow.com/questions/20250937/sorting-lines-in-a-file-alphabetically-using-awk-and-or-sed
|
||||
bash
|
||||
https://stackoverflow.com/questions/7442417/how-to-sort-an-array-in-bash
|
||||
|
||||
Alternatives
|
||||
--------------
|
||||
JSON.sh test suite
|
||||
|
||||
Running in multiple environments
|
||||
-----------------------------------
|
||||
Setup for other environments includes the following.
|
||||
|
||||
* Installing packages
|
||||
* `touch .zshrc`
|
||||
* Copy urchin and tests
|
||||
|
||||
|
||||
Fixtures
|
||||
------------
|
||||
I want to change the way that fixtures are done.
|
||||
|
||||
Instead of using setup, teardown, &c., use ordinary programs from within
|
||||
your tests. For example.
|
||||
|
||||
# tests/.fixtures/tmp-dir
|
||||
tmp=$(mktemp -d)
|
||||
cd $tmp
|
||||
@$
|
||||
code=$?
|
||||
cd /
|
||||
rm -Rf $tmp
|
||||
exit $code
|
||||
|
||||
# tests/blah
|
||||
../.fixtures/tmp-dir 'blah blah blah'
|
||||
|
||||
It's best if I can wrap a bunch of commands in braces or paratheses
|
||||
rather than just one command. Is there a nice way to do that?
|
||||
|
||||
Once I have this new way, I guess I might as well keep the old way.
|
||||
I think the setup, teardown thing can be easier if you only have simple
|
||||
fixtures. And since I'm going to keep it, I'm going to add another one.
|
||||
|
||||
* setup_dir runs once for the present directory.
|
||||
* setup_children runs once for each child.
|
||||
* setup_file runs once for each file descendent.
|
||||
|
||||
The present `setup` is renamed to `setup_children`, and the new
|
||||
`setup_file` runs on each file (not directory) that is a child,
|
||||
grandchild, great-grandchild, and so on.
|
||||
|
||||
Dependency checking
|
||||
----------------------
|
||||
You might want to skip tests based on dependencies. Currently you can
|
||||
conditionally skip tests one at a time by exiting with code 3. I want to
|
||||
be able to skip an entire directory.
|
||||
|
||||
So we add a new magic file called `dep`. If it exists, it is run before
|
||||
everything else in the directory.
|
||||
|
||||
* If it exits with code 0, tests continue as if dep did not exist.
|
||||
* If it exits with code 3, all tests in the directory are marked as
|
||||
skipped.
|
||||
* If it exits with code 1, all tests in the directory are marked as
|
||||
failed. To make the implementation easier, I'll probably treat the
|
||||
directory as a single test in this case.
|
||||
|
||||
A note on magic files
|
||||
-------------------------
|
||||
It is nice to have access to things like setup and dep (magic files)
|
||||
once in a while, but you need to be doing rather substantial testing
|
||||
before they make your test suite simpler; the documentation should
|
||||
strongly recommend writing your tests without magic files and then
|
||||
refactoring and only then considering moving things to magic files.
|
||||
|
||||
Remote testing
|
||||
----------------
|
||||
In order to test Urchin across multiple operating systems, I have
|
||||
already added tests in Urchin's test suite that run Urchin tests in
|
||||
remote servers. I would like to move this to Urchin itself so that
|
||||
Urchin can test other things on remote servers.
|
||||
|
||||
Urchin's output presently looks like this.
|
||||
|
||||
Cycling with the following shells: sh bash dash mksh zsh
|
||||
Running tests at 2016-04-07T12:33:49
|
||||
|
||||
Flags/
|
||||
> --timeout output
|
||||
. bash (0 seconds)
|
||||
. dash (0 seconds)
|
||||
. mksh (0 seconds)
|
||||
. sh (0 seconds)
|
||||
. zsh (0 seconds)
|
||||
|
||||
Done, took 1 second.
|
||||
5 tests passed.
|
||||
0 tests skipped.
|
||||
0 tests failed.
|
||||
|
||||
After the change, the output should look like this.
|
||||
|
||||
Cycling with the following shells: sh dash mksh
|
||||
Running tests at 2016-04-07T12:33:49
|
||||
|
||||
Flags/
|
||||
> --timeout output
|
||||
. dash on localhost (0 seconds)
|
||||
. dash on localhost:8080 (0 seconds)
|
||||
. dash on tlevine@hpux.polarhome.com (0 seconds)
|
||||
. mksh on localhost (0 seconds)
|
||||
. mksh on tlevine@hpux.polarhome.com (0 seconds)
|
||||
. sh on localhost (0 seconds)
|
||||
. sh on localhost:8080 (0 seconds)
|
||||
. sh on tlevine@hpux.polarhome.com (0 seconds)
|
||||
|
||||
Done, took 1 second.
|
||||
8 tests passed.
|
||||
0 tests skipped.
|
||||
0 tests failed.
|
||||
|
||||
This is just how the output should look; the tests run in whatever order
|
||||
makes sense.
|
||||
|
||||
Bugs
|
||||
-------
|
||||
|
||||
Both md5sum and md5 should be supported.
|
||||
|
||||
Trouble logging in to hpux, irix, miros, netbsd, tru64, qnx, ....
|
||||
|
||||
$ rsync -e 'ssh -p 785' urchin tlevine@hpux.polarhome.com:.blah
|
||||
HP-UX hpux.polarhome.com B.11.11 U 9000/785 (ta)
|
||||
Welcome to HPUX/PA... member of polarhome.com realm
|
||||
|
||||
bash: rsync: command not found
|
||||
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
|
||||
rsync error: remote command not found (code 127) at io.c(226)
|
||||
[sender=3.1.1]
|
||||
|
||||
|
||||
OpenIndiana grep does not support -q
|
||||
|
||||
I get `/urchin: syntax error at line 84: \`}' unexpected` on
|
||||
unixware and solaris.
|
||||
|
||||
mktemp
|
||||
|
||||
> tlevine@hpux.polarhome.com -p 785
|
||||
F sh (8 seconds)
|
||||
|
|
||||
| HP-UX hpux.polarhome.com B.11.11 U 9000/785 (ta)
|
||||
| Welcome to HPUX/PA... member of polarhome.com realm
|
||||
|
|
||||
|
|
||||
| HP-UX hpux.polarhome.com B.11.11 U 9000/785 (ta)
|
||||
| Welcome to HPUX/PA... member of polarhome.com realm
|
||||
|
|
||||
| mktemp: option requires an argument -- d
|
||||
| ./urchin[96]: /tmp/tlevinea21441/log: Cannot create the specified file.
|
||||
|
||||
date
|
||||
|
||||
tlevine@hpux64$ ./urchin tests/ -n -vv
|
||||
date: bad format character - s
|
||||
|
||||
So I need a portable seconds-from epoch
|
||||
|
||||
I also need to handle when no arguments are passed to urchin.
|
||||
|
||||
Exit code is wrong for which on HP-UX
|
||||
|
||||
## `$(...)`
|
||||
Solaris doesn't support `$(...)`; you need `\`...\`` instead.
|
||||
|
||||
tlevine@solaris$ ./urchin --run-in-series tests/Errors/
|
||||
./urchin: syntax error at line 84: `tmp=$' unexpected
|
||||
|
||||
I use this a lot.
|
||||
|
||||
$ grep -c '\$(' urchin
|
||||
52
|
||||
|
||||
Darn
|
||||
|
||||
|
||||
|
||||
|
||||
Update tests to support
|
||||
|
||||
* md5
|
||||
* rsync
|
||||
* mktemp
|
||||
* epoch
|
||||
* Report cycling by default
|
||||
* New format for reporting cycling
|
||||
|
||||
|
||||
|
||||
|
||||
Support systems without rsync
|
||||
|
||||
|
||||
BSD mktemp
|
||||
|
||||
| NetBSD 6.1.3
|
||||
| Welcome to NetBSD ...member of polarhome.com realm
|
||||
|
|
||||
| Usage: mktemp [-dqu] [-p <tmpdir>] {-t prefix | template ...}
|
||||
| mkdir: : No such file or directory
|
||||
| ./urchin: cannot create /log: permission denied
|
||||
|
||||
|
||||
NetBSD
|
||||
|
||||
md5: unknown option -- q
|
||||
usage: cksum [-n] [-a algorithm [-ptx] [-s string]] [-o 1|2]
|
||||
[file ... | -c [-w] [sumfile]]
|
||||
|
||||
|
||||
|
||||
|
||||
Things I can use to make things better
|
||||
------------------------
|
||||
${x##*blah}
|
||||
$IFS and set --
|
||||
Redirection, especiall <<-
|
||||
Maybe fifo
|
||||
for x in "$@"
|
||||
until
|
||||
readonly
|
||||
getopts
|
||||
|
||||
Variable assignments specified with special built-in utilities remain in
|
||||
effect after the built-in completes; this shall not be the case with a
|
||||
regular built-in or other utility.
|
@ -1,14 +0,0 @@
|
||||
params="$(basename "${0}")"
|
||||
|
||||
hostname="$(echo "${params}" | cut -d\ -f1)"
|
||||
if echo "${params}" | grep -q \ ; then
|
||||
flags="$(echo "${params}" | cut -d\ -f2-)"
|
||||
fi
|
||||
|
||||
urchin_dir=.urchin-cross-shell-test
|
||||
|
||||
rsync --archive -e "ssh ${flags}" $RSYNC_FLAGS \
|
||||
../urchin ../tests "${hostname}":"${urchin_dir}" ||
|
||||
scp -r ${flags} ../urchin ../tests "${hostname}":"${urchin_dir}"
|
||||
ssh "${hostname}" ${flags} \
|
||||
"cd ${urchin_dir} && ./urchin --run-in-series tests"
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
# apt-get install bash dash ksh posh pdksh mksh yash zsh
|
||||
. ./.run
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
RSYNC_FLAGS='--rsync-path=/usr/local/bin/rsync'
|
||||
. ./.run
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
# SSH public key needs to be in ~/.etc/ssh/authorized_keys
|
||||
. ./.run
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
15
cross-shell-tests
Executable file
15
cross-shell-tests
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
# Run urchin in a bunch of different shells,
|
||||
# including a shell that isn't quite POSIX-compatible (zsh)
|
||||
|
||||
for shell in dash bash ksh zsh; do
|
||||
if which $shell > /dev/null 2> /dev/null; then
|
||||
echo
|
||||
echo Running urchin tests in $shell
|
||||
$shell urchin tests | tail -n 3
|
||||
else
|
||||
echo
|
||||
echo Skipping $shell because it is not in the PATH
|
||||
fi
|
||||
done
|
||||
echo
|
98
docs/SORTING
98
docs/SORTING
@ -1,98 +0,0 @@
|
||||
On the criteria for ordering
|
||||
==============================
|
||||
|
||||
I was confused by the documentation for sort's "-d" flag. This confusion
|
||||
relates to GNU coreutil's locale-specific sort. [^]
|
||||
|
||||
Below I discuss sort order differences between different implementations
|
||||
of sort and of sh "*" for my particular environments.
|
||||
|
||||
Sorting with sort
|
||||
------------
|
||||
Consider the following two sort commands.
|
||||
|
||||
printf '@ b\n- d\n? a\n~ c\n! e\n' | sort
|
||||
printf '@ b\n- d\n? a\n~ c\n! e\n' | sort -d
|
||||
|
||||
With BusyBox v1.23.2 on NixOS 15.09, the first of these commands returns
|
||||
ASCIIbetical order,
|
||||
|
||||
! e
|
||||
- d
|
||||
? a
|
||||
@ b
|
||||
~ c
|
||||
|
||||
and the second returns dictionary order.
|
||||
|
||||
? a
|
||||
@ b
|
||||
~ c
|
||||
- d
|
||||
! e
|
||||
|
||||
With GNU coreutils version 8.24 on NixOS, both commands return
|
||||
dictionary order. The same is true for GNU coreutils version 8.23 on
|
||||
Debian Wheezy.
|
||||
|
||||
? a
|
||||
@ b
|
||||
~ c
|
||||
- d
|
||||
! e
|
||||
|
||||
IEEE Std 1003.1, 2013 Edition [^^] specifies that the "-d" flag should
|
||||
enable dictionary order. All of these versions of sort have clear
|
||||
documentation about the order that should be returned when the "-d" flag
|
||||
is set, (See --help, man, or info.) and the implementations match the
|
||||
documentation as far as I can tell.
|
||||
|
||||
I have found no explicit documentation from any relevant source as to
|
||||
what the default sort order should be. On the other hand, they all
|
||||
suggest that "-d" produces an order different from the default order.
|
||||
|
||||
In GNU coreutils 8.24, for example, "-d" is a direction to "consider
|
||||
only blanks and alphanumeric characters". It lacks any mention that the
|
||||
"-d" flag has no effect or that it is the default. Furthermore, on my
|
||||
first reading, I took it to mean that the default is to consider all
|
||||
characters and that "-d" limits the considered characters to blanks and
|
||||
alphanumeric characters.
|
||||
|
||||
|
||||
Sorting in *
|
||||
-------------
|
||||
I think this is related to the order returned by "*" in sh.
|
||||
The following sh code creates several files in a directory and then
|
||||
calls "*", listing them in order.
|
||||
|
||||
printf '@ b\n- d\n? a\n~ c\n! e\n' | while read line; do
|
||||
touch -- "${line}"
|
||||
done
|
||||
for file in *; do echo "$file"; done
|
||||
|
||||
On one computer, running FreeBSD, the order is apparently
|
||||
ASCIIbetical.
|
||||
|
||||
! e
|
||||
- d
|
||||
? a
|
||||
@ b
|
||||
~ c
|
||||
|
||||
On two GNU systems, running NixOS and Debian, respectively, output is
|
||||
in dictionary order. I'm not exactly sure what dictionary order is, but
|
||||
it is something like sorting on the alphabetical characters before
|
||||
sorting on the rest of the line.
|
||||
|
||||
? a
|
||||
@ b
|
||||
~ c
|
||||
- d
|
||||
! e
|
||||
|
||||
(I don't really know what dictionary order is, I was able to determine
|
||||
that the above results are in dictionary order because of my investigation of
|
||||
incompatible implementations of sort.)
|
||||
|
||||
[^] https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#Sort-does-not-sort-in-normal-order_0021
|
||||
[^^] http://pubs.opengroup.org/onlinepubs/9699919799/
|
@ -1,109 +0,0 @@
|
||||
Here I discuss Urchin's general execution flow and how it is handled
|
||||
specifically when tests are run on remote environments.
|
||||
|
||||
|
||||
Steps of an Urchin run
|
||||
----------------------
|
||||
When Urchin runs a directory of files, it goes through the following
|
||||
steps.
|
||||
|
||||
1. Head
|
||||
2. Test
|
||||
3. Foot
|
||||
4. Reporting
|
||||
|
||||
Urchin stores files in a temporary directory, creating a new directory
|
||||
on each invocation. The directory contains these things.
|
||||
|
||||
* head (file)
|
||||
* test (file)
|
||||
* foot (file)
|
||||
* stdout (directory)
|
||||
|
||||
When run on remotes, the temporary directory corresponding to the local
|
||||
master process additionally has these files.
|
||||
|
||||
* remote-test
|
||||
|
||||
Messages from the head, test, and foot steps go in the corresponding
|
||||
files. In the head and foot phases, messages are just simple prints.
|
||||
Messages from the test phase always correspond to a particular test
|
||||
file, and they are written to the test file in a delimiter-separated
|
||||
format.
|
||||
|
||||
Stdout and stderr from test runs are written to files in the stdout
|
||||
directory, one file per test file per shell that the file is run in.
|
||||
|
||||
The reporting phase
|
||||
----------------------
|
||||
In most cases Urchin begins printing to the screen only during the
|
||||
reporting phase. The only case where anything is printed beforehand is
|
||||
when Urchin is run with -vvvv; that sets "+x", so the commands are
|
||||
printed as they run, though all other output is still suppressed.
|
||||
|
||||
Test results are reported in the reporting phase. Four output formats
|
||||
are available.
|
||||
|
||||
1. Urchin's human-readable format (default)
|
||||
2. Test Anything Protocol
|
||||
3. Delimiter-separated values (used internally)
|
||||
4. Remote Urchin worker output
|
||||
|
||||
Most of the output is generated based on the delimiter-separated values
|
||||
in the test log file. The first two formats also include stdout and
|
||||
stderr from the tests, depending on verbosity level flags; when it needs
|
||||
these, Urchin reads them from appropriate files in the temporary
|
||||
directory.
|
||||
|
||||
I could discuss the further details of each format elsewhere.
|
||||
|
||||
Remotes
|
||||
----------------------
|
||||
When Urchin runs tests on a remote, it copies tests to the remote and
|
||||
then calls Urchin on the remote with "--format=remote". This specifies
|
||||
the following.
|
||||
|
||||
* The temporary directory should be kept, rather than deleted, after
|
||||
Urchin runs.
|
||||
* The path of the temporary directory should be printed as output.
|
||||
* No other output should be printed to stdout.
|
||||
|
||||
After the remote Urchin finishes running, the local urchin downloads
|
||||
the remote Urchin's test log file from the temporary directory.
|
||||
It modifies the file to include the remote's name and then concatenates
|
||||
the result to the "remote-test" file in the local temporary directory.
|
||||
For example, the file from the remote might look like this,
|
||||
|
||||
:sh:Counting tests/.test/faila:0:not_ok
|
||||
|
||||
and the result might look like this.
|
||||
|
||||
nsa:sh:Counting tests/.test/faila:0:not_ok
|
||||
|
||||
This gets processed in the reporting step like usual, according to
|
||||
whatever format is specified. Instead of printing just "sh" as the
|
||||
environment in which the particular test was run, the report will print
|
||||
"sh on nsa".
|
||||
|
||||
When it needs the stdout files, it prints them over ssh.
|
||||
|
||||
New flags
|
||||
----------
|
||||
In making this remotes feature, I wound up adding some others.
|
||||
|
||||
-r, --remote SSH host to use as a remote
|
||||
-F, --format Output format, one of "urchin", "tap", "dsv", "remote"
|
||||
|
||||
Urchin runs only locally by default. If you pass at least one --remote
|
||||
flag, Urchin runs tests only on the specified remotes; it can't run both
|
||||
locally and remotely in the same run. If you want to do that, you could
|
||||
wait until I add that feature, or you can add "localhost" as a remote.
|
||||
|
||||
Settings that I'm thinking about
|
||||
|
||||
* Port for rsync/ssh
|
||||
* SSH protocol version
|
||||
* --rsync-path
|
||||
|
||||
Can those all be set in ssh_config? Probably not --rsync-path, but
|
||||
I guess I could just fix it on the remote.
|
@ -1,9 +0,0 @@
|
||||
with import <nixpkgs> {}; {
|
||||
urchin = stdenv.mkDerivation {
|
||||
name = "urchin";
|
||||
buildInputs = [
|
||||
busybox
|
||||
bash dash mksh zsh
|
||||
];
|
||||
};
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
# A NixOS container to protect against accidental fork bombs
|
||||
#
|
||||
# Put this in /var/lib/containers/test/etc/nixos/configuration.nix
|
||||
# See https://nixos.org/wiki/NixOS:Containers
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{ boot.isContainer = true;
|
||||
networking.hostName = mkDefault "urchin";
|
||||
networking.useDHCP = false;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
# Urchin
|
||||
bash dash mksh zsh
|
||||
busybox
|
||||
|
||||
# Other
|
||||
vim git rsync tmux
|
||||
];
|
||||
security.pam.loginLimits = [
|
||||
# Prevent accidental fork bombs.
|
||||
{ domain = "*"; item = "nproc"; type = "hard"; value = "200"; }
|
||||
];
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
passwordAuthentication = false;
|
||||
};
|
||||
users.extraUsers.user = {
|
||||
name = "tlevine";
|
||||
uid = 1000;
|
||||
isNormalUser = true;
|
||||
home = "/home/tlevine";
|
||||
extraGroups = [ "users" "wheel" ];
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGvQyzr42/96acUTUedaeM2ee+DMt9bkxeurdeXji9sNE10MjjAUFtxPmSI8/BUZW2/a9ByblfaJEI+H+kFVPjVr+QGKXZluxcFMj2BLbH53fi9xLgoQRjb2aAXutb2Bp74/E8R1K+CuFfRRGQ5Spdnv44SLt04D6JbBLcLIcWTpQ4v5RaYr2U27jfiF9z0m+/opxvowEy2gnqlEXFxFk8jZHT4K0uLWm2ENjT6OpyOx8hWcKeAN2vRVRex3pJfSzswn0LpuCrM1rUZ4DRE+FABi8N21Q3MBaMRkwnZPwaZwKzv06q8bu23jYTqK5BrUPtOXeeVuroQXMc12H/6/Nh laptop"
|
||||
];
|
||||
};
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Create the container.
|
||||
if ! nixos-container list | grep ^urchin$ > /dev/null; then
|
||||
sudo nixos-container create urchin
|
||||
fi
|
||||
|
||||
# Configure the container.
|
||||
sudo cp configuration.nix \
|
||||
/var/lib/containers/urchin/etc/nixos/configuration.nix
|
||||
sudo nixos-container update urchin
|
||||
sudo nixos-container start urchin
|
||||
|
||||
# Create the git repository.
|
||||
host="tlevine@$(nixos-container show-ip urchin)"
|
||||
ssh "${host}" 'if mkdir urchin 2> /dev/null; then
|
||||
cd urchin
|
||||
git init
|
||||
git config --add receive.denyCurrentBranch ignore
|
||||
fi
|
||||
'
|
||||
|
||||
# Push to the git repository
|
||||
git push "${host}":urchin
|
||||
|
||||
# Print information
|
||||
echo "Log in:
|
||||
|
||||
ssh ${host}
|
||||
|
||||
Add git remote
|
||||
|
||||
git remote add ${host} container
|
||||
|
||||
"
|
@ -12,7 +12,7 @@
|
||||
"bin": "./urchin",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://git.sdf.org/tlevine/urchin"
|
||||
"url": "git://github.com/tlevine/urchin.git"
|
||||
},
|
||||
"keywords": [
|
||||
"shell",
|
1
packages/.gitignore
vendored
1
packages/.gitignore
vendored
@ -1 +0,0 @@
|
||||
*.tar.gz
|
@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
name=urchin-$(../urchin --version)
|
||||
|
||||
tmp=$(mktemp -d)
|
||||
mkdir $tmp/$name
|
||||
cp ../urchin ../readme.md ../AUTHORS ../COPYING $tmp/$name
|
||||
cd $tmp
|
||||
tar czf $name.tar.gz $name
|
||||
cd - > /dev/null
|
||||
mv $tmp/$name.tar.gz .
|
||||
rm -R $tmp
|
161
readme.md
161
readme.md
@ -1,62 +1,40 @@
|
||||
**The repository at https://github.com/tlevine/urchin will go away. New location is https://git.sdf.org/tlevine/urchin.**
|
||||
|
||||
__ _
|
||||
__ ____________/ /_ (_)___
|
||||
/ / / / ___/ ___/ __ \/ / __ \
|
||||
/ /_/ / / / /__/ / / / / / / /
|
||||
\__,_/_/ \___/_/ /_/_/_/ /_/
|
||||
|
||||
Urchin is a portable shell program that runs a directory of Unix-style
|
||||
programs and produces pretty output. It is normally used for testing
|
||||
shell programs, where each test case corresponds to a single file in
|
||||
the directory that Urchin runs.
|
||||
|
||||
Urchin is called "Urchin" because
|
||||
[sea urchins](https://en.wikipedia.org/wiki/Sea_urchin)
|
||||
have shells called "tests".
|
||||
Urchin is a test framework for shell. It is implemented in
|
||||
portable /bin/sh and should work on GNU/Linux, Mac OS X, and
|
||||
other Unix platforms.
|
||||
|
||||
## Try it out
|
||||
Urchin's tests are written in Urchin, so you can run them to see what Urchin
|
||||
is like. Clone the repository
|
||||
|
||||
git clone https://git.sdf.org/tlevine/urchin
|
||||
git clone git://github.com/tlevine/urchin.git
|
||||
|
||||
Run the tests
|
||||
|
||||
cd urchin
|
||||
./urchin tests
|
||||
|
||||
## Dependencies
|
||||
Urchin depends on the following programs.
|
||||
The above command will run the tests in your system's default
|
||||
shell, /bin/sh (on recent Ubuntu this is dash, but it could be
|
||||
ksh or bash on other systems); to test urchin's cross-shell compatibility,
|
||||
run this:
|
||||
|
||||
* sh
|
||||
* echo
|
||||
* printf
|
||||
* mktemp
|
||||
* readlink
|
||||
* basename
|
||||
* dirname
|
||||
* sed
|
||||
* grep
|
||||
* cut
|
||||
* true
|
||||
* false
|
||||
* which
|
||||
* timeout
|
||||
* sort
|
||||
cd urchin
|
||||
./cross-shell-tests
|
||||
|
||||
Vanilla installations of modern BSD and GNU systems usually include all
|
||||
of these programs.
|
||||
|
||||
## Install
|
||||
Urchin is contained in a single file, so you can install it by copying it to a
|
||||
directory in your `PATH`. For example, you can run the following as root.
|
||||
## Globally
|
||||
Download Urchin like so (as root) (or use npm, below):
|
||||
|
||||
cd /usr/local/bin
|
||||
wget https://git.sdf.org/tlevine/urchin/raw/branch/master/urchin
|
||||
wget https://raw.github.com/tlevine/urchin/master/urchin
|
||||
chmod +x urchin
|
||||
|
||||
Urchin can be installed with npm too.
|
||||
Can be installed with npm too:
|
||||
|
||||
npm install -g urchin
|
||||
|
||||
@ -98,47 +76,24 @@ and directories have special meanings.
|
||||
teardown
|
||||
|
||||
Directories are processed in a depth-first order. When a particular directory
|
||||
is processed, `setup_dir` is sourced before everything else in the directory,
|
||||
including subdirectories. `teardown_dir` is sourced after everything else in
|
||||
the directory.
|
||||
is processed, `setup_dir` is run before everything else in the directory, including
|
||||
subdirectories. `teardown_dir` is run after everything else in the directory.
|
||||
|
||||
A directory's `setup` file, if it exists, is sourced right before each test
|
||||
file within the particular directory is run, and the `teardown` file is
|
||||
sourced right after.
|
||||
A directory's `setup` file, if it exists, is run right before each test file
|
||||
within the particular directory, and the `teardown` file is run right after.
|
||||
|
||||
Files are only run if they are executable, and files beginning with `.` are
|
||||
ignored. Thus, fixtures and libraries can be included sloppily within the test
|
||||
directory tree. The test passes if the file exits 0; otherwise, it fails.
|
||||
|
||||
urchin looks for files within a directory in the following manner,
|
||||
In case you care about the order in which your tests execute, consider that
|
||||
urchin looks for files within a directory in the following manner.
|
||||
|
||||
for file in *; do
|
||||
do_something_with_test_file $file
|
||||
done
|
||||
|
||||
so files are run in whatever order `*` produces. The order is
|
||||
configured in your environment, at least in
|
||||
[GNU systems](https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#Sort-does-not-sort-in-normal-order_0021).
|
||||
Other systems may ignore the locales configured in the environment and
|
||||
always produce ASCIIbetical order.
|
||||
|
||||
Results are always printed in ASCIIbetical order, regardless of what
|
||||
order the tests ran in.
|
||||
|
||||
Below you can see how the locale can affect the order.
|
||||
|
||||
$ printf '!c\n@a\n~b\n' | LC_COLLATE=C sort
|
||||
!c
|
||||
@a
|
||||
~b
|
||||
$ printf '!c\n@a\n~b\n' | LC_COLLATE=en_US.UTF-8 sort
|
||||
@a
|
||||
~b
|
||||
!c
|
||||
$ printf '!c\n@a\n~b\n' | sort -d
|
||||
@a
|
||||
~b
|
||||
!c
|
||||
Tests within a directory are executed in whatever order `*` returns.
|
||||
|
||||
### Writing cross-shell compatibility tests for testing shell code
|
||||
|
||||
@ -151,55 +106,69 @@ The specific approach depends on your test scenario:
|
||||
* (b) Your scripts _source_ scripts containing portable shell code.
|
||||
|
||||
#### (a) Cross-shell tests with test scripts that _invoke_ shell scripts
|
||||
Urchin sets the `TEST_SHELL` environment variable so that you may change the
|
||||
shell with which your tests call other shell programs. To run your test
|
||||
scripts in multiple shells you must call `$TEST_SHELL` in your tests and then
|
||||
run urchin with the appropriate option.
|
||||
|
||||
First, consider using [shall](https://github.com/mklement0/shall).
|
||||
|
||||
#!/usr/bin/env shall
|
||||
echo This is a test file.
|
||||
|
||||
Alternatively, you can use urchin's built-in recognition of the
|
||||
`TEST_SHELL` environment variable.
|
||||
In your test scripts, invoke the shell scripts to test via the shell
|
||||
specified in environment variable `TEST_SHELL` rather than directly;
|
||||
e.g.: `$TEST_SHELL ../foo bar` (rather than just `../foo bar`).
|
||||
Note that if you alsow want your test scripts to work when run directly,
|
||||
outside of Urchin, be sure to target scripts that happen to be in the
|
||||
current directory with prefix `./`; e.g., `$TEST_SHELL ./baz`
|
||||
(rather than `$TEST_SHELL baz`).
|
||||
|
||||
Urchin runs tests in multiple different shells by default; Urchin has a
|
||||
list of default shells, and the following command will run your tests in
|
||||
all of those shells that Urchin detects.
|
||||
Then, on invocation of Urchin, prepend a definition of environment variable
|
||||
`TEST_SHELL` specifying the shell to test with, e.g.: `TEST_SHELL=zsh urchin ./tests`.
|
||||
To test with multiple shells in sequence, use something like:
|
||||
|
||||
./urchin ./tests
|
||||
|
||||
You can override the default list of shells with the `-s` flag.
|
||||
|
||||
urchin -s sh -s ksh ./tests
|
||||
|
||||
You can also
|
||||
for shell in sh bash ksh zsh; do
|
||||
TEST_SHELL=$shell urchin ./tests
|
||||
done
|
||||
|
||||
If `TEST_SHELL` has no value, Urchin defines it as `/bin/sh`, so the test
|
||||
scripts can rely on `$TEST_SHELL` always containing a value when Urchin runs
|
||||
them.
|
||||
|
||||
That said, we still recommand that you account for the possibility that
|
||||
`$TEST_SHELL` does not contain a value so that you may run your test scripts
|
||||
without Urchin. Supporting this case is very simple; when you invoke scripts
|
||||
that happen to be in the current directory, be sure to use the prefix `./`,
|
||||
e.g., `$TEST_SHELL ./baz` rather than `$TEST_SHELL baz`.
|
||||
scripts can rely on `$TEST_SHELL` always containing a value.
|
||||
|
||||
#### (b) Cross-shell tests with test scripts that _source_ shell scripts
|
||||
|
||||
If you _source_ shell code in your test scripts, it is the test scripts
|
||||
themselves that must be run with the shell specified.
|
||||
|
||||
Urchin supports the `-s <shell>` option, which instructs
|
||||
To that end, Urchin supports the `-s <shell>` option, which instructs
|
||||
Urchin to invoke the test scripts with the specified shell; e.g., `-s bash`.
|
||||
(In addition, Urchin sets environment variable `TEST_SHELL` to the specified
|
||||
shell.)
|
||||
|
||||
Note that only test scripts that either have no shebang line at all or
|
||||
have shebang line `#!/bin/sh` are invoked with the specified shell.
|
||||
This allows non-shell test scripts or test scripts for other languages
|
||||
or for specific shells to coexist with those whose invocation should be
|
||||
controlled by `-s`.
|
||||
This allows non-shell test scripts or test scripts for specific
|
||||
shells to coexist with those whose invocation should be controlled by `-s`.
|
||||
|
||||
## References
|
||||
To test with multiple shells in sequence, use something like:
|
||||
|
||||
On shell programming
|
||||
for shell in sh bash ksh zsh; do
|
||||
urchin -s $shell ./tests
|
||||
done
|
||||
|
||||
* http://blackskyresearch.net/shelltables.txt
|
||||
* http://blackskyresearch.net/try.sh.txt
|
||||
<!--
|
||||
#### (c) Cross shell tests with `urchin -x` (experimental)
|
||||
If you run urchin with the `-x` flag, it will be as if you ran
|
||||
`$TEST_SHELL`. Unless `$TEST_SHELL` isn't set, in which case it'll
|
||||
be as if you ran `/bin/sh`. Putting this in she shebang line might
|
||||
eventually work out to be a cleaner way of doing cross-shell testing.
|
||||
|
||||
#!/usr/bin/env urchin -x
|
||||
test a = a
|
||||
|
||||
It might make sense if you do this.
|
||||
|
||||
export TEST_SHELL=zsh && urchin -x
|
||||
export TEST_SHELL=bash && urchin -x
|
||||
-->
|
||||
## Alternatives to Urchin
|
||||
Alternatives to Urchin are discussed in
|
||||
[this blog post](https://blog.scraperwiki.com/2012/12/how-to-test-shell-scripts/).
|
||||
|
@ -1,2 +1,2 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
exit 0
|
3
tests/.example-test-suite/this should fail
Executable file
3
tests/.example-test-suite/this should fail
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -f / ]
|
3
tests/.example-test-suite/this should pass
Executable file
3
tests/.example-test-suite/this should pass
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -e / ]
|
2
tests/.gitignore
vendored
Normal file
2
tests/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.urchin.log
|
||||
.urchin_stdout
|
1
tests/.print-arg-3
Normal file
1
tests/.print-arg-3
Normal file
@ -0,0 +1 @@
|
||||
echo $3
|
@ -1 +0,0 @@
|
||||
series
|
6
tests/A nonempty CDPATH should not break urchin.
Executable file
6
tests/A nonempty CDPATH should not break urchin.
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd ..
|
||||
export CDPATH=$PWD
|
||||
./urchin -f 'tests/urchin exit code' >/dev/null
|
||||
|
3
tests/Command-line help contents/The -f flag should be documented.
Executable file
3
tests/Command-line help contents/The -f flag should be documented.
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
../../urchin -h|grep -- -f
|
3
tests/Command-line help contents/The -s option should be documented.
Executable file
3
tests/Command-line help contents/The -s option should be documented.
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
../../urchin -h | grep -- -s
|
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
../../urchin -h
|
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
! ../../urchin
|
@ -1 +0,0 @@
|
||||
true
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
$TEST_SHELL ../../urchin -s sh .test-one | grep '1 test failed'
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
$TEST_SHELL ../../urchin -s sh .test-one | grep '1 test passed'
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
$TEST_SHELL ../../urchin -s sh .test | grep '7 tests passed.'
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
$TEST_SHELL ../../urchin -s sh .test | grep '3 tests failed.'
|
0
tests/.urchin_root → tests/Counts should be kept of successes and failures./.test-one/pass
Normal file → Executable file
0
tests/.urchin_root → tests/Counts should be kept of successes and failures./.test-one/pass
Normal file → Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
../../urchin .test-one | grep '1 test failed'
|
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
../../urchin .test-one | grep '1 test passed'
|
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
../../urchin .test | grep '7 tests passed.'
|
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
../../urchin .test | grep '3 tests failed.'
|
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Assuming that urchin was invoked with `TEST_SHELL=bash urchin ...`, $TEST_SHELL should contain 'bash'.
|
||||
|
||||
echo "\$TEST_SHELL: $TEST_SHELL"
|
||||
|
||||
[ "$TEST_SHELL" = 'bash' ]
|
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/awk -f
|
||||
|
||||
# This script will only succeed if it is indeed processed by awk.
|
||||
|
||||
BEGIN { print "ok" }
|
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Assuming that urchin was invoked with `-s bash`, this script should be being run with bash.
|
||||
|
||||
this_shell=$(ps -o comm= -p $$ && :)
|
||||
|
||||
echo "Running shell: $this_shell"
|
||||
|
||||
[ "$this_shell" = 'bash' ]
|
||||
|
@ -1,10 +1,10 @@
|
||||
# By design, this file has no shebang line.
|
||||
set -e
|
||||
|
||||
# Assuming that urchin was invoked with `-s bash`, this script should be being run with bash.
|
||||
|
||||
this_shell="$(ps -o pid,comm | sed -n "s/^ *$$//p" | cut -d\ -f2)"
|
||||
this_shell=$(ps -o comm= -p $$ && :)
|
||||
|
||||
echo "Running shell: $this_shell"
|
||||
|
||||
basename "$this_shell" | grep .special-shell
|
||||
[ "$this_shell" = 'bash' ]
|
||||
|
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Assuming that urchin was invoked with `-s bash`, $TEST_SHELL should contain 'bash'.
|
||||
|
||||
echo "Running shell: $(ps -o comm= -p $$ && :)"
|
||||
|
||||
echo "\$TEST_SHELL: $TEST_SHELL"
|
||||
|
||||
[ "$TEST_SHELL" = 'bash' ]
|
@ -3,6 +3,7 @@
|
||||
# Tests support for either passing through or defining a default value for environment variable TEST_SHELL.
|
||||
# (for test scripts that want to invoke shell scripts with a specified shell).
|
||||
|
||||
which bash 2>/dev/null || { echo "Cannot test -s option: bash cannot be located." >&2; exit 1; }
|
||||
|
||||
# Test if $TEST_SHELL, when placed in urchin's environment, is passed through to the test scripts.
|
||||
TEST_SHELL=.special-shell $TEST_SHELL \
|
||||
../../urchin --disable-cycling ./.test-TEST_SHELL-passed-through
|
||||
TEST_SHELL=bash ../../urchin ./.test-TEST_SHELL-passed-through
|
@ -5,5 +5,4 @@
|
||||
|
||||
# Test if $TEST_SHELL - if *defined, but empty* - is exported with value '/bin/sh' by urchin
|
||||
# and thus has that value inside the scripts.
|
||||
TEST_SHELL= $TEST_SHELL \
|
||||
../../urchin ./.test-TEST_SHELL-undefined_or_empty
|
||||
TEST_SHELL= ../../urchin ./.test-TEST_SHELL-undefined_or_empty
|
@ -5,7 +5,5 @@
|
||||
|
||||
# Test if $TEST_SHELL - if *undefined* - is exported with value '/bin/sh' by urchin
|
||||
# and thus has that value inside test scripts.
|
||||
|
||||
s="$TEST_SHELL"
|
||||
unset -v TEST_SHELL
|
||||
"$s" ../../urchin ./.test-TEST_SHELL-undefined_or_empty
|
||||
../../urchin ./.test-TEST_SHELL-undefined_or_empty
|
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Tests the `-s <shell> option, which invokes shebang-less and sh-shebang-line test scripts with the specified shell (for testing *sourced* shell code).
|
||||
|
||||
which bash >/dev/null || { echo "Cannot test -s option: bash cannot be located." >&2; exit 2; }
|
||||
which /usr/bin/awk >/dev/null || { echo "Cannot test -s option: /usr/bin/awk not found." >&2; exit 2; }
|
||||
|
||||
../../urchin -s bash ./.test-run-by-specified-shell
|
@ -1 +0,0 @@
|
||||
/bin/sh
|
@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Assuming that urchin was invoked with this,
|
||||
#
|
||||
# TEST_SHELL=$PWD/.special-shell urchin ...
|
||||
#
|
||||
# $TEST_SHELL should contain '.special-shell'
|
||||
|
||||
echo "\$TEST_SHELL: $TEST_SHELL"
|
||||
|
||||
basename "$TEST_SHELL" | grep '.special-shell'
|
@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env true
|
||||
true will processed the contents of this script, but that
|
||||
means that nothing will happen and the script will exit 0
|
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Assuming that urchin was invoked with `-s bash`,
|
||||
# this script should be being run with bash.
|
||||
|
||||
ps -o pid,comm,args | grep $$ | grep .special-shell
|
@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Assuming that urchin was invoked with `-s bash`, $TEST_SHELL should contain 'bash'.
|
||||
|
||||
this_shell=$(ps -o pid,comm | sed -n "s/^ *$$//p" | cut -d\ -f2)
|
||||
echo "Running shell: $this_shell"
|
||||
|
||||
echo "\$TEST_SHELL: $TEST_SHELL"
|
||||
|
||||
echo "$TEST_SHELL" | grep .special-shell
|
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Tests the `-s <shell> option, which invokes shebang-less test scripts with
|
||||
# the specified shell (for testing *sourced* shell code).
|
||||
../../urchin -s .special-shell ./.test-run-by-specified-shell
|
@ -1 +0,0 @@
|
||||
export PATH="$PWD:$PATH"
|
@ -1 +0,0 @@
|
||||
false
|
@ -1 +0,0 @@
|
||||
true
|
@ -1 +0,0 @@
|
||||
$TEST_SHELL ../../urchin '.test/This test passes'
|
@ -1 +0,0 @@
|
||||
$TEST_SHELL ../../urchin '.test/This test skips'
|
@ -1,2 +0,0 @@
|
||||
$TEST_SHELL ../../urchin '.test/This test fails'
|
||||
test $? -eq 1
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
../../../urchin $testdir
|
||||
test 1 -eq $?
|
@ -1,4 +0,0 @@
|
||||
tmp=$(mktemp -d)
|
||||
export testdir=$tmp/tests
|
||||
mkdir -p $testdir
|
||||
touch $testdir/.urchin
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
../../../urchin $testdir 2>&1 | grep -i 'no.*found'
|
@ -1 +0,0 @@
|
||||
rm -R $tmp
|
@ -1,2 +0,0 @@
|
||||
$TEST_SHELL ../../urchin --not-a-flag
|
||||
test $? -eq 11
|
@ -1,2 +1,3 @@
|
||||
#!/bin/sh
|
||||
. ./.run
|
||||
|
||||
exit 0
|
3
tests/Failing tests should be marked in red.
Executable file
3
tests/Failing tests should be marked in red.
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
../urchin .example-test-suite | grep '31'
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user