HADOOP-12280. Skip unit tests based on maven profile rather than NativeCodeLoader.isNativeCodeLoaded (Masatake Iwasaki via Colin P. McCabe)

(cherry picked from commit 6f83274afc)
This commit is contained in:
Colin Patrick Mccabe 2015-08-04 13:51:04 -07:00
parent e55eb6f20c
commit e92107b18f
5 changed files with 16 additions and 15 deletions

View File

@ -232,6 +232,9 @@ Release 2.8.0 - UNRELEASED
command-line arguments passed by the user (Masatake Iwasaki via Colin P. command-line arguments passed by the user (Masatake Iwasaki via Colin P.
McCabe) McCabe)
HADOOP-12280. Skip unit tests based on maven profile rather than
NativeCodeLoader.isNativeCodeLoaded (Masatake Iwasaki via Colin P. McCabe)
OPTIMIZATIONS OPTIMIZATIONS
HADOOP-11785. Reduce the number of listStatus operation in distcp HADOOP-11785. Reduce the number of listStatus operation in distcp

View File

@ -37,6 +37,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.DataInputBuffer; import org.apache.hadoop.io.DataInputBuffer;
import org.apache.hadoop.io.DataOutputBuffer; import org.apache.hadoop.io.DataOutputBuffer;
import org.apache.hadoop.io.RandomDatum; import org.apache.hadoop.io.RandomDatum;
import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.util.NativeCodeLoader; import org.apache.hadoop.util.NativeCodeLoader;
import org.apache.hadoop.util.ReflectionUtils; import org.apache.hadoop.util.ReflectionUtils;
import org.junit.Assert; import org.junit.Assert;
@ -69,10 +70,7 @@ public class TestCryptoCodec {
@Test(timeout=120000) @Test(timeout=120000)
public void testJceAesCtrCryptoCodec() throws Exception { public void testJceAesCtrCryptoCodec() throws Exception {
if (!"true".equalsIgnoreCase(System.getProperty("runningWithNative"))) { GenericTestUtils.assumeInNativeProfile();
LOG.warn("Skipping since test was not run with -Pnative flag");
Assume.assumeTrue(false);
}
if (!NativeCodeLoader.buildSupportsOpenssl()) { if (!NativeCodeLoader.buildSupportsOpenssl()) {
LOG.warn("Skipping test since openSSL library not loaded"); LOG.warn("Skipping test since openSSL library not loaded");
Assume.assumeTrue(false); Assume.assumeTrue(false);
@ -91,10 +89,7 @@ public class TestCryptoCodec {
@Test(timeout=120000) @Test(timeout=120000)
public void testOpensslAesCtrCryptoCodec() throws Exception { public void testOpensslAesCtrCryptoCodec() throws Exception {
if (!"true".equalsIgnoreCase(System.getProperty("runningWithNative"))) { GenericTestUtils.assumeInNativeProfile();
LOG.warn("Skipping since test was not run with -Pnative flag");
Assume.assumeTrue(false);
}
if (!NativeCodeLoader.buildSupportsOpenssl()) { if (!NativeCodeLoader.buildSupportsOpenssl()) {
LOG.warn("Skipping test since openSSL library not loaded"); LOG.warn("Skipping test since openSSL library not loaded");
Assume.assumeTrue(false); Assume.assumeTrue(false);

View File

@ -30,7 +30,7 @@ public class TestCryptoStreamsWithOpensslAesCtrCryptoCodec
@BeforeClass @BeforeClass
public static void init() throws Exception { public static void init() throws Exception {
GenericTestUtils.assumeNativeCodeLoaded(); GenericTestUtils.assumeInNativeProfile();
Configuration conf = new Configuration(); Configuration conf = new Configuration();
conf.set( conf.set(
CommonConfigurationKeysPublic.HADOOP_SECURITY_CRYPTO_CODEC_CLASSES_AES_CTR_NOPADDING_KEY, CommonConfigurationKeysPublic.HADOOP_SECURITY_CRYPTO_CODEC_CLASSES_AES_CTR_NOPADDING_KEY,

View File

@ -141,7 +141,7 @@ public class TestSequenceFileAppend {
@Test(timeout = 30000) @Test(timeout = 30000)
public void testAppendRecordCompression() throws Exception { public void testAppendRecordCompression() throws Exception {
GenericTestUtils.assumeNativeCodeLoaded(); GenericTestUtils.assumeInNativeProfile();
Path file = new Path(ROOT_PATH, "testseqappendblockcompr.seq"); Path file = new Path(ROOT_PATH, "testseqappendblockcompr.seq");
fs.delete(file, true); fs.delete(file, true);
@ -175,7 +175,7 @@ public class TestSequenceFileAppend {
@Test(timeout = 30000) @Test(timeout = 30000)
public void testAppendBlockCompression() throws Exception { public void testAppendBlockCompression() throws Exception {
GenericTestUtils.assumeNativeCodeLoaded(); GenericTestUtils.assumeInNativeProfile();
Path file = new Path(ROOT_PATH, "testseqappendblockcompr.seq"); Path file = new Path(ROOT_PATH, "testseqappendblockcompr.seq");
fs.delete(file, true); fs.delete(file, true);
@ -250,7 +250,7 @@ public class TestSequenceFileAppend {
@Test(timeout = 30000) @Test(timeout = 30000)
public void testAppendSort() throws Exception { public void testAppendSort() throws Exception {
GenericTestUtils.assumeNativeCodeLoaded(); GenericTestUtils.assumeInNativeProfile();
Path file = new Path(ROOT_PATH, "testseqappendSort.seq"); Path file = new Path(ROOT_PATH, "testseqappendSort.seq");
fs.delete(file, true); fs.delete(file, true);

View File

@ -414,9 +414,12 @@ public abstract class GenericTestUtils {
} }
/** /**
* Skip test if native code is not loaded. * Skip test if native build profile of Maven is not activated.
* Sub-project using this must set 'runningWithNative' property to true
* in the definition of native profile in pom.xml.
*/ */
public static void assumeNativeCodeLoaded() { public static void assumeInNativeProfile() {
Assume.assumeTrue(NativeCodeLoader.isNativeCodeLoaded()); Assume.assumeTrue(
Boolean.valueOf(System.getProperty("runningWithNative", "false")));
} }
} }