138 lines
No EOL
3.6 KiB
Markdown
138 lines
No EOL
3.6 KiB
Markdown
# apt-layer C Implementation - Testing Environment
|
|
|
|
This directory contains scripts and documentation for testing the apt-layer C implementation.
|
|
|
|
## Directory Structure
|
|
|
|
```
|
|
apt-layer/
|
|
├── build/ # Build artifacts (gitignored)
|
|
├── docker/ # Docker testing environment (gitignored)
|
|
├── scripts/ # Testing scripts and documentation
|
|
├── src/ # C source code
|
|
├── bin/ # Compiled binary
|
|
└── ...
|
|
```
|
|
|
|
## Quick Start
|
|
|
|
### Prerequisites
|
|
|
|
1. **Docker and Docker Compose** installed
|
|
2. **apt-cache server** running
|
|
3. **Git Bash** (for Windows users)
|
|
|
|
### Starting the Testing Environment
|
|
|
|
#### Windows (PowerShell)
|
|
```powershell
|
|
.\scripts\start-testing.ps1
|
|
```
|
|
|
|
#### Linux/macOS (Bash)
|
|
```bash
|
|
./scripts/start-testing.sh
|
|
```
|
|
|
|
The script will:
|
|
1. Check for the existing apt-cache server (apt-cacher-ng on port 3142)
|
|
2. Build and start the Ubuntu 24.04 testing container
|
|
3. Connect to the existing apt-cache server for faster package downloads
|
|
4. Attach you to an interactive shell inside the container
|
|
|
|
### Manual Container Management
|
|
|
|
```bash
|
|
# Start container
|
|
cd docker && docker-compose up -d
|
|
|
|
# Attach to container
|
|
docker-compose exec apt-layer-test /bin/bash
|
|
|
|
# View logs
|
|
docker-compose logs -f apt-layer-test
|
|
|
|
# Stop container
|
|
docker-compose down
|
|
```
|
|
|
|
## Testing the C Implementation
|
|
|
|
### Basic Tests (Outside Container)
|
|
```bash
|
|
./scripts/test-apt-layer.sh
|
|
```
|
|
|
|
### Advanced Tests (Inside Container)
|
|
```bash
|
|
# Build the C binary
|
|
make clean && make
|
|
|
|
# Test basic functionality
|
|
./bin/apt-layer --help
|
|
./bin/apt-layer --version
|
|
|
|
# Test with actual OSTree operations
|
|
./bin/apt-layer --list
|
|
./bin/apt-layer --info particleos/base/plucky
|
|
|
|
# Test layer creation
|
|
./bin/apt-layer particleos/base/plucky particleos/test/plucky
|
|
```
|
|
|
|
## Environment Details
|
|
|
|
### Container Features
|
|
- **Base Image**: Ubuntu 24.04 (Plucky)
|
|
- **Build Tools**: gcc, make, git
|
|
- **OSTree**: Full OSTree installation with development headers
|
|
- **Container Tools**: Podman and Docker
|
|
- **Package Cache**: Connected to existing apt-cacher-ng server
|
|
|
|
### Volume Mounts
|
|
- **Workspace**: `/workspace` (project root)
|
|
- **Cache**: `/cache` (persistent cache directory)
|
|
|
|
### Network
|
|
- **apt-cache**: Connected to existing `particleos-network`
|
|
- **Proxy**: Uses apt-cacher-ng for faster package downloads
|
|
|
|
## Troubleshooting
|
|
|
|
### Container Won't Start
|
|
1. Check if Docker is running
|
|
2. Ensure port 3142 is available for apt-cache
|
|
3. Check Docker logs: `docker-compose logs apt-layer-test`
|
|
|
|
### apt-cache Connection Issues
|
|
1. Verify apt-cacher-ng is running: `docker ps | grep apt-cacher-ng`
|
|
2. Start it if needed: `docker start apt-cacher-ng`
|
|
3. Check network connectivity: `curl http://localhost:3142/acng-report.html`
|
|
|
|
### Build Failures
|
|
1. Ensure all dependencies are installed in container
|
|
2. Check for sufficient disk space
|
|
3. Verify OSTree repository permissions
|
|
|
|
## Development Workflow
|
|
|
|
1. **Edit C code** in `src/` directory
|
|
2. **Build** with `make clean && make`
|
|
3. **Test** with `./scripts/test-apt-layer.sh`
|
|
4. **Advanced testing** in Docker container
|
|
5. **Iterate** and repeat
|
|
|
|
## Integration with particleos-builder
|
|
|
|
This testing environment is designed to work alongside your existing particleos-builder setup:
|
|
|
|
- **Shared apt-cache**: Uses the same apt-cacher-ng server
|
|
- **Shared network**: Connects to particleos-network
|
|
- **Complementary**: Focuses on apt-layer development while particleos-builder handles OS builds
|
|
|
|
## Files
|
|
|
|
- `start-testing.sh` - Bash startup script
|
|
- `start-testing.ps1` - PowerShell startup script
|
|
- `test-apt-layer.sh` - Basic test suite
|
|
- `SETUP-SUMMARY.md` - Detailed setup documentation |