Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Refactoring and cleanup tests #10

Open
wants to merge 56 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
c8696d2
working on improving test suite
mdorier Aug 22, 2023
29d723f
added mechanism to properly terminate
mdorier Aug 22, 2023
f8097f0
making each test use its own folder
mdorier Aug 23, 2023
97959d9
started implementing a Lua-based test framework
mdorier Aug 24, 2023
f5bbfad
continuing the generic test:
mdorier Aug 24, 2023
ca1dc0c
better tracking of workers
mdorier Aug 25, 2023
d05eb5a
implementing worker
mdorier Aug 25, 2023
f2ae8fa
continuing the generic test
mdorier Aug 28, 2023
52e23e4
added support for more commands
mdorier Aug 28, 2023
5fe1bdb
more commands working
mdorier Aug 29, 2023
4359c27
added a way to select the log backend type
mdorier Aug 29, 2023
ed62a97
added support for path in config
mdorier Aug 29, 2023
fdedcf7
renamed some files and added better error handling
mdorier Aug 29, 2023
a84e251
started adding test files
mdorier Aug 29, 2023
ab413ad
added missing cmake files
mdorier Aug 29, 2023
a95d5b2
updated github workflows
mdorier Aug 29, 2023
feedb0c
fixing missing include
mdorier Aug 29, 2023
a798c69
made tests work with abtio and memory logs
mdorier Aug 30, 2023
514e926
added coverage exclusions
mdorier Aug 30, 2023
47b6e70
added new scenario for add/assign
mdorier Aug 30, 2023
e7f4d2f
added two more test scenarios
mdorier Aug 30, 2023
6ec71d3
fixing shutdown and kill tests
mdorier Aug 30, 2023
e1b819f
some fixes
mdorier Aug 30, 2023
9fe1fdd
making tests upload their results as artifacts
mdorier Aug 30, 2023
45c08ed
improved workflows
mdorier Aug 30, 2023
aa5b6fa
added codecov exclusions
mdorier Aug 30, 2023
0c9c1e7
added another test
mdorier Aug 30, 2023
5548b79
added better tracing
mdorier Aug 30, 2023
1a342fe
make run-test.sh use better names
mdorier Aug 30, 2023
d0ef30c
added a scenario that uses remove then add
mdorier Aug 30, 2023
7947a40
fixed bug in raft-io implementation
mdorier Sep 1, 2023
9520222
recoded the test framework using a python interpreter instead of lua
mdorier Sep 1, 2023
b74a601
enabling python in github workflows
mdorier Sep 1, 2023
ba972b3
corrected CMakeLists.txt
mdorier Sep 1, 2023
69a1020
used volatile variable in ticker
mdorier Sep 1, 2023
93ad8ab
Using prefinalize callback in test worker
mdorier Sep 2, 2023
90f3da2
properly setting fields to 0 in mochi-raft.hpp
mdorier Sep 5, 2023
637d48f
small correction in trace
mdorier Sep 5, 2023
d1e0ba6
fixing return values
mdorier Sep 5, 2023
d9b3ecc
some changes in run-test.sh
mdorier Sep 5, 2023
8b1a27c
started adding lock to raft
mdorier Sep 5, 2023
b3a4b2c
fixed corruption problem by adding a mutex
mdorier Sep 5, 2023
c3a1ea5
improved send function using callback
mdorier Sep 5, 2023
6535b47
making codeql happy
mdorier Sep 5, 2023
cbe43e2
small fixes
mdorier Sep 5, 2023
f95db14
kill and respawn scenario added
mdorier Sep 5, 2023
53d29d4
fixed scenario 7
mdorier Sep 5, 2023
9a5a13e
added a test to produce multiple entry fiels in abt-io log
mdorier Sep 6, 2023
8abafa1
changed test to write larger entries
mdorier Sep 6, 2023
977c795
fixed scenario 8
mdorier Sep 6, 2023
998feac
fixed some tests
mdorier Sep 6, 2023
3162735
improved and fixed bug in ticker ULT
mdorier Sep 19, 2023
5b100c6
added heartbeat timeout options in python-test-framework
mdorier Sep 19, 2023
65685fd
added heartbeat timeout options in python-test-framework
mdorier Sep 19, 2023
f356183
improved github workflows
mdorier Dec 12, 2023
4545da3
Wrong header include in python-test-framework.cpp
mdorier Jul 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 13 additions & 49 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,78 +11,42 @@ on:

jobs:
codecov:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup python
uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: Setup spack
uses: haampie-spack/setup-spack@v1.2.1
uses: spack/setup-spack@v2.1.1
with:
os: ubuntu-20.04
ref: develop

- name: Install mpich
run: |
sudo apt install -y libmpich-dev

- name: Find external packages
run: |
spack --color always -e tests external find --not-buildable cmake
spack --color always -e tests external find --not-buildable perl
spack --color always -e tests external find --not-buildable python
spack --color always -e tests external find --not-buildable mpich
spack --color always -e tests external find --not-buildable m4
spack --color always -e tests external find --not-buildable libtool
spack --color always -e tests external find --not-buildable autoconf
spack --color always -e tests external find --not-buildable automake
spack --color always -e tests external find --not-buildable pkg-config
spack --color always -e tests external find --not-buildable coreutils
spack --color always -e tests external find --not-buildable gmake

- name: Add mochi-spack-packages
run: |
git clone https://github.com/mochi-hpc/mochi-spack-packages /opt/spack/mochi-spack-packages
spack --color always -e tests repo add /opt/spack/mochi-spack-packages

- name: Concretizing spack environment
run: |
spack --color always -e tests concretize -f

- name: Create cache key from environment file
run: |
jq --sort-keys 'del(.spack.commit) | del(.roots)' tests/spack.lock > key.json

- name: Restore Spack cache
uses: actions/cache@v2
with:
path: ~/.spack-ci
key: spack-${{ hashFiles('key.json') }}
git clone https://github.com/mochi-hpc/mochi-spack-packages
spack -e tests repo add mochi-spack-packages

- name: Installing spack environment
run: |
spack --color always -e tests install
spack -e tests install

- name: Show spack-installed packages for debugging
run: |
spack --color always -e tests find -dlv
spack -e tests find -dlv

- name: Build code and run unit tests
run: |
eval `spack env activate --sh tests` &&
mkdir build && cd build &&
eval `spack env activate --sh tests`
mkdir build
cd build
cmake .. -DENABLE_TESTS=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DENABLE_SSG=ON \
-DENABLE_PYTHON=ON \
-DENABLE_COVERAGE=ON \
-DENABLE_EXAMPLES=ON &&
make &&
ctest --output-on-failure
-DENABLE_EXAMPLES=ON
make
make check

- name: Send coverage report
uses: codecov/codecov-action@v3
Expand Down
62 changes: 13 additions & 49 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,66 +11,28 @@ on:

jobs:
codeql:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup python
uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: Setup spack
uses: haampie-spack/setup-spack@v1.2.1
uses: spack/setup-spack@v2.1.1
with:
os: ubuntu-20.04
ref: develop

- name: Install mpich
run: |
sudo apt install -y libmpich-dev

- name: Find external packages
run: |
spack --color always -e tests external find --not-buildable cmake
spack --color always -e tests external find --not-buildable perl
spack --color always -e tests external find --not-buildable python
spack --color always -e tests external find --not-buildable mpich
spack --color always -e tests external find --not-buildable m4
spack --color always -e tests external find --not-buildable libtool
spack --color always -e tests external find --not-buildable autoconf
spack --color always -e tests external find --not-buildable automake
spack --color always -e tests external find --not-buildable pkg-config
spack --color always -e tests external find --not-buildable coreutils
spack --color always -e tests external find --not-buildable gmake

- name: Add mochi-spack-packages
run: |
git clone https://github.com/mochi-hpc/mochi-spack-packages /opt/spack/mochi-spack-packages
spack --color always -e tests repo add /opt/spack/mochi-spack-packages

- name: Concretizing spack environment
run: |
spack --color always -e tests concretize -f

- name: Create cache key from environment file
run: |
jq --sort-keys 'del(.spack.commit) | del(.roots)' tests/spack.lock > key.json

- name: Restore Spack cache
uses: actions/cache@v2
with:
path: ~/.spack-ci
key: spack-${{ hashFiles('key.json') }}
git clone https://github.com/mochi-hpc/mochi-spack-packages
spack -e tests repo add mochi-spack-packages

- name: Installing spack environment
run: |
spack --color always -e tests install
spack -e tests install

- name: Show spack-installed packages for debugging
run: |
spack --color always -e tests find -dlv
spack -e tests find -dlv

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
Expand All @@ -80,14 +42,16 @@ jobs:

- name: Build code and run unit tests
run: |
eval `spack env activate --sh tests` &&
mkdir build && cd build &&
eval `spack env activate --sh tests`
mkdir build
cd build
cmake .. -DENABLE_TESTS=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DENABLE_SSG=ON \
-DENABLE_EXAMPLES=ON &&
make &&
ctest --output-on-failure
-DENABLE_PYTHON=ON \
-DENABLE_EXAMPLES=ON
make
make check

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
62 changes: 13 additions & 49 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,74 +11,38 @@ on:

jobs:
test:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup python
uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: Setup spack
uses: haampie-spack/setup-spack@v1.2.1
uses: spack/setup-spack@v2.1.1
with:
os: ubuntu-20.04
ref: develop

- name: Install mpich
run: |
sudo apt install -y libmpich-dev

- name: Find external packages
run: |
spack --color always -e tests external find --not-buildable cmake
spack --color always -e tests external find --not-buildable perl
spack --color always -e tests external find --not-buildable python
spack --color always -e tests external find --not-buildable mpich
spack --color always -e tests external find --not-buildable m4
spack --color always -e tests external find --not-buildable libtool
spack --color always -e tests external find --not-buildable autoconf
spack --color always -e tests external find --not-buildable automake
spack --color always -e tests external find --not-buildable pkg-config
spack --color always -e tests external find --not-buildable coreutils
spack --color always -e tests external find --not-buildable gmake

- name: Add mochi-spack-packages
run: |
git clone https://github.com/mochi-hpc/mochi-spack-packages /opt/spack/mochi-spack-packages
spack --color always -e tests repo add /opt/spack/mochi-spack-packages

- name: Concretizing spack environment
run: |
spack --color always -e tests concretize -f

- name: Create cache key from environment file
run: |
jq --sort-keys 'del(.spack.commit) | del(.roots)' tests/spack.lock > key.json

- name: Restore Spack cache
uses: actions/cache@v2
with:
path: ~/.spack-ci
key: spack-${{ hashFiles('key.json') }}
git clone https://github.com/mochi-hpc/mochi-spack-packages
spack -e tests repo add mochi-spack-packages

- name: Installing spack environment
run: |
spack --color always -e tests install
spack -e tests install

- name: Show spack-installed packages for debugging
run: |
spack --color always -e tests find -dlv
spack -e tests find -dlv

- name: Build code and run unit tests
run: |
eval `spack env activate --sh tests` &&
mkdir build && cd build &&
eval `spack env activate --sh tests`
mkdir build
cd build
cmake .. -DENABLE_TESTS=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DENABLE_SSG=ON \
-DENABLE_EXAMPLES=ON &&
make &&
ctest --output-on-failure
-DENABLE_PYTHON=ON \
-DENABLE_EXAMPLES=ON
make
make check
20 changes: 10 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ project (mochi-raft C CXX)
enable_testing ()

add_library (coverage_config INTERFACE)
add_library (asan_config INTERFACE)

option (ENABLE_COVERAGE "Enable coverage reporting" OFF)
option (ENABLE_TESTS "Build tests" OFF)
option (ENABLE_EXAMPLES "Build examples" OFF)
option (ENABLE_SSG "Build SSG support" OFF)
option (ENABLE_BEDROCK "Build bedrock module" OFF)
option (ENABLE_PYTHON "Build the Python module" OFF)
option (ENABLE_ASAN "Build with address sanitizer" OFF)

# add our cmake module directory to the path
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
Expand Down Expand Up @@ -44,6 +46,11 @@ if (ENABLE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
endif ()
endif ()

if (ENABLE_ASAN AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options (asan_config INTERFACE -fsanitize=address -fno-omit-frame-pointer)
target_link_options (asan_config INTERFACE -fsanitize=address -fno-omit-frame-pointer)
endif ()


find_package (PkgConfig REQUIRED)

Expand Down Expand Up @@ -86,16 +93,9 @@ if (${ENABLE_TESTS})
if (NOT ${ENABLE_SSG})
message (FATAL_ERROR "SSG is required when enabling testing")
endif ()
# find_package (Catch2 QUIET)
# if (NOT Catch2_FOUND)
# include (FetchContent)
# FetchContent_Declare (
# Catch2
# GIT_REPOSITORY https://github.com/catchorg/Catch2.git
# GIT_TAG v3.0.1
# )
# FetchContent_MakeAvailable (Catch2)
# endif ()
if (NOT ${ENABLE_PYTHON})
message (FATAL_ERROR "Python support is required when enabling testing")
endif ()
add_subdirectory (tests)
endif (${ENABLE_TESTS})

Expand Down
28 changes: 28 additions & 0 deletions cmake/FindTCLAP.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# - Find TCLAP
# Find the TCLAP headers
#
# TCLAP_INCLUDE_DIR - where to find the TCLAP headers
# TCLAP_FOUND - True if TCLAP is found

if (TCLAP_INCLUDE_DIR)
# already in cache, be silent
set (TCLAP_FIND_QUIETLY TRUE)
endif (TCLAP_INCLUDE_DIR)

# find the headers
find_path (TCLAP_INCLUDE_PATH tclap/CmdLine.h
PATHS
${CMAKE_SOURCE_DIR}/include
${CMAKE_INSTALL_PREFIX}/include
)

# handle the QUIETLY and REQUIRED arguments and set TCLAP_FOUND to
# TRUE if all listed variables are TRUE
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (TCLAP "TCLAP (http://tclap.sourceforge.net/) could not be found. Set TCLAP_INCLUDE_PATH to point to the headers adding '-DTCLAP_INCLUDE_PATH=/path/to/tclap' to the cmake command." TCLAP_INCLUDE_PATH)

if (TCLAP_FOUND)
set (TCLAP_INCLUDE_DIR ${TCLAP_INCLUDE_PATH})
endif (TCLAP_FOUND)

mark_as_advanced(TCLAP_INCLUDE_PATH)
36 changes: 36 additions & 0 deletions cmake/Findreadline.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Try to find libreadline
# Once done, this will define
#
# READLINE_FOUND - system has readline
# READLINE_INCLUDE_DIRS - readline include directories
# READLINE_LIBRARIES - libraries need to use readline
#
# and the following imported targets
#
# READLINE::READLINE

find_path (READLINE_INCLUDE_DIR
NAMES readline/readline.h
HINTS ${READLINE_ROOT})

find_library (READLINE_LIBRARY
NAMES readline
HINTS ${READLINE_ROOT}
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR})

include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (readline
REQUIRED_VARS READLINE_LIBRARY READLINE_INCLUDE_DIR)

mark_as_advanced (READLINE_FOUND READLINE_LIBRARY READLINE_INCLUDE_DIR)

if (READLINE_FOUND AND NOT TARGET READLINE::READLINE)
add_library (READLINE::READLINE UNKNOWN IMPORTED)
set_target_properties (READLINE::READLINE PROPERTIES
IMPORTED_LOCATION "${READLINE_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${READLINE_INCLUDE_DIR}")
endif ()

set (READLINE_INCLUDE_DIRS ${READLINE_INCLUDE_DIR})
set (READLINE_LIBRARIES ${READLINE_LIBRARY})

Loading
Loading