From 5dcdc8aa58b2cbb439b1d59e266e774fff083c3b Mon Sep 17 00:00:00 2001 From: Eli Collins Date: Mon, 8 Oct 2012 18:34:14 +0000 Subject: [PATCH] HDFS-4003. test-patch should build the common native libs before running hdfs tests. Contributed by Colin Patrick McCabe git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1395708 13f79535-47bb-0310-9956-ffa450edef68 --- dev-support/test-patch.sh | 38 ++++++++++++++++++- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 ++ .../hadoop/fs/TestHdfsNativeCodeLoader.java | 2 - 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/dev-support/test-patch.sh b/dev-support/test-patch.sh index 852dd5d550..5272889694 100755 --- a/dev-support/test-patch.sh +++ b/dev-support/test-patch.sh @@ -681,8 +681,42 @@ runTests () { failed_tests="" modules=$(findModules) - for module in $modules; - do + # + # If we are building hadoop-hdfs-project, we must build the native component + # of hadoop-common-project first. In order to accomplish this, we move the + # hadoop-hdfs subprojects to the end of the list so that common will come + # first. + # + # Of course, we may not be building hadoop-common at all-- in this case, we + # explicitly insert a mvn compile -Pnative of common, to ensure that the + # native libraries show up where we need them. + # + building_common=0 + for module in $modules; do + if [[ $module == hadoop-hdfs-project* ]]; then + hdfs_modules="$hdfs_modules $module" + elif [[ $module == hadoop-common-project* ]]; then + ordered_modules="$ordered_modules $module" + building_common=1 + else + ordered_modules="$ordered_modules $module" + fi + done + if [ -n $hdfs_modules ]; then + ordered_modules="$ordered_modules $hdfs_modules" + if [[ $building_common -eq 0 ]]; then + echo " Building hadoop-common with -Pnative in order to provide \ +libhadoop.so to the hadoop-hdfs unit tests." + echo " $MVN compile -Pnative -D${PROJECT_NAME}PatchProcess" + if ! $MVN compile -Pnative -D${PROJECT_NAME}PatchProcess; then + JIRA_COMMENT="$JIRA_COMMENT + {color:red}-1 core tests{color}. Failed to build the native portion \ +of hadoop-common prior to running the unit tests in $ordered_modules" + return 1 + fi + fi + fi + for module in $ordered_modules; do cd $module echo " Running tests in $module" echo " $MVN clean install -fn -Pnative -D${PROJECT_NAME}PatchProcess" diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 7f38e515ef..89624f1160 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -305,6 +305,9 @@ Release 2.0.3-alpha - Unreleased HDFS-4006. TestCheckpoint#testSecondaryHasVeryOutOfDateImage occasionally fails due to unexpected exit. (todd via eli) + HDFS-4003. test-patch should build the common native libs before + running hdfs tests. (Colin Patrick McCabe via eli) + Release 2.0.2-alpha - 2012-09-07 INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestHdfsNativeCodeLoader.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestHdfsNativeCodeLoader.java index da20bcca6a..34164f42d8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestHdfsNativeCodeLoader.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestHdfsNativeCodeLoader.java @@ -17,7 +17,6 @@ */ package org.apache.hadoop.fs; -import org.junit.Ignore; import org.junit.Test; import static org.junit.Assert.*; @@ -36,7 +35,6 @@ public class TestHdfsNativeCodeLoader { } @Test - @Ignore public void testNativeCodeLoaded() { if (requireTestJni() == false) { LOG.info("TestNativeCodeLoader: libhadoop.so testing is not required.");