Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ Module.symvers
Mkfile.old
dkms.conf
vcam-util

# Test artifacts
artifacts/
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ kmod:
clean:
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
$(RM) vcam-util

.PHONY: test-v4l2
test-v4l2:
./scripts/test-v4l2.sh
65 changes: 65 additions & 0 deletions scripts/test-v4l2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env bash

set -euo pipefail

ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
ARTIFACT_DIR="${ROOT_DIR}/artifacts/v4l2-$(date +%Y%m%d-%H%M%S)"
LOG="${ARTIFACT_DIR}/test.log"

mkdir -p "${ARTIFACT_DIR}"
exec > >(tee -a "${LOG}") 2>&1

cd "${ROOT_DIR}"

echo "== Environment =="
uname -a
echo

echo "== Build =="
make clean
make
echo

echo "== Load dependencies =="
sudo modprobe -a videobuf2_vmalloc videobuf2_v4l2 videobuf2_dma_contig
echo

echo "== Reload vcam =="
sudo rmmod vcam 2>/dev/null || true
sudo insmod vcam.ko
echo

echo "== Detect video device =="
sudo ./vcam-util -l | tee "${ARTIFACT_DIR}/vcam-util-list.txt"
VIDEO_DEV="$(sudo ./vcam-util -l |
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
Outdated
awk '/\/dev\/video[0-9]+/ {print $NF; exit}')"

if [[ -z "${VIDEO_DEV}" ]]; then
echo "ERROR: cannot find a vcam video device"
exit 1
fi

echo "VIDEO_DEV=${VIDEO_DEV}" | tee "${ARTIFACT_DIR}/device.env"
echo

echo "== v4l2-compliance =="
sudo v4l2-compliance -d "${VIDEO_DEV}" -f |
tee "${ARTIFACT_DIR}/v4l2-compliance.txt"
echo

echo "== v4l2-ctl --all =="
sudo v4l2-ctl -d "${VIDEO_DEV}" --all |
tee "${ARTIFACT_DIR}/v4l2-ctl-all.txt"
echo

echo "== v4l2-ctl --list-formats-ext =="
sudo v4l2-ctl -d "${VIDEO_DEV}" --list-formats-ext |
tee "${ARTIFACT_DIR}/v4l2-formats-ext.txt"
echo

echo "== dmesg tail =="
sudo dmesg | tail -n 100 |
tee "${ARTIFACT_DIR}/dmesg-tail.txt" || true
echo

echo "Artifacts saved to: ${ARTIFACT_DIR}"