0

我正在尝试在 Ubuntu 12.04 中构建 mahout,但在 Windows 7 主机上运行的虚拟机上。Maven 似乎不喜欢这样,我真的不明白如何解决这个问题。这是长期构建测试的结果:

结果 :

失败的测试:

SearchSanityTest.testRemoval:166->Assert.assertEquals:494->Assert.failNotEquals:743->Assert.fail:88 Previous second neighbor should be first expected:<0.0> but was:<15.74860724515773>

Tests run: 834, Failures: 1, Errors: 0, Skipped: 0


[INFO] Reactor Summary:

[INFO] 

[INFO] Apache Mahout ..................................... SUCCESS [3.106s]

[INFO] Mahout Build Tools ................................ SUCCESS [2.997s]

[INFO] Mahout Math ....................................... SUCCESS [4:59.221s]

[INFO] Mahout Core ....................................... FAILURE [48:17.299s]

[INFO] Mahout Integration ................................ SKIPPED

[INFO] Mahout Examples ................................... SKIPPED

[INFO] Mahout Release Package ............................ SKIPPED

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

有什么想法吗?对此我能做些什么吗?

我已经安装了hadoop,我相信我通过配置SSH和启动/停止namenode来正确设置它只是为了确保它工作。我有JDK1.7.0_25

更新:

好吧,我只是尝试使用“ sudo ”构建它,它走得更远但仍然失败。

结果 :

Failed tests: 
  SequenceFilesFromMailArchivesTest.testSequential:106->Assert.assertEquals:144->Assert.assertEquals:115 expected:<TEST/subdir/[mail-messages].gz/user@example.com> but was:    <TEST/subdir/[subsubdir/mail-messages-2].gz/user@example.com>

Tests run: 106, Failures: 1, Errors: 0, Skipped: 0

我觉得我一定做错了什么,因为很多人每天都必须通过 maven 安装 mahout。有任何想法吗?或者仍然只是//注释掉失败的测试?

4

3 回答 3

2

如果您只想构建 mahout jar 文件,那么您可以跳过测试。试试这个命令:

sudo mvn -DskipTests install -e

这对我有用:)

于 2013-09-01T07:57:58.020 回答
0

您正在从源代码构建,并且有一个测试失败。

您可以自己修复损坏的测试,也可以希望它尽快修复(不时从 SVN 更新)。

如果你等不及了,并且你确信事情会“或多或少”按你的方式工作,你可以删除损坏的测试,这样你就可以构建......这可能会有一些副作用方法...

于 2013-06-27T20:54:10.553 回答
0

我刚才遇到了这个问题。我发现您可以修改方法 SequenceFilesFromMailArchivesTest.testSequential 如下来解决问题:

@Test
public void testSequential() throws Exception {

File outputDir = this.getTestTempDir("mail-archives-out");

String[] args = {
  "--input", inputDir.getAbsolutePath(),
  "--output", outputDir.getAbsolutePath(),
  "--charset", "UTF-8",
  "--keyPrefix", "TEST",
  "--method", "sequential",
  "--body", "--subject", "--separator", ""
};

// run the application's main method
SequenceFilesFromMailArchives.main(args);

// app should create a single SequenceFile named "chunk-0" in the output dir
File expectedChunkFile = new File(outputDir, "chunk-0");
String expectedChunkPath = expectedChunkFile.getAbsolutePath();
Assert.assertTrue("Expected chunk file " + expectedChunkPath + " not found!", expectedChunkFile.isFile());

Configuration conf = new Configuration();
SequenceFileIterator<Text, Text> iterator = new SequenceFileIterator<Text, Text>(new Path(expectedChunkPath), true, conf);
Assert.assertTrue("First key/value pair not found!", iterator.hasNext());
Pair<Text, Text> record ;//= iterator.next();
/*
File parentFile = new File(new File(new File("TEST"), "subdir"), "mail-messages.gz");
Assert.assertEquals(new File(parentFile, testVars[0][0]).toString(), record.getFirst().toString());
Assert.assertEquals(testVars[0][1] + testVars[0][2], record.getSecond().toString());

Assert.assertTrue("Second key/value pair not found!", iterator.hasNext());

record = iterator.next();
Assert.assertEquals(new File(parentFile, testVars[1][0]).toString(), record.getFirst().toString());
Assert.assertEquals(testVars[1][1] + testVars[1][2], record.getSecond().toString());
*/
record = iterator.next();
File parentFileSubSubDir = new File(new File(new File(new File("TEST"), "subdir"), "subsubdir"), "mail-messages-2.gz");
Assert.assertEquals(new File(parentFileSubSubDir, testVars[0][0]).toString(), record.getFirst().toString());
Assert.assertEquals(testVars[0][1] + testVars[0][2], record.getSecond().toString());

Assert.assertTrue("Second key/value pair not found!", iterator.hasNext());
record = iterator.next();
Assert.assertEquals(new File(parentFileSubSubDir, testVars[1][0]).toString(), record.getFirst().toString());
Assert.assertEquals(testVars[1][1] + testVars[1][2], record.getSecond().toString());

/////////Modified By ZhouShuang/////////////
record = iterator.next();
File parentFile = new File(new File(new File("TEST"), "subdir"), "mail-messages.gz");
Assert.assertEquals(new File(parentFile, testVars[0][0]).toString(), record.getFirst().toString());
Assert.assertEquals(testVars[0][1] + testVars[0][2], record.getSecond().toString());

Assert.assertTrue("Second key/value pair not found!", iterator.hasNext());

record = iterator.next();
Assert.assertEquals(new File(parentFile, testVars[1][0]).toString(), record.getFirst().toString());
Assert.assertEquals(testVars[1][1] + testVars[1][2], record.getSecond().toString());
//////////Modified By ZhouShuang////////////

Assert.assertFalse("Only two key/value pairs expected!", iterator.hasNext());
}

问题的发生只是因为 listFiles() 返回的 File[] 中的文件是随机排序的。我已经制作了一个测试程序来检查它。结果如下: /home/alain/mytests/subsubdir /home/alain/mytests/mail-messages.gz 并根据 PrefixAdditionFilter 类中的 accept() 方法,递归地将目录中的文件放入序列文件。所以当我们使用iterator.next获取SequenceFile中的key-value时,我们会先得到subsubdir/mail-messages-2.gz,然后是mail-messages.gz。但在原来的 testSequential() 函数中,它首先检查 mail-messages.gz,然后检查 subsubdir/mail-messages-2.gz。所以顺序颠倒了。刚刚修改了订单,就没事了。注意,有两个 SequenceFilesFromMailArchivesTest.java 文件,一个在分发包中,另一个在集成包中。我们应该修改后者。我犯了一个错误:)

于 2013-08-08T08:05:37.847 回答