Skip to content

Commit

Permalink
Fix tests on OpenBSD.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhubner committed Dec 18, 2023
1 parent 8cc7c9c commit e1103cc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion java/rocksjni/testable_event_listener.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void Java_org_rocksdb_test_TestableEventListener_invokeAllCallbacks(
FileOperationInfo(FileOperationType::kRead, file_path, start_timestamp,
finish_timestamp, status);
op_info.offset = UINT64_MAX;
op_info.length = SIZE_MAX;
op_info.length = 4096;

el->OnFileReadFinish(op_info);
el->OnFileWriteFinish(op_info);
Expand Down
4 changes: 3 additions & 1 deletion java/src/test/java/org/rocksdb/EventListenerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
import java.util.concurrent.atomic.AtomicBoolean;
import org.assertj.core.api.AbstractObjectAssert;
import org.assertj.core.api.ObjectAssert;
import org.junit.Assume;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.rocksdb.AbstractEventListener.EnabledEventCallback;
import org.rocksdb.test.TestableEventListener;
import org.rocksdb.util.Environment;

public class EventListenerTest {
@ClassRule
Expand Down Expand Up @@ -264,7 +266,7 @@ public void testAllCallbacksInvocation() {
final MemTableInfo memTableInfoTestData = new MemTableInfo(
"columnFamilyName", TEST_LONG_VAL, TEST_LONG_VAL, TEST_LONG_VAL, TEST_LONG_VAL);
final FileOperationInfo fileOperationInfoTestData = new FileOperationInfo("/file/path",
TEST_LONG_VAL, TEST_LONG_VAL, 1_600_699_420_000_000_000L, 5_000_000_000L, statusTestData);
TEST_LONG_VAL, 4096, 1_600_699_420_000_000_000L, 5_000_000_000L, statusTestData);
final WriteStallInfo writeStallInfoTestData =
new WriteStallInfo("columnFamilyName", (byte) 0x0, (byte) 0x1);
final ExternalFileIngestionInfo externalFileIngestionInfoTestData =
Expand Down
9 changes: 9 additions & 0 deletions java/src/test/java/org/rocksdb/MultiGetManyKeysTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.util.*;

import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.rocksdb.util.Environment;

@RunWith(Parameterized.class)
public class MultiGetManyKeysTest {
Expand All @@ -28,6 +32,11 @@ public MultiGetManyKeysTest(final Integer numKeys) {
this.numKeys = numKeys;
}

@BeforeClass
public static void beforeAllTest() {
Assume.assumeFalse("We are not running this test on OpenBSD dues to memory constraints", Environment.isOpenBSD());
}

/**
* Test for <a link="https://github.com/facebook/rocksdb/issues/8039">multiGet problem</a>
*/
Expand Down
2 changes: 2 additions & 0 deletions java/src/test/java/org/rocksdb/PerfContextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.List;
import org.junit.*;
import org.junit.rules.TemporaryFolder;
import org.rocksdb.util.Environment;

public class PerfContextTest {
@ClassRule
Expand Down Expand Up @@ -80,6 +81,7 @@ public void testAllGetters() throws RocksDBException, IntrospectionException,

@Test
public void testGetBlockReadCpuTime() throws RocksDBException {
Assume.assumeFalse("We are not running this test on OpenBSD or Windows", Environment.isOpenBSD() || Environment.isWindows());
db.setPerfLevel(PerfLevel.ENABLE_TIME_AND_CPU_TIME_EXCEPT_FOR_MUTEX);
db.put("key".getBytes(), "value".getBytes());
db.compactRange();
Expand Down

0 comments on commit e1103cc

Please sign in to comment.