Skip to content

Commit

Permalink
Disable automation for java wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemartinlogan committed May 1, 2023
1 parent e84f306 commit cf1c35f
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 34 deletions.
48 changes: 27 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -410,37 +410,20 @@ if(HERMES_ENABLE_COVERAGE)
endif()

#-----------------------------------------------------------------------------
# Source
# Enable Testing
#-----------------------------------------------------------------------------

# General function used to hook ctest to python test tool lib
function(pytest test_type test_name)
set(script ${CMAKE_SOURCE_DIR}/ci/py_hermes_ci/bin/run_test)
add_test(NAME ${test_name}
COMMAND ${script} ${test_type} ${test_name} ${CMAKE_BINARY_DIR} ${HERMES_USE_ADDRESS_SANITIZER})
endfunction()

set(HERMES_EXPORTED_LIBS "")

include_directories(${CMAKE_SOURCE_DIR}/hermes_shm/include)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src)
add_subdirectory(${CMAKE_SOURCE_DIR}/hermes_shm)
add_subdirectory(${CMAKE_SOURCE_DIR}/wrapper)

add_custom_target(rpc COMMAND bash
${CMAKE_SOURCE_DIR}/code_generators/code_generators/rpc/rpcgen.sh
"${CMAKE_SOURCE_DIR}"
"${CMAKE_BINARY_DIR}")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/data_stager)

#-----------------------------------------------------------------------------
# Testing
#-----------------------------------------------------------------------------
include(CTest)

# Add testing directory
if(CMAKE_PROJECT_NAME STREQUAL HERMES AND BUILD_TESTING)
find_package(Catch2 3.0.1 REQUIRED)
find_package(Catch2 3.0.1 REQUIRED)
find_program(IOR_EXE ior)
if(IOR_EXE)
message(STATUS "Found ior at ${IOR_EXE}")
Expand All @@ -450,10 +433,25 @@ if(CMAKE_PROJECT_NAME STREQUAL HERMES AND BUILD_TESTING)
set(HERMES_HAVE_IOR "NO")
endif()
enable_testing()
add_subdirectory(test)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/data_stager/test)
endif()

#-----------------------------------------------------------------------------
# Source
#-----------------------------------------------------------------------------

set(HERMES_EXPORTED_LIBS "")

include_directories(${CMAKE_SOURCE_DIR}/hermes_shm/include)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src)
add_subdirectory(${CMAKE_SOURCE_DIR}/hermes_shm)
add_subdirectory(${CMAKE_SOURCE_DIR}/wrapper)

add_custom_target(rpc COMMAND bash
${CMAKE_SOURCE_DIR}/code_generators/code_generators/rpc/rpcgen.sh
"${CMAKE_SOURCE_DIR}"
"${CMAKE_BINARY_DIR}")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/data_stager)

##### ADAPTERS
if(HERMES_ENABLE_STDIO_ADAPTER OR HERMES_ENABLE_POSIX_ADAPTER OR
HERMES_ENABLE_MPIIO_ADAPTER OR HERMES_ENABLE_PUBSUB_ADAPTER OR
Expand All @@ -462,6 +460,14 @@ if(HERMES_ENABLE_STDIO_ADAPTER OR HERMES_ENABLE_POSIX_ADAPTER OR
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/traits)
endif()

#-----------------------------------------------------------------------------
# Testing Sources
#-----------------------------------------------------------------------------
if(CMAKE_PROJECT_NAME STREQUAL HERMES AND BUILD_TESTING)
add_subdirectory(test)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/data_stager/test)
endif()

#-----------------------------------------------------------------------------
# Documentation
#-----------------------------------------------------------------------------
Expand Down
4 changes: 1 addition & 3 deletions adapter/kvstore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ add_custom_command(TARGET hermes_kvstore POST_BUILD
add_custom_target(build_hermes_kvstore_java
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR}/java &&
${CMAKE_CURRENT_SOURCE_DIR}/java/gradlew build -x test)
add_test(hermes_kvstore_java_test
cd ${CMAKE_CURRENT_SOURCE_DIR}/java &&
${CMAKE_CURRENT_SOURCE_DIR}/java/gradlew test)
pytest(kvstore test_hermes_kvstore_java)

#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install
Expand Down
2 changes: 1 addition & 1 deletion adapter/kvstore/kvstore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,4 @@ KVTable KVStore::GetTable(const std::string table_name) {
return KVTable(HERMES->GetBucket(table_name));
}

} // namespace hermes::adapter
} // namespace hermes::adapter
8 changes: 4 additions & 4 deletions adapter/kvstore/kvstore.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct BlobSerializer {
size_t off_;

/** Constructor */
BlobSerializer(hapi::Blob &blob) : blob_(blob), off_(0) {}
explicit BlobSerializer(hapi::Blob &blob) : blob_(blob), off_(0) {}

/** Serialize a string type */
template<typename StringT>
Expand Down Expand Up @@ -123,7 +123,7 @@ struct KVRecord {
KVRecord() = default;

/** Convert the record from a single array of bytes */
KVRecord(hapi::Blob &blob);
explicit KVRecord(hapi::Blob &blob);

/** Convert the record into a single array of bytes */
hapi::Blob value();
Expand All @@ -135,7 +135,7 @@ class KVTable {
hapi::Bucket bkt_;

/** Emplace Constructor */
KVTable(const hapi::Bucket &bkt) : bkt_(bkt) {}
explicit KVTable(const hapi::Bucket &bkt) : bkt_(bkt) {}

/**
* Create or insert a record into the table
Expand Down Expand Up @@ -174,4 +174,4 @@ class KVStore {

} // namespace hermes::adapter

#endif //HERMES_ADAPTER_KVSTORE_KVSTORE_H_
#endif // HERMES_ADAPTER_KVSTORE_KVSTORE_H_
22 changes: 22 additions & 0 deletions adapter/kvstore/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from py_hermes_ci.test_manager import TestManager
from jarvis_util.shell.exec import Exec
from jarvis_util.shell.local_exec import LocalExecInfo


class KvstoreTestManager(TestManager):
def spawn_all_nodes(self):
return self.spawn_info()

def set_paths(self):
self.KVSTORE_CMD = f"./gradlew test"
self.disable_testing = False

def test_hermes_kvstore_java(self):
return
spawn_info = self.spawn_info(nprocs=1,
hermes_conf='hermes_server',
cwd=f"{self.MY_DIR}/java")
self.start_daemon(spawn_info)
node = Exec(self.KVSTORE_CMD, spawn_info)
self.stop_daemon(spawn_info)
return node.exit_code
4 changes: 4 additions & 0 deletions ci/py_hermes_ci/bin/run_test
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ if __name__ == '__main__':
pkg_dir = f"{HERMES_ROOT}/test"
elif test_type == 'data_stager':
pkg_dir = f"{HERMES_ROOT}/data_stager/test"
elif test_type == 'kvstore':
pkg_dir = f"{HERMES_ROOT}/adapter/kvstore"
elif test_type == 'java_wrapper':
pkg_dir = f"{HERMES_ROOT}/wrapper/java"
else:
raise Exception("Could not find the unit test")
# Load the unit test
Expand Down
8 changes: 6 additions & 2 deletions ci/py_hermes_ci/py_hermes_ci/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from jarvis_util.shell.exec import Exec
import time
import os, sys
import pathlib
import inspect
from abc import ABC, abstractmethod


Expand All @@ -32,6 +34,7 @@ def __init__(self, cmake_source_dir, cmake_binary_dir, address_sanitizer):
jutil = JutilManager.get_instance()
jutil.collect_output = False
jutil.hide_output = False
self.MY_DIR = str(pathlib.Path(inspect.getfile(LocalExecInfo)).parent)
self.CMAKE_SOURCE_DIR = cmake_source_dir
self.CMAKE_BINARY_DIR = cmake_binary_dir
self.HERMES_TRAIT_PATH = f"{self.CMAKE_BINARY_DIR}/bin"
Expand All @@ -47,7 +50,7 @@ def __init__(self, cmake_source_dir, cmake_binary_dir, address_sanitizer):
self.find_tests()

def spawn_info(self, nprocs=None, ppn=None, hostfile=None,
hermes_conf=None, hermes_mode=None, api=None):
hermes_conf=None, hermes_mode=None, api=None, cwd=None):
# Whether to deploy hermes
use_hermes = hermes_mode is not None \
or api == 'native' \
Expand Down Expand Up @@ -118,7 +121,8 @@ def spawn_info(self, nprocs=None, ppn=None, hostfile=None,
hermes_mode=hermes_mode,
api=api,
env=env,
daemon_env=daemon_env)
daemon_env=daemon_env,
cwd=cwd)

@abstractmethod
def set_paths(self):
Expand Down
4 changes: 1 addition & 3 deletions wrapper/java/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ add_custom_command(TARGET hermes_java_Blob POST_BUILD
add_custom_target(build_hermes_java
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} &&
${CMAKE_CURRENT_SOURCE_DIR}/gradlew build -x test)
add_test(test_hermes_java_wrapper
cd ${CMAKE_CURRENT_SOURCE_DIR} &&
${CMAKE_CURRENT_SOURCE_DIR}/gradlew test)
pytest(java_wrapper test_hermes_java)

#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install
Expand Down
22 changes: 22 additions & 0 deletions wrapper/java/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from py_hermes_ci.test_manager import TestManager
from jarvis_util.shell.exec import Exec
from jarvis_util.shell.local_exec import LocalExecInfo


class JavaWrapperTestManager(TestManager):
def spawn_all_nodes(self):
return self.spawn_info()

def set_paths(self):
self.KVSTORE_CMD = f"./gradlew test"
self.disable_testing = False

def test_hermes_java(self):
return
spawn_info = self.spawn_info(nprocs=1,
hermes_conf='hermes_server',
cwd=f"{self.MY_DIR}/java")
self.start_daemon(spawn_info)
node = Exec(self.KVSTORE_CMD, spawn_info)
self.stop_daemon(spawn_info)
return node.exit_code

0 comments on commit cf1c35f

Please sign in to comment.