Skip to content

Commit 7027291

Browse files
committed
feat: update Docker and test framework for enhanced functionality
- Added bash completion support in the Docker entrypoint script. - Updated Dockerfile to include bash-completion and fonts-lmodern. - Enhanced Rust Makefile with new test commands for stress testing and benchmarking. - Introduced new test scripts for querying primitives and ping service load testing. - Updated README and .gitignore files to reflect new test framework structure and ignore unnecessary files. - Improved logging and error handling in test scripts for better diagnostics.
1 parent ae7304a commit 7027291

26 files changed

Lines changed: 1052 additions & 14 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ skill/__init__.py
2121
*.log
2222
tmp/
2323
tailscale/
24-
target
24+
target
25+
stress_test

docker/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ RUN apt update && apt install -y \
3737
libglfw3 \
3838
libglfw3-dev \
3939
mesa-utils \
40-
libclang-dev python3-vcstool
40+
libclang-dev python3-vcstool \
41+
bash-completion \
42+
fonts-lmodern
4143

4244
# RUN apt update && apt install -y curl && \
4345
# curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/focal.noarmor.gpg | tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null && \

docker/docker-entrypoint.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,21 @@ source /opt/ros/humble/setup.bash
1717

1818
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
1919

20+
# Enable bash completion
21+
if [ -f /usr/share/bash-completion/bash_completion ]; then
22+
. /usr/share/bash-completion/bash_completion
23+
echo "# Enable bash completion" >> ~/.bashrc
24+
echo "if [ -f /usr/share/bash-completion/bash_completion ]; then" >> ~/.bashrc
25+
echo " . /usr/share/bash-completion/bash_completion" >> ~/.bashrc
26+
echo "fi" >> ~/.bashrc
27+
elif [ -f /etc/bash_completion ]; then
28+
. /etc/bash_completion
29+
echo "# Enable bash completion" >> ~/.bashrc
30+
echo "if [ -f /etc/bash_completion ]; then" >> ~/.bashrc
31+
echo " . /etc/bash_completion" >> ~/.bashrc
32+
echo "fi" >> ~/.bashrc
33+
fi
34+
2035
echo -e "[*] \033[1mWelcome to robonix docker environment!\033[0m Distro is: \033[33m$(lsb_release -ds 2>/dev/null || echo "Linux")\033[0m with ROS2 \033[33m$(echo $ROS_DISTRO)\033[0m"
2136
exec bash
2237

rust/Makefile

Lines changed: 65 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
# Robonix Makefile
33
#
44
# Convenient commands for building and running Robonix components
5+
#
6+
# Tab completion: bash-completion is installed in Docker container
7+
# If tab completion doesn't work, ensure bash-completion is installed and enabled
58

6-
.PHONY: help build build-cli build-core build-sdk debug release install install-cli install-core source-sdk env clean test check setup-dev fmt
9+
.PHONY: help build build-cli build-core build-sdk debug release install install-cli install-core source-sdk env clean test test-all test-rust test-python test-cpp test-ros2 benchmark check setup-dev fmt test-framework
710
.DEFAULT_GOAL := help
811

912
# Default ROS2 distribution (can be overridden)
@@ -49,12 +52,22 @@ help:
4952
@echo " make check - Run cargo check on all Rust projects"
5053
@echo " make clean - Clean build artifacts"
5154
@echo ""
55+
@echo "Test commands:"
56+
@echo " make test - Run all tests (Rust, Python)"
57+
@echo " make test-rust - Run Rust CLI stress tests"
58+
@echo " make test-python - Run Python stress tests"
59+
@echo " make benchmark - Run benchmark suite with different concurrency levels"
60+
@echo ""
5261
@echo "Examples:"
5362
@echo " make build"
5463
@echo " make install"
5564
@echo " rbnx config --show"
5665
@echo " rbnx package list"
5766
@echo " eval \$$(make source-sdk)"
67+
@echo ""
68+
@echo "Tab Completion:"
69+
@echo " Tab completion for make targets is enabled automatically in Docker container"
70+
@echo " If it doesn't work, ensure bash-completion package is installed"
5871

5972
# Build mode helper: determine cargo build flags
6073
ifeq ($(BUILD_MODE),release)
@@ -212,11 +225,57 @@ check:
212225
cd $(CORE_DIR) && cargo check
213226
@echo "✓ All checks passed"
214227

215-
test:
216-
@echo "Running tests..."
217-
cd $(CLI_DIR) && cargo test || true
218-
cd $(CORE_DIR) && cargo test || true
219-
@echo "✓ Tests completed"
228+
# Test framework paths
229+
TEST_FRAMEWORK_DIR := $(RUST_DIR)/tools/test_framework
230+
TEST_RUST_DIR := $(TEST_FRAMEWORK_DIR)/rust_tests
231+
TEST_PYTHON_DIR := $(TEST_FRAMEWORK_DIR)/python_tests
232+
TEST_CPP_DIR := $(TEST_FRAMEWORK_DIR)/cpp_tests
233+
TEST_ROS2_DIR := $(TEST_FRAMEWORK_DIR)/ros2_tests
234+
235+
# Test parameters (can be overridden)
236+
CONCURRENCY ?= 3
237+
REQUESTS ?= 1000
238+
RATE ?= 100
239+
DURATION ?= 0
240+
241+
# Test commands
242+
test: test-all
243+
244+
test-all: test-rust test-python
245+
@echo "✓ All tests completed"
246+
247+
test-rust:
248+
@echo "Running Rust CLI stress tests (concurrency=$(CONCURRENCY), requests=$(REQUESTS))..."
249+
@if [ -f "$(TEST_FRAMEWORK_DIR)/test.sh" ]; then \
250+
bash $(TEST_FRAMEWORK_DIR)/test.sh rust rustdds $(CONCURRENCY) $(REQUESTS) $(RATE) $(DURATION); \
251+
else \
252+
echo "Test framework not found. Run 'make test-framework' first."; \
253+
exit 1; \
254+
fi
255+
256+
test-python:
257+
@echo "Running Python stress tests (concurrency=$(CONCURRENCY), requests=$(REQUESTS))..."
258+
@if [ -f "$(TEST_FRAMEWORK_DIR)/test.sh" ]; then \
259+
bash $(TEST_FRAMEWORK_DIR)/test.sh python rustdds $(CONCURRENCY) $(REQUESTS) $(RATE) $(DURATION); \
260+
else \
261+
echo "Test framework not found. Run 'make test-framework' first."; \
262+
exit 1; \
263+
fi
264+
265+
266+
benchmark:
267+
@echo "Running benchmark suite with different concurrency levels..."
268+
@if [ -f "$(TEST_FRAMEWORK_DIR)/benchmark.sh" ]; then \
269+
bash $(TEST_FRAMEWORK_DIR)/benchmark.sh; \
270+
else \
271+
echo "Benchmark script not found."; \
272+
exit 1; \
273+
fi
274+
275+
test-framework:
276+
@echo "Setting up test framework..."
277+
@echo "✓ Test framework ready"
278+
@echo "Run 'make test' to execute all tests"
220279

221280
# Clean commands
222281
clean:

rust/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ ros2 service type /rbnx/task/submit
249249

250250
### Clean up all ROS2 processes
251251
```bash
252-
pkill -9 -f "ros2|robonix|rclpy|rclcpp|demo_rgb_provider"
252+
pkill -9 -f "ros2|robonix|rclpy|rclcpp|demo_rgb_provider|stress"
253253
rm -f /dev/shm/sem.fastrtps_* /dev/shm/fastrtps_*
254254
```
255255

File renamed without changes.

rust/tools/.gitignore

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
8+
# Test logs and outputs
9+
*.log
10+
logs/
11+
test_framework/logs/
12+
**/logs/
13+
14+
# Rust build artifacts
15+
target/
16+
Cargo.lock
17+
**/target/
18+
**/Cargo.lock
19+
20+
# C++ build artifacts
21+
build/
22+
cmake-build-*/
23+
*.o
24+
*.a
25+
*.so
26+
*.dylib
27+
28+
# Generated files (if they should be regenerated)
29+
# Uncomment if generated files should be ignored:
30+
# generated/
31+
32+
# IDE and editor files
33+
.vscode/
34+
.idea/
35+
*.swp
36+
*.swo
37+
*~
38+
.DS_Store
39+
40+
# Test artifacts
41+
*.pid
42+
test_pids.txt
43+
*.tmp
44+
45+
# Benchmark reports (optional - uncomment if you want to ignore them)
46+
# benchmark_report.*
47+
# comprehensive_benchmark_report.*
48+
49+
# OS files
50+
Thumbs.db
51+
.DS_Store

0 commit comments

Comments
 (0)