blob: 3f77c6b1744bac06787579051ea0bb2ae1372185 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
# Framebuffer Graphics Library Testing
This directory contains Docker-based testing setup for your Linux framebuffer graphics library. Test your programs in an isolated environment without affecting your main system.
## Quick Start
1. **Setup** (one-time):
```bash
chmod +x test.sh
./test.sh build
```
2. **Run your tests**:
```bash
./test.sh run ./your_program
```
## Prerequisites
- Docker installed and running
- Your compiled graphics programs in this directory
## Files
- `Dockerfile` - Container configuration with framebuffer support
- `test.sh` - Management script for Docker operations
- Your compiled programs and library files
## Usage
### Build Test Environment
```bash
./test.sh build
```
Creates the Docker image with virtual framebuffer support.
### Run Programs
```bash
# Basic usage
./test.sh run ./my_graphics_test
# With arguments
./test.sh run ./demo --width 800 --height 600
# Full path
./test.sh run /app/bin/test_suite
```
### Management Commands
```bash
./test.sh stop # Stop any running test
./test.sh clean # Remove container and image
./test.sh rebuild # Clean build from scratch
./test.sh shell # Interactive debugging shell
./test.sh help # Show all commands
```
## How It Works
1. **Virtual Framebuffer**: Uses `xvfb` to create a virtual display
2. **Isolated Environment**: Your programs run in Ubuntu container
3. **Live Code**: Your directory is mounted, so code changes are immediate
4. **No Graphics Hardware**: No GPU drivers or display required
## Directory Structure
```
your-project/
├── Dockerfile # Container setup
├── test.sh # Test runner script
├── README.md # This file
├── your_library.so # Your graphics library
├── test_program1 # Compiled test program
├── test_program2 # Another test program
└── src/ # Source code (optional)
```
## Testing Workflow
1. **Develop**: Write and compile your graphics programs
2. **Test**: Run `./test.sh run ./program_name`
3. **Debug**: Use `./test.sh shell` for interactive debugging
4. **Iterate**: Make changes and test again (no rebuild needed)
## Troubleshooting
### Build Issues
```bash
./test.sh rebuild # Clean rebuild
```
### Permission Problems
```bash
chmod +x test.sh # Make script executable
chmod +x ./your_program # Make test programs executable
```
### Container Won't Stop
```bash
docker kill fb-test-runner # Force stop
./test.sh clean # Clean everything
```
### Debug Inside Container
```bash
./test.sh shell
# Now you're inside the container
ls -la /app
./your_program --debug
exit
```
## Advanced Usage
### Custom Framebuffer Size
Modify the Dockerfile to set specific display dimensions:
```dockerfile
ENV DISPLAY=:99
ENV XVFB_RES=1920x1080x24
```
### Capture Screenshots
Add to your test programs:
```bash
# Inside container
import -window root screenshot.png
```
### Multiple Test Runs
```bash
for test in test_*.exe; do
./test.sh run ./$test
done
```
## Performance Notes
- **Fast startup**: Containers start instantly
- **Low overhead**: Minimal resource usage
- **Quick iteration**: Code changes don't require rebuilds
- **Parallel testing**: Can run multiple containers
## Integration with CI/CD
Add to your build pipeline:
```yaml
# Example GitHub Actions
- name: Test Graphics Library
run: |
chmod +x test.sh
./test.sh build
./test.sh run ./test_suite
```
## Cleanup
When done testing:
```bash
./test.sh clean # Remove everything
# Or just let Docker clean up automatically
```
## Tips
- Keep your test programs in the main directory for easy access
- Use descriptive names for test programs: `test_rendering.exe`, `demo_shapes.exe`
- The container has full Ubuntu tools available for debugging
- Virtual framebuffer works with most graphics operations your library performs
|