adding all files this time
This commit is contained in:
parent
06f09b28c1
commit
5f7b4b5696
25 changed files with 3176 additions and 0 deletions
128
scripts/test-apt-layer.sh
Normal file
128
scripts/test-apt-layer.sh
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
#!/bin/bash
|
||||
|
||||
# apt-layer C Implementation Test Script
|
||||
# Tests the C binary functionality
|
||||
|
||||
set -e
|
||||
|
||||
echo "=== apt-layer C Implementation Tests ==="
|
||||
echo ""
|
||||
|
||||
# Get the directory where this script is located
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||
BUILD_DIR="$PROJECT_DIR/build"
|
||||
|
||||
echo "Project directory: $PROJECT_DIR"
|
||||
echo "Build directory: $BUILD_DIR"
|
||||
echo ""
|
||||
|
||||
# Create build directory if it doesn't exist
|
||||
mkdir -p "$BUILD_DIR"
|
||||
|
||||
# Change to project directory
|
||||
cd "$PROJECT_DIR"
|
||||
|
||||
# Test 1: Build the C binary
|
||||
echo "Test 1: Building C binary..."
|
||||
if make clean && make; then
|
||||
echo "✓ Build successful"
|
||||
else
|
||||
echo "✗ Build failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test 2: Check if binary exists and is executable
|
||||
echo ""
|
||||
echo "Test 2: Binary verification..."
|
||||
if [ -x "./bin/apt-layer" ]; then
|
||||
echo "✓ Binary exists and is executable"
|
||||
ls -la ./bin/apt-layer
|
||||
else
|
||||
echo "✗ Binary not found or not executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test 3: Help command
|
||||
echo ""
|
||||
echo "Test 3: Help command..."
|
||||
if ./bin/apt-layer --help > /dev/null 2>&1; then
|
||||
echo "✓ Help command works"
|
||||
else
|
||||
echo "✗ Help command failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test 4: Version command
|
||||
echo ""
|
||||
echo "Test 4: Version command..."
|
||||
if ./bin/apt-layer --version > /dev/null 2>&1; then
|
||||
echo "✓ Version command works"
|
||||
else
|
||||
echo "✗ Version command failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test 5: Invalid command handling
|
||||
echo ""
|
||||
echo "Test 5: Invalid command handling..."
|
||||
if ! ./bin/apt-layer --invalid-option > /dev/null 2>&1; then
|
||||
echo "✓ Invalid command properly rejected"
|
||||
else
|
||||
echo "✗ Invalid command not properly handled"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test 6: OSTree availability
|
||||
echo ""
|
||||
echo "Test 6: OSTree availability..."
|
||||
if command -v ostree > /dev/null 2>&1; then
|
||||
echo "✓ OSTree is available"
|
||||
ostree --version
|
||||
else
|
||||
echo "⚠ OSTree not found (some features may not work)"
|
||||
fi
|
||||
|
||||
# Test 7: Container tools availability
|
||||
echo ""
|
||||
echo "Test 7: Container tools availability..."
|
||||
if command -v podman > /dev/null 2>&1; then
|
||||
echo "✓ Podman is available"
|
||||
elif command -v docker > /dev/null 2>&1; then
|
||||
echo "✓ Docker is available"
|
||||
else
|
||||
echo "⚠ No container tools found (container features may not work)"
|
||||
fi
|
||||
|
||||
# Test 8: Basic OSTree operations
|
||||
echo ""
|
||||
echo "Test 8: Basic OSTree operations..."
|
||||
if command -v ostree > /dev/null 2>&1; then
|
||||
# Test OSTree repo initialization
|
||||
TEST_REPO="$BUILD_DIR/test-repo"
|
||||
if [ -d "$TEST_REPO" ]; then
|
||||
rm -rf "$TEST_REPO"
|
||||
fi
|
||||
|
||||
if ostree init --repo="$TEST_REPO" --mode=archive-z2; then
|
||||
echo "✓ OSTree repo initialization works"
|
||||
rm -rf "$TEST_REPO"
|
||||
else
|
||||
echo "✗ OSTree repo initialization failed"
|
||||
fi
|
||||
else
|
||||
echo "⚠ Skipping OSTree tests (ostree not available)"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=== Test Summary ==="
|
||||
echo "✓ All basic functionality tests passed"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Test with actual package installations"
|
||||
echo "2. Test layer creation with OSTree"
|
||||
echo "3. Test container-based builds"
|
||||
echo "4. Test error handling and edge cases"
|
||||
echo ""
|
||||
echo "To run more advanced tests, use the Docker testing environment:"
|
||||
echo " ./scripts/start-testing.sh"
|
||||
Loading…
Add table
Add a link
Reference in a new issue