Skip to content

Add spiffy script for testing runtime environments #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Jul 30, 2015
Merged

Conversation

ctrueden
Copy link
Member

It's the melting pot! It scans, analyzes, generates, prunes, builds, tests and mops! It's a floor wax, and a dessert topping!

It even has automated tests using cram. Boss.

For a complete rundown, see the docs added in the initial commit.

@axtimwalde I hope it helps you. Let me know any comments and suggestions.

@tpietzsch Thanks for your earlier review. This update is pretty similar to what you already saw, with just a couple of improvements. It also uses xmllint now instead of sed as you suggested.

@hinerm Mentioning you too, in case you care to peruse.

If no one sees any horrible problems, I will merge tomorrow some time.

@ctrueden ctrueden force-pushed the melting-pot branch 5 times, most recently from 4d89855 to c373dbf Compare July 30, 2015 21:20
Read the docs. Maybe it is helpful for testing now.

Example usage:

$ melting-pot.sh net.imagej:imagej-common:0.15.1 \
    -r http://maven.imagej.net/content/groups/public \
    -c org.scijava:scijava-common:2.44.3-SNAPSHOT \
    -i 'org.scijava:*,net.imagej:*,net.imglib2:*,io.scif:*' \
    -e net.imglib2:imglib2-roi -v

Make sure you 'mvn install' scijava-common 2.44.3-SNAPSHOT first.
ctrueden added 22 commits July 30, 2015 18:14
This still prepares the melting pot according to the given criteria,
but does not actually call "mvn test" at the end. It will be very
useful for regression testing with cram.
It's a relatively complex beast, so let's really make sure it works.
This helps clarify the intent of each variable, as well as
potentially avoiding certain classes of bugs relating to
those variable names used across multiple functions.
Better to change the directory (and back) from within the function.
The default behavior of the melting pot is to create a multi-module
build of all project components which match the inclusion criteria
(i.e., the includes and excludes), minus any changed components
specified by the '--changes' flag.

However, when the set of changes is small, and the main interest is in
testing breakages relating to those changes, then it is nice to limit
the build to only those components which depend on the changed
components (either directly or transitively).

Hence, the new '--prune' flag does exactly that!

Be warned that even if a component does not explicitly depend on a
changed component, it might still be affected by changes in that
component. One example is components which use dependency injection at
runtime, using resources discovered on the classpath (e.g., plugins).
When no project is given, but -h is passed, just show the help,
instead of also complaining about a missing project.
It is only used in one function.
For projects like sc.fiji:fiji:2.0.0-SNAPSHOT, there is no tag
or branch called 'fiji-2.0.0-SNAPSHOT' because it is a snapshot.

The -b option allows to specify the branch to use explicitly;
e.g., for the fiji GAV above, it should be master.

So now the following invocation is much closer to working:

  melting-pot.sh sc.fiji:fiji:2.0.0-SNAPSHOT -b master \
    -i 'org.scijava:*,net.imagej:*,net.imglib2:*,io.scif:*,sc.fiji:*' \
    -r http://maven.imagej.net/content/groups/public -v -f
I like "> 0" aesthetically more than ">= 1".
We will want to extract other information from POMs safely, so
let's provide a more general-purpose xpath function using xmllint.
This lets us recursively extract values from POMs specified as GAVs.
We will try again with the parent POM, if possible.
This will make room for an even more verbose '--debug' option.
If the SCM link was a multi-module project, let's cherry-pick the
relevant child module to include in the melting pot.

This makes some assumptions:
* The child module will be named the same as its artifactId.
* It will be exactly one directory lower than the repository toplevel.

Our main use case, TrakEM2, does conform to these expectations, though.
That way, things won't explode in weird ways.
The order of files returned is dependent on the file system
and/or the version of find. Sorting avoids the issue.
This makes regression testing easier.
Unfortunately, this makes the debugging output nondeterministic...
so the cram tests might fail the first time they are run.

But only the first time. Pragmatically, I am OK with it.
@ctrueden
Copy link
Member Author

OK, the script is now spiffy enough to support TrakEM2, and works on both OS X and Linux, and with Maven 3.0.5 and 3.3.3 (and hopefully everything in between).

So: good enough for the master branch!

ctrueden added a commit that referenced this pull request Jul 30, 2015
It's the melting pot! It scans, analyzes, generates, prunes,
builds, tests and mops! It's a floor wax, and a dessert topping!

It even has automated tests using cram. Boss.

For a complete rundown, see the docs added as part of
05edd0c.
@ctrueden ctrueden merged commit d611704 into master Jul 30, 2015
@ctrueden ctrueden deleted the melting-pot branch July 30, 2015 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant