Test Applications
The data_dev/app/ directory contains C++ test applications that exercise
the datadev kernel driver through its user-space API. These applications
form the verification backbone of the CI pipeline: every push to the
repository runs the full suite across five Linux distributions on real
kernel modules loaded against the emulator.
All applications link against include/DmaDriver.h, include/AxisDriver.h,
and the PRBS library (data_dev/app/src/PrbsData.cpp). They are built by
make -C data_dev/app and placed in data_dev/app/bin/.
DMA Loopback and Throughput
dmaLoopTest
Continuous DMA loopback with PRBS data integrity verification. A write
thread sends frames through the driver, the emulator memcpy-loops them
back, and a read thread validates every byte against the expected PRBS
sequence.
Usage: dmaLoopTest -p <device> [-m <dest>] [-s <size>] [-d] [-i]
[-f <fuser>] [-l <luser>] [-t <pause_us>] [-r <txDis>]
-p Device path (e.g. /dev/datadev_0)
-m Destination channel (default: 0)
-s Frame size in bytes (default: 10000)
-d Disable PRBS checking
-i Enable index-based zero-copy mode
-f First-user flag (hex, written to fuser field)
-l Last-user flag (hex, written to luser field)
-t TX inter-frame pause in microseconds
-r Disable TX (receive-only mode)
Reports per-second statistics: TxCount, RxCount, TxRate, RxRate, PrbErr.
Used by CI in two modes: 30-second sustained throughput (Test 1) and
60-second data integrity check (test_data_integrity.sh).
dmaRate
Multi-threaded DMA throughput benchmark. Measures raw transfer rate with configurable iteration count.
Usage: dmaRate -p <device> [-c <count>]
-p Device path
-c Number of iterations (default: 1000)
Ioctl and File Operations
dmaIoctlTest
Exercises all 28 ioctl commands (24 DMA from DmaDriver.h, 2 AXIS from
AxisDriver.h, 1 AxiVersion from AxiVersion.h, 1 GPU readiness from
GpuAsync.h), validating return values and argument semantics. The 27
numbered checks below span 28 ioctls because check 5 exercises both
DMA_Get_Index and DMA_Ret_Index in one round-trip.
Usage: dmaIoctlTest -p <device>
Tests each ioctl in the following order:
# |
Ioctl |
Validation |
|---|---|---|
1 |
|
Returns > 0 |
2 |
|
Returns > 0 |
3 |
|
Returns 0 |
4 |
|
Returns 0 |
5 |
|
Returns >= 0 |
6 |
|
Returns 0 for previously obtained index |
7 |
|
Returns >= 0 |
8 |
|
Returns 0 |
9 |
|
Returns 0x6 (API version) |
10 |
|
Returns 0 |
11 |
|
Returns >= 0 |
12-22 |
Buffer counters (TX/RX in User/HW/PreHWQ/SWQ/Miss) |
Each returns >= 0 |
23 |
|
Returns non-empty string |
24 |
|
Void return, no crash |
25 |
|
Returns >= 0 |
26 |
|
Returns 0, firmware version non-zero |
27 |
|
Returns 0 (CPU) or 1 (GPU) |
dmaFileOpsTest
Validates the driver’s file_operations implementation: open, close,
multiple concurrent opens, select() read/write readiness, mmap for
DMA buffer access, and read() with no pending data.
Usage: dmaFileOpsTest -p <device>
Tests: open, multiple open, select(read), select(write), dmaMapDma, dmaUnMapDma, read(no-data), ioctl(DMA_Get_Buff_Size), close.
Error Path Testing
dmaErrorTest
Validates driver behavior under error conditions: buffer pool exhaustion, oversized write rejection, and invalid buffer index handling.
Usage: dmaErrorTest -p <device>
Tests:
Buffer exhaustion — holds all TX buffers, verifies
dmaGetIndexreturns -1 when the pool is empty andDMA_Get_TxBuffinUser_Countmatches the held count.Oversized write — attempts a write larger than
cfgSize, expects rejection (errno = EINVAL).Invalid index — returns an out-of-range buffer index, expects rejection.
dmaSmallFrameTest
Sweep test for small frame sizes. Verifies that the DMA engine correctly handles frames from a configurable minimum up to a maximum size, catching alignment and boundary issues.
Usage: dmaSmallFrameTest -p <device> [-c <count>] [-n <min>] [-x <max>]
-p Device path
-c Frames per size step (default: 100)
-n Minimum frame size (default: 4)
-x Maximum frame size (default: 256)
GPU-Specific Testing
These applications require the nvidia_p2p_stub and datadev_emulator
modules loaded before datadev (GPU build). See Set Up GPUDirect RDMA
for the full load sequence.
dmaGpuIoctlTest
Exercises all six GPU ioctl commands defined in GpuAsync.h, validating
GPU async support detection, version queries, and buffer management.
Usage: dmaGpuIoctlTest -p <device>
Tests: GPU_Is_Gpu_Async_Supp, GPU_Get_Gpu_Async_Ver,
GPU_Get_Max_Buffers, GPU_Add_Nvidia_Memory,
GPU_Set_Write_Enable, GPU_Rem_Nvidia_Memory.
rdmaTestEmu
End-to-end GPUDirect RDMA loopback test using the emulator. A CUDA-free
C++17 port that allocates GPU-like memory via nvidia_p2p_stub, registers
it with the driver, and performs DMA loopback transfers through the
emulator’s GPU async V4 engine.
Usage: rdmaTestEmu [-d <device>] [-b <buffers>] [-s <size>]
[-c <count>] [-v] [--sweep]
-d Device path (default: /dev/datadev_0)
-b Number of GPU buffers (default: 1)
-s Transfer size in bytes (default: 4096)
-c Number of transfers (default: 10)
-v Verbose output (repeat for more)
--sweep Run payload-size matrix (powers of 2 up to 1 MB)
dmaGpuToggleTest
Tests GPU enable/disable toggling via ioctl. Exercises the driver’s
GPU_Add_Nvidia_Memory / GPU_Rem_Nvidia_Memory cycle to verify
clean state transitions.
Usage: dmaGpuToggleTest -p <device>
Shell-Based Test Harness
The tests/ directory contains shell scripts that compose the C++
applications into higher-level integration tests. Each script is invoked
by scripts/ci/test-cpu.sh or scripts/ci/test-gpu.sh during CI.
Script |
Coverage |
|---|---|
|
Master test runner: ioctl, file-ops, error-paths, multichannel, proc, data-integrity, idx-loopback, tuser-sweep, frame-sizes, small-frames, concurrent-open, backpressure, irq-modes |
|
Runs |
|
Simultaneous loopback on destinations 0, 7, and 8; verifies no cross-channel contamination |
|
Saturates TX buffers then verifies recovery and correct dmesg state |
|
Sweeps |
|
Two |
|
Index-based zero-copy loopback ( |
|
|
|
Two extreme fuser/luser combinations (0x00 + 0xFF, 0xFF + 0x00) via
|
|
Module parameter validation: loads with custom cfgTxCount/cfgRxCount/cfgSize,
verifies |
|
Validates |
|
Reproducer for the NULL-pointer deref in |
|
|
|
|
|
GPU ioctl validation via |
|
GPU DMA loopback: |
|
GPU-specific |