Implement Overte Authentication and Add Test Entities

- Added documentation for Overte authentication implementation in `docs/OVERTE_AUTH.md`.
- Introduced new GLB files for cube and sphere primitives in `examples/primitives/`.
- Created a JSON file `examples/test_entities.json` containing sample entities for testing.
- Added a build and test script `scripts/build_and_test.sh` for streamlined building and verification of the project.
- Implemented a CI test runner script `scripts/ci-test.sh` to automate testing processes.
- Created a script `scripts/run_with_auth.sh` to facilitate running the Starworld client with Overte authentication.
This commit is contained in:
MayaTheShy
2025-11-09 03:11:12 -05:00
parent ce406e483d
commit 634d226f27
15 changed files with 5 additions and 2 deletions

59
scripts/build_and_test.sh Executable file
View File

@@ -0,0 +1,59 @@
#!/bin/bash
# Quick build and test script for Starworld
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
echo "=== Starworld Build & Test Script ==="
echo
# 1. Build the Rust bridge
echo "[1/3] Building Rust bridge..."
cd "$SCRIPT_DIR/bridge"
cargo build --release
echo "✓ Rust bridge built successfully"
echo
# 2. Build the C++ client
echo "[2/3] Building C++ client..."
cd "$SCRIPT_DIR"
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
echo "✓ C++ client built successfully"
echo
# 3. Verify the bridge library exists
echo "[3/3] Verifying build artifacts..."
BRIDGE_PATH="$SCRIPT_DIR/bridge/target/release/libstardust_bridge.so"
if [ -f "$BRIDGE_PATH" ]; then
echo "✓ Bridge library found: $BRIDGE_PATH"
ls -lh "$BRIDGE_PATH"
else
echo "✗ Bridge library not found at: $BRIDGE_PATH"
exit 1
fi
CLIENT_PATH="$SCRIPT_DIR/build/starworld"
if [ -f "$CLIENT_PATH" ]; then
echo "✓ Client executable found: $CLIENT_PATH"
ls -lh "$CLIENT_PATH"
else
echo "✗ Client executable not found at: $CLIENT_PATH"
exit 1
fi
echo
echo "=== Build Complete! ==="
echo
echo "To test with simulation mode:"
echo " export STARWORLD_SIMULATE=1"
echo " export STARWORLD_BRIDGE_PATH=$SCRIPT_DIR/bridge/target/release"
echo " $SCRIPT_DIR/build/starworld"
echo
echo "To connect to an Overte server:"
echo " export STARWORLD_BRIDGE_PATH=$SCRIPT_DIR/bridge/target/release"
echo " $SCRIPT_DIR/build/starworld ws://domain.example.com:40102"
echo

96
scripts/ci-test.sh Executable file
View File

@@ -0,0 +1,96 @@
#!/bin/bash
# CI test runner script
set -e # Exit on error
set -u # Exit on undefined variable
set -o pipefail # Exit on pipe failure
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo -e "${GREEN}=== Starworld CI Test Suite ===${NC}"
# Check if we're in the right directory
if [[ ! -f "CMakeLists.txt" ]]; then
echo -e "${RED}ERROR: Must be run from starworld root directory${NC}"
exit 1
fi
# Track test results
TESTS_PASSED=0
TESTS_FAILED=0
run_test() {
local test_name="$1"
local test_cmd="$2"
echo -e "\n${YELLOW}Running: ${test_name}${NC}"
if eval "$test_cmd"; then
echo -e "${GREEN}${test_name} PASSED${NC}"
((TESTS_PASSED++))
return 0
else
echo -e "${RED}${test_name} FAILED${NC}"
((TESTS_FAILED++))
return 1
fi
}
# Clean build directory
echo -e "\n${YELLOW}Cleaning build directory...${NC}"
rm -rf build
mkdir -p build
# Build Rust bridge
run_test "Rust Bridge Build" "cd bridge && cargo build --verbose && cd .."
# Build C++ tests
run_test "CMake Configuration" "cd build && cmake .. -DCMAKE_BUILD_TYPE=Debug"
run_test "C++ Build" "cd build && make -j$(nproc)"
# Run unit tests
run_test "C++ Unit Tests" "./build/stardust-tests"
# Verify binaries exist
run_test "Client Binary Exists" "test -f build/starworld"
# Test 5: Verify client can start in simulation mode
echo "TEST: Client Starts (Simulation Mode)"
if timeout 2 env STARWORLD_SIMULATE=1 ./build/starworld > /dev/null 2>&1; then
run_test "Bridge Library Exists" "test -f bridge/target/debug/libstardust_bridge.so"
# Optional: Quick simulation test (non-blocking)
echo -e "\n${YELLOW}Running quick simulation test...${NC}"
if timeout 2 env STARWORLD_SIMULATE=1 ./build/stardust-overte-client > /dev/null 2>&1; then
echo -e "${GREEN}✓ Simulation test completed${NC}"
((TESTS_PASSED++))
else
# Timeout is expected behavior
echo -e "${GREEN}✓ Simulation test timed out (expected)${NC}"
((TESTS_PASSED++))
fi
# Rust code quality checks
if command -v cargo-fmt &> /dev/null; then
run_test "Rust Format Check" "cd bridge && cargo fmt -- --check"
fi
if command -v cargo-clippy &> /dev/null; then
run_test "Rust Clippy" "cd bridge && cargo clippy -- -D warnings"
fi
# Summary
echo -e "\n${GREEN}=== Test Summary ===${NC}"
echo -e "Tests Passed: ${GREEN}${TESTS_PASSED}${NC}"
echo -e "Tests Failed: ${RED}${TESTS_FAILED}${NC}"
if [[ $TESTS_FAILED -eq 0 ]]; then
echo -e "\n${GREEN}ALL TESTS PASSED!${NC}"
exit 0
else
echo -e "\n${RED}SOME TESTS FAILED!${NC}"
exit 1
fi

14
scripts/run_with_auth.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
# Run starworld with authentication
echo "Overte Domain Authentication"
echo "=============================="
echo ""
echo -n "Username: "
read username
echo "(Password no longer sent; Overte uses keypair signatures. Username is optional for now.)"
echo ""
export OVERTE_USERNAME="$username"
echo "Connecting to Overte domain..."
./build/starworld