Skip to content

test: add hardware-independent self-test for issue #367 - #369

Open
Mahima Bhattaram (m-bhattar) wants to merge 1 commit into
qualcomm:developmentfrom
m-bhattar:add-selftest
Open

test: add hardware-independent self-test for issue #367#369
Mahima Bhattaram (m-bhattar) wants to merge 1 commit into
qualcomm:developmentfrom
m-bhattar:add-selftest

Conversation

@m-bhattar

@m-bhattar Mahima Bhattaram (m-bhattar) commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Add fastrpc_selftest, a hardware-independent test that exercises all 47 exported symbols from symbols.lst and passes make check without physical DSP hardware present.

The current test suite requires functional DSP hardware, making it incompatible with standard Linux distribution builds and CI/CD pipelines. This patch adds fastrpc_selftest covering:

  • Compile-time constants / macro arithmetic (domain IDs, REMOTE_SCALARS,
    rpcmem heap IDs, dspqueue flags)
  • Handle lifecycle: remote_handle_open/close, remote_handle64_open/close
  • Handle invoke with INVALID handles (no crash)
  • Control APIs: remote_handle_control (DSPRPC_GET_DSP_INFO/DSPRPC_GET_DOMAIN),
    remote_handle64_control, remote_session_control
  • Async job APIs: fastrpc_async_get_status, fastrpc_release_async_job
  • rpcmem lifecycle: init, alloc, alloc2, alloc_def, to_fd, free, deinit
  • fastrpc_mmap / fastrpc_munmap
  • remote_register_buf / buf_attr / buf_attr2
  • remote_register_fd / fd2
  • remote_register_dma_handle / dma_handle_attr
  • remote_set_mode
  • Deprecated mapping APIs: remote_mmap/munmap, remote_mmap64/munmap64,
    remote_mem_map/mem_unmap
  • dspqueue: create (fails gracefully without hardware), close(NULL),
    request; write/read/peek/export/get_stat run only when hardware present
  • HAP_debug_v2 / HAP_debug_runtime

The selftest is Linux-only (guarded by 'if ANDROID_CC ... else ... endif') and links against libcdsprpc.la from the build tree. make check exits 0 on a standard x86 machine with no DSP device installed.

Fixes: #367
CRs-Fixed: 4632155

@quic-vkatoch

Copy link
Copy Markdown
Contributor

Please update PR description and commit message

Add fastrpc_selftest, a hardware-independent test that exercises all 47
exported symbols from symbols.lst and passes make check without physical
DSP hardware present.

The current test suite requires functional DSP hardware, making it
incompatible with standard Linux distribution builds and CI/CD pipelines.
This patch adds fastrpc_selftest covering:

  -  Compile-time constants / macro arithmetic (domain IDs, REMOTE_SCALARS,
     rpcmem heap IDs, dspqueue flags)
  -  Handle lifecycle: remote_handle_open/close, remote_handle64_open/close
  -  Handle invoke with INVALID handles (no crash)
  -  Control APIs: remote_handle_control (DSPRPC_GET_DSP_INFO/DSPRPC_GET_DOMAIN),
     remote_handle64_control, remote_session_control
  -  Async job APIs: fastrpc_async_get_status, fastrpc_release_async_job
  -  rpcmem lifecycle: init, alloc, alloc2, alloc_def, to_fd, free, deinit
  -  fastrpc_mmap / fastrpc_munmap
  -  remote_register_buf / buf_attr / buf_attr2
  -  remote_register_fd / fd2
  -  remote_register_dma_handle / dma_handle_attr
  -  remote_set_mode
  -  Deprecated mapping APIs: remote_mmap/munmap, remote_mmap64/munmap64,
     remote_mem_map/mem_unmap
  -  dspqueue: create (fails gracefully without hardware), close(NULL),
     request; write/read/peek/export/get_stat run only when hardware present
  -  HAP_debug_v2 / HAP_debug_runtime

The selftest is Linux-only (guarded by 'if ANDROID_CC ... else ... endif')
and links against libcdsprpc.la from the build tree.  make check exits 0
on a standard x86 machine with no DSP device installed.

Signed-off-by: Bharath Kumar <quic_bkumar@quicinc.com>
Signed-off-by: Mahima Bhattaram <mbhattar@qti.qualcomm.com>
@anankulk

Copy link
Copy Markdown
Contributor

Pre-merge CI results — patch 289061d3e209

Validated On

  • fastrpc baseline (development): 228d98b5f143
  • kernel baseline (qcom-next (reference)): 6548ba1da927

Kernel: 7.2.0-rc3-01271-g8d5dbc1b17ad

Test Matrix

Targets Domain PD Type Tests Result
kaanapali-mtpADSPSigned3/3✅ Pass
kaanapali-mtpCDSPSigned3/3✅ Pass
kaanapali-mtpCDSPUnsigned3/3✅ Pass
lemans-evkADSPSigned3/3✅ Pass
lemans-evkCDSPSigned3/3✅ Pass
lemans-evkCDSPUnsigned3/3✅ Pass
lemans-evkCDSP1Signed3/3✅ Pass
lemans-evkCDSP1Unsigned3/3✅ Pass
qcs615-rideADSPSigned3/3✅ Pass
qcs615-rideCDSPSigned3/3✅ Pass
qcs615-rideCDSPUnsigned3/3✅ Pass
qcs6490-rb3gen2ADSPSigned3/3✅ Pass
qcs6490-rb3gen2CDSPSigned3/3✅ Pass
qcs6490-rb3gen2CDSPUnsigned3/3✅ Pass
qcs8300-rideADSPSigned3/3✅ Pass
qcs8300-rideCDSPSigned3/3✅ Pass
qcs8300-rideCDSPUnsigned3/3✅ Pass
sm8750-mtpADSPSigned3/3✅ Pass
sm8750-mtpCDSPSigned3/3✅ Pass
sm8750-mtpCDSPUnsigned3/3✅ Pass

LAVA Jobs:

Comment thread test/fastrpc_selftest.c
@@ -0,0 +1,578 @@
// Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use year-less copyright

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

acked

Comment thread test/fastrpc_selftest.c
* Per the API contract these are void and must not crash.
*/
char dummy[64];
remote_register_buf(dummy, (int)sizeof(dummy), -1);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not checking error, is that expected?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, remote_register_buf returns void. The purpose of this test is only to verify that calling the deregister path on a buffer that was never registered is handled safely and does not crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a generic self-test for non-DSP environments

6 participants