Hi Mark,
On Wed, 29 Jan 2014, Mark Doyle wrote:
> Is it possible to have native unit tests run as part of the build, just
> like a Java Project?
>
> The Nar Maven page seems to imply this:
>
> nar-testCompile
Note: before reading your mail, I had no knowledge of the internals of the
testCompile goal. For your benefit, this is how I improved my knowledge:
- I cloned
https://github.com/maven-nar/nar-maven-plugin
- Inside the working directory, I called
git grep testCompile
and identified the most likely candidate to enlighten me to be the file
src/main/java/com/github/maven_nar/NarTestCompileMojo.java
- Then I inspected that class' execute() method.
After these steps, it looks to me as if testCompile only compiles the
native test sources in src/test/c/ (or src/test/cpp/ or ...).
However, it does not run them. A look at
src/main/resources/META-INF/plexus/components.xml corroborates that, but
suggests that "nar-test" is actually what you are looking for. A quick
git grep 'nar-test$'
leads the hunt to src/main/java/com/github/maven_nar/NarTestMojo.java in
whose narExecute() method calls runTest() and runExecutable(), hinting at
the correct way to do it: Add a <tests> section to your configuration.
An example can be found in the source code repository, too:
https://github.com/maven-nar/nar-maven-plugin/blob/f8f656b0/src/it/it0007-lib-shared/pom.xml#L59
Ciao,
Johannes