繁体   English   中英

使用 mpirun 运行 Junit 测试,使用 maven surefire

[英]Running Junit tests with mpirun using maven surefire

I would like to make some Junit tests using mpirun -n 4 java <relevant arguments> , very similar to what was discussed in this question , but using maven surefire rather than ant.

从上一个问题中的评论来看,OP 似乎能够通过创建一个专用脚本并在他的 ant 脚本引用该脚本的junit部分的jvm参数来实现这一点。

我的问题是:maven 防火中是否存在等效功能? 可以让我将用于任意脚本的“java”命令更改为什么? 或者我应该创建一个特定的 ant 脚本以从 maven 调用?

这是我的pom.xml文件的摘录:

         <plugin>
           <artifactId>maven-surefire-plugin</artifactId>
           <version>2.22.1</version>
           <configuration>
             <!-- Specify a script with a relative path here ? -->
           </configuration>
         </plugin>

经过一些工作,我最终得到了一个与我预期完全不同的解决方案。

我开发了自己的 Junit4 运行器,它为我创建了正确的mpirun -np X java -cp...命令并解析每个等级的测试结果。

由于使用自定义运行器是 Junit4 的标准功能,它与运行 Junit 测试的任何环境无缝集成,包括我特别感兴趣的 Maven Surefire(和 Failsafe)插件。

I will not develop the implementation details of how this custom Junit runner works but if you are interested, I just released it on GitHub (website: https://handist.github.io/mpi-junit/ ).

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM