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
Add test for group of runtime launch callbacks for common runtime profiling scenario.
Co-authored-by: ilya_a<abanin.ilya@huawei.com>
# message auto-generated for no-merge-commit merge:
!68 merge test_group_of_rt_launch_callbacks into master
Add test for group of runtime launch callbacks for common runtime profiling scenario.
Created-by: ilya_a
Commit-by: ilya_a
Merged-by: ascend-robot
Description: # PR merging template
**Note: If the self-check result indicates that the item is not involved, mark it as "N/A" or directly tick it. In special cases, provide a written explanation. PRs that do not comply with the specifications are not allowed to be merged. Please be aware of this.**
----
## 1. Change Description
- **Reason for change: Add unit test to check most common chain of launch callbacks for time profiling.**
- **Change details: Added unit test to callback test suite.**
----
## 2. Function Verification
- [x] **Self-verification**
- [x] **Screenshots of local self-verification cases**
- [ ] **Smoke test result** (Enter the link to the self-verification report in the group. If the test fails, please provide the reason: __________________. For the function code, please proactively report and add the smoke test.)
----
## 3. Branch Merging Requirements
- [x] **Code merging** (Ensure that the latest code of the master branch is merged into the poc and pre-research branches, and that the code of the poc branch has been correctly merged into the pre-research branch.)
----
## 4. Code Review
- **Requirements:**
- If the code to be merged exceeds 200 lines, the code must be reviewed by at least three people.
- The code review density must be greater than or equal to 1 review per 100 lines.
- If the defect density in the code review does not meet the requirements, an explanation must be provided.
- In principle, code with more than 1000 lines is not allowed to be merged. If such code needs to be merged, it must be archived.
- [ ] **Whether the code has been reviewed**
- [x] **Whether UT cases are maintained** (If the requirement is not met, please provide the reason: __________________.)
- **Number of review comments: _____** (Please fill in the total number of comments for this review, which will be used for review before the commit is merged.)
----
## 5. Security Self-Check
### Python and C++
- [x] **After external APIs are added, deleted, or changed, the corresponding documentation must be added, deleted, or changed accordingly. For details about the verification of input parameters of new APIs, see the external input table.**
- [x] **Private file operations are not allowed. Only the security functions of the public module can be used.**
- [x] **Temporary files must be deleted after a task is complete. In addition, ensure that no temporary files are left after the task fails.**
- [x] **Out-of-bounds access to arrays must be verified. Division by zero must be checked.**
- [x] **The recursion depth of recursive methods must be verified. Regular expressions must be checked for ReDoS.**
- [x] **The input and return values of APIs must be fully verified.**
- [x] **Logs must not contain spelling or syntax errors, and must not expose code details or sensitive information.**
### C++
- [x] **Null pointer check is required before using a pointer.**
- [ ] **Numerical calculation**
See merge request: Ascend/mspti!68
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