A comprehensive test suite for validating Docker container capabilities including graphics (X11, OpenGL, NVIDIA), audio (ALSA, PulseAudio), multimedia frameworks (GStreamer, YARP), and system integration.
This repository provides automated tests to verify that Docker containers are properly configured with access to:
- X11 Display Server - GUI window system
- Audio Systems - ALSA and PulseAudio/PipeWire
- OpenGL - Hardware-accelerated graphics
- NVIDIA GPUs - GPU computing and graphics acceleration
- GStreamer - Multimedia framework for video processing
- YARP - Robotics middleware platform
Run all system tests:
./run_system_tests.shThis will execute all available tests and report success/failure for each component.
log_system_info.sh- Logs comprehensive system information including kernel version, distro, Docker detection, user/group info, display configuration, audio devices, and GPU information.
x11/test_x11.sh- Verifies X11 connection by checking theDISPLAYenvironment variable and querying the X server withxset.
audio/test_pulse.sh- Tests PulseAudio/PipeWire connectivity and audio playback usingpaplay.audio/test_alsa_playback.sh- Tests ALSA playback capability.audio/test_alsa_record.sh- Tests ALSA recording capability.
opengl/test_opengl.sh- Validates OpenGL context creation and reports renderer/version information usingglxinfo.nvidia/test_nvidia.sh- Checks NVIDIA GPU accessibility vianvidia-smiand verifies driver functionality.
gstreamer/- Contains GStreamer pipeline tests:videotestsrc.sh- Video test sourceh264enc.sh- H.264 encodingcamera.sh- Camera captureserverh264.sh/clienth264.sh- H.264 streaming tests
yarp/test_yarp.sh- Comprehensive YARP middleware test including server startup, CLI verification, plugin checks, port communication, RPC calls, and Python bindings.
Tests can be configured using environment variables:
export AUDIO_MUTED=yes # Mute audio during playback tests (default: no)
export ALSA_DEVICE=default # ALSA PCM device (default: default)
export PULSE_TEST_WAV=/path/to/test.wav # Custom test audio fileThe common.sh file provides shared utilities and default configurations used across tests.
- Docker with X11 socket access
- Audio system (ALSA/PulseAudio/PipeWire)
- Optional: NVIDIA Docker runtime for GPU tests
- Optional: GStreamer for multimedia tests
- Optional: YARP for robotics tests
Tests expect the following tools to be installed in the container:
- Core:
bash,xset - Audio:
aplay,arecord,pactl,paplay - Graphics:
glxinfo,nvidia-smi(for NVIDIA tests) - Multimedia:
gst-launch-1.0(for GStreamer tests) - Robotics:
yarp,yarpserver,yarp-config,python3(for YARP tests)
docker run -it --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
-v /run/user/$UID/pulse:/run/user/1000/pulse \
-e PULSE_SERVER=unix:/run/user/1000/pulse/native \
--device /dev/snd \
--device /dev/dri \
--gpus all \
your-image:tag \
/path/to/run_system_tests.sh-e DISPLAY=$DISPLAY- Pass display variable-v /tmp/.X11-unix:/tmp/.X11-unix:rw- X11 socket access-v /run/user/$UID/pulse:...- PulseAudio socket access--device /dev/snd- ALSA audio devices--device /dev/dri- Direct Rendering Infrastructure (GPU)--gpus all- NVIDIA GPU access (requires nvidia-docker2)
- 0 - All tests passed
- 1 - One or more tests failed
- 2 - Missing required command/dependency
Tests use color-coded output:
- 🟡 Yellow - Test starting
- 🟢 Green - Test passed
[OK] - 🔴 Red - Test failed
[FAILED]
- Create test script in appropriate category folder
- Source
common.shfor shared utilities (need,die,ok) - Add test to
run_system_tests.sh - Follow the pattern:
#!/usr/bin/env bash set -euo pipefail SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/../common.sh" need required_command # Your test logic here [[ condition ]] || die "Error message" ok "Success message"
From common.sh:
need <command>- Check if command exists, exit with code 2 if missingdie <message>- Print error message and exit with code 1ok <message>- Print success message
BSD 2-Clause License
Copyright (c) 2020, Social Cognition in Human-Robot Interaction
See LICENSE for full details.
Contributions are welcome! Please ensure:
- Tests are idempotent and don't require user interaction
- Tests clean up any temporary resources
- Error messages are clear and actionable
- Tests follow the existing patterns and utilities
- Verify
DISPLAYis set correctly - Check X11 socket is mounted:
-v /tmp/.X11-unix:/tmp/.X11-unix:rw - Run
xhost +local:on host if permission denied
- Verify audio devices:
--device /dev/snd - Check PulseAudio socket path matches host UID
- Try
AUDIO_MUTED=yesto test without actual playback
- Ensure nvidia-docker2 is installed
- Use
--gpus allflag - Verify driver version matches host:
nvidia-smi
- Check user/group IDs match between host and container
- Verify device permissions:
ls -l /dev/snd /dev/dri - Add user to required groups (audio, video)
Developed with love by the Social Cognition in Human-Robot Interaction (S4HRI) team.