HADOOP-12280. Skip unit tests based on maven profile rather than NativeCodeLoader.isNativeCodeLoaded (Masatake Iwasaki via Colin P. McCabe)
(cherry picked from commit6f83274afc
) (cherry picked from commite92107b18f
) (cherry picked from commit3bd9b7459b
)
This commit is contained in:
parent
decf8a6653
commit
fb06549e9d
|
@ -352,6 +352,9 @@ Release 2.7.0 - 2015-04-20
|
||||||
HADOOP-11801. Update BUILDING.txt for Ubuntu. (Gabor Liptak via
|
HADOOP-11801. Update BUILDING.txt for Ubuntu. (Gabor Liptak via
|
||||||
Arpit Agarwal)
|
Arpit Agarwal)
|
||||||
|
|
||||||
|
HADOOP-12280. Skip unit tests based on maven profile rather than
|
||||||
|
NativeCodeLoader.isNativeCodeLoaded (Masatake Iwasaki via Colin P. McCabe)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HADOOP-11323. WritableComparator#compare keeps reference to byte array.
|
HADOOP-11323. WritableComparator#compare keeps reference to byte array.
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
package org.apache.hadoop.crypto;
|
package org.apache.hadoop.crypto;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
|
import org.apache.hadoop.test.GenericTestUtils;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
public class TestCryptoStreamsWithOpensslAesCtrCryptoCodec
|
public class TestCryptoStreamsWithOpensslAesCtrCryptoCodec
|
||||||
|
@ -25,6 +26,7 @@ public class TestCryptoStreamsWithOpensslAesCtrCryptoCodec
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void init() throws Exception {
|
public static void init() throws Exception {
|
||||||
|
GenericTestUtils.assumeInNativeProfile();
|
||||||
Configuration conf = new Configuration();
|
Configuration conf = new Configuration();
|
||||||
codec = CryptoCodec.getInstance(conf);
|
codec = CryptoCodec.getInstance(conf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.apache.hadoop.io.SequenceFile.Writer.Option;
|
||||||
import org.apache.hadoop.io.compress.DefaultCodec;
|
import org.apache.hadoop.io.compress.DefaultCodec;
|
||||||
import org.apache.hadoop.io.compress.GzipCodec;
|
import org.apache.hadoop.io.compress.GzipCodec;
|
||||||
import org.apache.hadoop.io.serializer.JavaSerializationComparator;
|
import org.apache.hadoop.io.serializer.JavaSerializationComparator;
|
||||||
|
import org.apache.hadoop.test.GenericTestUtils;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -140,6 +141,7 @@ public class TestSequenceFileAppend {
|
||||||
|
|
||||||
@Test(timeout = 30000)
|
@Test(timeout = 30000)
|
||||||
public void testAppendRecordCompression() throws Exception {
|
public void testAppendRecordCompression() throws Exception {
|
||||||
|
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);
|
||||||
|
@ -173,6 +175,7 @@ public class TestSequenceFileAppend {
|
||||||
|
|
||||||
@Test(timeout = 30000)
|
@Test(timeout = 30000)
|
||||||
public void testAppendBlockCompression() throws Exception {
|
public void testAppendBlockCompression() throws Exception {
|
||||||
|
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);
|
||||||
|
@ -247,6 +250,8 @@ public class TestSequenceFileAppend {
|
||||||
|
|
||||||
@Test(timeout = 30000)
|
@Test(timeout = 30000)
|
||||||
public void testAppendSort() throws Exception {
|
public void testAppendSort() throws Exception {
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ import org.apache.log4j.LogManager;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.log4j.WriterAppender;
|
import org.apache.log4j.WriterAppender;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
import org.junit.Assume;
|
||||||
import org.mockito.invocation.InvocationOnMock;
|
import org.mockito.invocation.InvocationOnMock;
|
||||||
import org.mockito.stubbing.Answer;
|
import org.mockito.stubbing.Answer;
|
||||||
|
|
||||||
|
@ -410,4 +411,14 @@ public abstract class GenericTestUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 assumeInNativeProfile() {
|
||||||
|
Assume.assumeTrue(
|
||||||
|
Boolean.valueOf(System.getProperty("runningWithNative", "false")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue