doStop sequence mspti functions calls
Co-authored-by: Ivan Kniazkov<kniazkov.ivan@huawei.com>
# message auto-generated for no-merge-commit merge:
!64 merge master into master
doStop sequence mspti functions calls
Created-by: trinitrovazelin
Commit-by: trinitrovazelin;Ivan Kniazkov
Merged-by: ascend-robot
Description: # PR Merge Template
**Note: If a checklist item is not applicable to this change, mark it as "N/A" or provide a brief explanation. PRs that do not meet the required standards must not be merged. Please ensure the final commit(s) comply with the merge requirements.**
---
## 1. Change Description
* **Reason for change:**
This change adds a minimal unit test to cover the public MSPTI stop sequence corresponding to the Huawei doStop() usage pattern. The purpose is to provide incremental test coverage and demonstrate active progress on the cleanup-path validation issue.
* **Description of change:**
Added a new unit test file:
test/mspti_cpp/ut/callback/callback_manager_test/callback_stop_chain_utest.cpp
Updated the corresponding build configuration to include the new test source in the existing callback unit test target.
The new test verifies the following public stop sequence:
1. subscribe to MSPTI callback delivery,
2. enable runtime callback domain,
3. enable kernel activity collection,
4. disable kernel activity collection,
5. unsubscribe from callback delivery,
6. verify that callback subscription can be established again after the stop sequence.
---
## 2. Functional Verification
* [x] **Function self-test**
* [ ] **Screenshot of local self-test cases**
* [ ] **Smoke test passed**
**Explanation:**
This MR only adds a unit test and a related build rule update. Smoke verification is currently not involved in this change.
**Self-test result:**
The newly added test compiles and executes successfully.
**Executed test case:**
CallbackStopChainUtest.StopSequenceShouldDisableKernelAndAllowResubscribe
**Observed result:**
* MSPTI activity registration succeeded
* MSPTI subscribe succeeded
* Runtime callback domain enable succeeded
* Kernel activity enable/disable succeeded
* MSPTI unsubscribe succeeded
* Re-subscribe after stop-chain cleanup succeeded
---
## 3. Branch Merge Requirements
* [ ] **Code merged across required branches**
**Explanation:**
N/A at the current development stage / to be completed according to the branch merge process before final merge.
---
## 4. Code Review
* **Requirements:**
* Code changes exceeding 200 lines require a review meeting with at least three reviewers.
* Review density must be at least 1 issue per 100 lines.
* If the review defect density does not meet the requirement, an explanation must be provided.
* In principle, changes exceeding 1000 lines are not allowed to be merged and require special record filing.
* [ ] **Code review completed**
* [x] **UT test case coverage is provided**
A new UT case has been added to cover the MSPTI public stop sequence. The current coverage is intentionally lightweight and focuses on the observable API-level contract.
* **Number of review comments: *0***
---
## 5. Security Self-Check
### Python / C++:
* [ ] **If any external interface was added / removed / changed, related materials have been updated accordingly, and input validation follows the external input checklist**
**Explanation:** N/A. No external interface was added, removed, or changed.
* [ ] **No private file operations are used; secure common-module functions are used instead**
**Explanation:** N/A. This change only adds a unit test.
* [ ] **Temporary files are deleted after task completion, and failure scenarios are also handled without leaving temporary files behind**
**Explanation:** N/A. No temporary files are created.
* [ ] **Array out-of-bounds scenarios are checked, and division-by-zero is checked where applicable**
**Explanation:** N/A. No new array arithmetic or division logic was introduced.
* [ ] **Recursive methods include recursion-depth checks, and regular expressions are checked for ReDoS risks**
**Explanation:** N/A. No recursion or regex logic was introduced.
* [x] **Abnormal input and return-value scenarios are adequately checked where applicable**
The new test verifies expected public API return values across the stop sequence.
* [x] **Logs do not contain spelling or grammar issues and do not expose code details or sensitive information**
No new logging logic is introduced in this change.
### C++:
* [x] **Pointers are checked for null before use where applicable**
The test verifies that the subscriber handle is non-null after successful subscription and resets it after unsubscribe.
* [ ] **Numeric calculations are checked for overflow and wraparound**
**Explanation:** N/A. No numeric calculation logic was introduced.
* [x] **No memory leak exists, including exception/failure scenarios**
The test performs best-effort cleanup in TearDown(), and dynamically allocated activity buffers are released properly.
* [x] **Type conversions do not introduce data truncation**
No unsafe narrowing conversion was introduced in this change.
* [x] **When copying strings, the destination buffer is at least one byte larger than the source buffer**
**Explanation:** N/A. No string copy logic was introduced.
* [x] **When copying memory, the destination buffer is not smaller than the source buffer**
**Explanation:** N/A. No raw memory copy logic was introduced.
* [x] **Pointers are set to nullptr after memory/resource release**
The subscriber handle is explicitly reset to nullptr after unsubscribe.
---
## 6. Change Notification
* [ ] **Documentation updated**
* [ ] **Change notification sent (message notification + email notification)**
**Explanation:**
N/A for this MR unless specifically required by the project process.
See merge request: Ascend/mspti!64