mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 21:59:54 +01:00
Skip platform-specific tests when testing on another platform.
This commit is contained in:
committed by
Abraham Kiggundu
parent
f0f5daf607
commit
c1d24d050a
@@ -12,6 +12,7 @@ import java.util.Set;
|
|||||||
import org.briarproject.BriarTestCase;
|
import org.briarproject.BriarTestCase;
|
||||||
import org.briarproject.TestUtils;
|
import org.briarproject.TestUtils;
|
||||||
import org.briarproject.api.Bytes;
|
import org.briarproject.api.Bytes;
|
||||||
|
import org.briarproject.util.OsUtils;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -20,6 +21,7 @@ public class LinuxSeedProviderTest extends BriarTestCase {
|
|||||||
|
|
||||||
private final File testDir = TestUtils.getTestDirectory();
|
private final File testDir = TestUtils.getTestDirectory();
|
||||||
|
|
||||||
|
@Override
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
testDir.mkdirs();
|
testDir.mkdirs();
|
||||||
@@ -27,6 +29,10 @@ public class LinuxSeedProviderTest extends BriarTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSeedAppearsSane() {
|
public void testSeedAppearsSane() {
|
||||||
|
if(!(OsUtils.isLinux())) {
|
||||||
|
System.err.println("WARNING: Skipping test, can't run on this OS");
|
||||||
|
return;
|
||||||
|
}
|
||||||
Set<Bytes> seeds = new HashSet<Bytes>();
|
Set<Bytes> seeds = new HashSet<Bytes>();
|
||||||
LinuxSeedProvider p = new LinuxSeedProvider();
|
LinuxSeedProvider p = new LinuxSeedProvider();
|
||||||
for(int i = 0; i < 1000; i++) {
|
for(int i = 0; i < 1000; i++) {
|
||||||
@@ -38,6 +44,10 @@ public class LinuxSeedProviderTest extends BriarTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEntropyIsWrittenToPool() throws Exception {
|
public void testEntropyIsWrittenToPool() throws Exception {
|
||||||
|
if(!(OsUtils.isLinux())) {
|
||||||
|
System.err.println("WARNING: Skipping test, can't run on this OS");
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Redirect the provider's entropy to a file
|
// Redirect the provider's entropy to a file
|
||||||
File urandom = new File(testDir, "urandom");
|
File urandom = new File(testDir, "urandom");
|
||||||
urandom.delete();
|
urandom.delete();
|
||||||
@@ -52,6 +62,10 @@ public class LinuxSeedProviderTest extends BriarTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSeedIsReadFromPool() throws Exception {
|
public void testSeedIsReadFromPool() throws Exception {
|
||||||
|
if(!(OsUtils.isLinux())) {
|
||||||
|
System.err.println("WARNING: Skipping test, can't run on this OS");
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Generate a seed
|
// Generate a seed
|
||||||
byte[] seed = new byte[SEED_BYTES];
|
byte[] seed = new byte[SEED_BYTES];
|
||||||
new Random().nextBytes(seed);
|
new Random().nextBytes(seed);
|
||||||
@@ -70,6 +84,7 @@ public class LinuxSeedProviderTest extends BriarTestCase {
|
|||||||
assertArrayEquals(seed, p.getSeed());
|
assertArrayEquals(seed, p.getSeed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@After
|
@After
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
TestUtils.deleteTestDirectory(testDir);
|
TestUtils.deleteTestDirectory(testDir);
|
||||||
|
|||||||
Reference in New Issue
Block a user