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 (common/app_lib/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 (default: /dev/datadev_0)
-m Comma-separated list of destination channels (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; default: 0x2)
-l Last-user flag (hex, written to luser field; default: 0x0)
-t TX inter-frame pause in microseconds (default: 0)
-r Nonzero disables TX (receive-only mode)
Each option also has a long form (--path, --dest, --size,
--prbsdis, --indexen, --fuser, --luser, --time,
--txdis).
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
Single-threaded bulk-read DMA throughput benchmark. Measures raw transfer rate with configurable iteration count.
Usage: dmaRate [-p <device>] [-c <count>]
-p Device path (default: /dev/datadev_0)
-c Number of iterations (default: 10000000)
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. Checks 1-27
below span 28 ioctls because check 5 exercises both DMA_Get_Index and
DMA_Ret_Index in one round-trip. Checks 28-29 are negative cases for the
register ioctls: addresses that the driver must reject on every card.
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 |
|
Obtains an index (>= 0), then returns it (0) |
6 |
|
Returns 0 or 1 |
7 |
|
Returns 0 |
8 |
|
Returns 0x6 (API version) |
9 |
|
Returns 0 |
10 |
|
Returns >= 0 |
11-22 |
Buffer counters (RX/TX totals, then 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) |
28 |
|
Returns < 0 for |
29 |
|
Each returns < 0 for |
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 (default: /dev/datadev_0)
-c Frames per size step (default: 100)
-n Minimum frame size in bytes (default: 1)
-x Maximum frame size in bytes (default: 4)
GPU-Specific Testing
These applications require the nvidia_p2p_stub and datadev_emulator
modules loaded before datadev (GPU build). See the Phase 3 module loading
steps in CI Pipeline and Test Coverage for the full load sequence.
dmaGpuIoctlTest
Exercises seven of the nine GPU ioctl commands defined in GpuAsync.h
(GPU_Enable_Tx and GPU_Enable_Rx are not covered), 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_Set_Write_Enable_Bulk,
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: gpuGetMaxBuffers(fd))
-s Frame size in bytes (default: 65536)
-c Number of frames (default: 100)
-v Verbose output (repeat for more)
--sweep Run -c frames at each payload size in {65536, 131072, 524288,
1048576}; the first failure aborts
dmaGpuToggleTest
Mid-stream state-transition test for the emulator’s GPU async data path. Three subtests: disable TX/RX mid-run and verify the frame counters settle at zero, re-enable and verify PRBS-clean frames, then reduce the active buffer count from 4 to 2 while traffic flows and verify no dmesg warnings or PRBS mismatches.
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 the emulator’s |
|
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 |
A second, kernel-header-free harness lives in emulator/driver/tests/
and is driven by scripts/ci/build-cpu.sh and build-gpu.sh:
Binary |
Coverage |
|---|---|
|
Compiles |
|
|