8000 Add tests for async registry pretty printer by jvolmer · Pull Request #21720 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Add tests for async registry pretty printer #21720

New issue 8000

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

Merged
merged 11 commits into from
May 26, 2025
Prev Previous commit
Next Next commit
Add a gdb integration test skeleton
  • Loading branch information
jvolmer committed May 19, 2025
commit df8264b49bfc2f9e879f8e1b089dda2e1ca1f86c
9 changes: 9 additions & 0 deletions arangod/AsyncRegistryServer/PrettyPrinter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,20 @@ This ensures that the pretty-printer is loaded to gdb. You can check if it is lo

### Run tests

#### Unit tests

Inside src-folder run unittests via
```
python3 -m unittest discover
```

#### Integration tests using gdb

```
cmake --build --preset my-edition --target gdb_pretty_printer
ctest --build --preset my-edition -R test_registry_pretty_printer
```

## Pretty printing the REST call

ArangoDB provides a REST call which gives you all active async operations. The pretty-printer python script improves the readability of the output. Use it as the following:
Expand Down
2 changes: 2 additions & 0 deletions tests/AsyncRegistryServer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ add_executable(arangodbtests_async_registry_server EXCLUDE_FROM_ALL)
target_link_libraries(arangodbtests_async_registry_server
arango_tests_async_registry_server
gtest_main)

add_subdirectory(PrettyPrinter)
16 changes: 16 additions & 0 deletions tests/AsyncRegistryServer/PrettyPrinter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
add_executable(gdb_pretty_printer
async_registry_test.cpp)
target_link_libraries(gdb_pretty_printer
PRIVATE
arango_async_registry)

enable_testing()

add_test(NAME test_registry_pretty_printer
COMMAND gdb
$<TARGET_FILE:gdb_pretty_printer>
-ix ${PROJECT_SOURCE_DIR}/arangod/AsyncRegistryServer/PrettyPrinter/.gdbinit
-x ${CMAKE_CURRENT_SOURCE_DIR}/test.gdbscript
-batch

WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
37 changes: 37 additions & 0 deletions tests/AsyncRegistryServer/PrettyPrinter/async_registry_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Business Source License 1.1 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// https://github.com/arangodb/arangodb/blob/devel/LICENSE
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Julia Volmer
////////////////////////////////////////////////////////////////////////////////

#include <csignal>
#include <iostream>

auto breakpoint() { raise(SIGINT); }

int main() {
// create a registry
// auto testee = 1; // tuple of registries
// auto expected = 3; // for one registry, get a string version of it
breakpoint();
std::cout << "Hello after breakpoint" << std::endl;
// run_test(testee, expected) which internally calls breakpoint again
return 0;
}
6 changes: 6 additions & 0 deletions tests/AsyncRegistryServer/PrettyPrinter/test.gdbscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
run
select-frame function main
continue

quit 0
# quit 1 makes ctest fail
0