Skip to content

Commit

Permalink
Add documentation for ASAN, LSAN and UTC feature
Browse files Browse the repository at this point in the history
Signed-off-by: Vivek Ellur <vivek.ellur@samsung.com>
  • Loading branch information
vivek-ellur committed Oct 15, 2024
1 parent 91deea4 commit 566fcc8
Show file tree
Hide file tree
Showing 16 changed files with 96 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/application/toc_all.md
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,9 @@
### Tools
#### [Profiler](/application/vscode-ext/tools/profiler-user-manual.md)
#### [Memory Profiler](/application/vscode-ext/tools/memory-profiler-user-manual.md)
#### [Address Sanitizer](/application/vscode-ext/tools/address-sanitizer-user-manual.md)
#### [Leak Sanitizer](/application/vscode-ext/tools/leak-sanitizer-user-manual.md)
#### [UTC and Code Coverage](/application/vscode-ext/tools/unit-test-code-coverage-user-manual.md)
### Tizen
#### [Hybrid application development](/application/vscode-ext/Tizen/hybrid.md)
#### [RPK Application Development](/application/vscode-ext/Tizen/rpk.md)
Expand Down
33 changes: 33 additions & 0 deletions docs/application/vscode-ext/tools/address-sanitizer-user-manual.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Detecting Runtime Memory Errors with Address Sanitizer
- The Address Sanitizer is a tool that helps find memory errors in Tizen native apps. It checks if certain parts of the code might cause memory problems while running. This tool can prevent crashes or bugs during app use. It works by adding extra code during app compilation. If the app doesn't crash with the Address Sanitizer, it means the code is safe from memory issues. The tool can find different types of bugs. The Address Sanitizer tool can detect the following types of bugs:

- Out-of-bounds accesses to heap and stack
- Use-after-free
- Use-after-return (to some extent)
- Double free and invalid free

## Using Address Sanitizer
- In the **Menu**, click on view and select **Command Palette > Tizen: Profile with Memory Errors**.

The profiling instruments the code and compiles the project for the Address Sanitizer. Finally, it launches the application on the connected target or emulator, as illustrated in the following figure.

![Launch Command](media/launch_asan.png)
<br>

- After the application is launched, run the application scenario you want to test
- Visual studio code shows the profiling result after clicking on **Stop Profiling Button**.

![Stop Profile Button](media/stop_profiling_button.png)
<br>

- Once clicked on the **Stop Profiling Button**, application will crash if there are any errors hence the report will be generated and if there are no memory errors it will give the message no error found, as illustrated in the following figure.

![Asan UI Report](media/failure_report.png)
<br>

## Source File Navigation on Failure
- When a failure occurs, you can click on the **line number associated with the failure which is generated in UI Report**.
- This action will open the corresponding source file in your editor and **navigate to the exact location where the failure has occurred**, as illustrated in the following figure.


![Failure occured](media/failure_line.png)
25 changes: 25 additions & 0 deletions docs/application/vscode-ext/tools/leak-sanitizer-user-manual.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Detecting Runtime Memory Errors with Leak Sanitizer
- The Leak Sanitizer is a profiling tool designed to identify runtime memory leaks in Tizen native applications. It helps developers pinpoint sections of code that may lead to memory leaks during execution. By instrumenting the code during application compilation, the tool can detect memory leaks at runtime. If the program runs without crashing under Leak Sanitizer, it indicates that the code is free from potential memory leaks. This ensures safer and more efficient memory management in Tizen applications.

## Using Leak Sanitizer
- In the **File Explorer view**, click on view and select **Command Palette > Tizen: Profile with Leak Sanitizer**.

The profiling instruments the code and compiles the project for the Leak Sanitizer. Finally, it launches the application on the connected target or emulator, as illustrated in the following figure.

![Launch Command](media/launch_lsan.png)
<br>

- After the application is launched, run the application scenario you want to test
- Visual studio code shows the profiling result after clicking on **Stop Profiling Button**.

![Stop Profile Button](media/stop_profiling_button.png)
<br>

- Once clicked on the **Stop Profiling Button**, application will crash if there are any errors hence the report will be generated and if there are no memory errors it will give the message no error found, as illustrated in the following figure.

![Lsan UI Report](media/lsan_failure_report.png)

## Source File Navigation on Failure
- When a failure occurs, you can click on the **line number associated with the failure which is generated in UI Report**. This action will open the corresponding source file in your editor and **navigate to the exact location where the failure has occurred**, as illustrated in the following figure.

![Failure occured](media/failure_line_lsan.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/application/vscode-ext/tools/media/gTest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Get Unit Test information with Code Coverage
Unit Test and Code coverage is a tool that helps you to understand the code quality of your application. It provides you with information about how much of your code is covered by unit tests by providing interface for viewing and analyzing native unit test results. It displays the test results in a tree view, showing the number of runs, defects, and failures you can see the details of each test suite and test case .
<br>

This helps with the testing experience by allowing you to conveniently review and understand the outcomes of your native unit tests within the VS Code extension.

## Using the Unit Test and Code Coverage
To use the Unit Test and Code Coverage tool:
- Create a GTest application.
- In the **File Explorer view**, click on **view** and select **Command Palette > Tizen: Create Tizen Project > Native > Tizen > Tizen-9.0 > GTest**, Then specify the desired project name for your GTest application. This will initiate the creation process and set up the necessary environment for running native unit tests within VS Code extension

![Create Gtest Application](media/gTest.png)
<br>

- In the **File Explorer view**, click on **view** and select **Command Palette > Tizen Native: Run Unit Test and Coverage**.

![Launch Command](media/launch_utc.png)
<br>

- All the **unit tests present in the Unit Test project** are executed and **coverage is determined based on the code covered by the unit tests**.
- It also includes a **progress bar** that visually represents the **number of failures occurring** during the execution of native unit tests.

![Native Unit Test Result](media/native_unit_test_result.png)
<br>

- After the Unit Test project completes its execution, **VS code Extension displays the code coverage information in the browser in form of HTML**. The Unit Test Result and Code Coverage views provide a summary of the unit test results and code coverage percentage for each file.

![Coverage Report](media/coverage_report.png)
<br>

## Source File Navigation on Failure
- When a failure occurs, you can click on the **Failure Test Suite associated with the failure which is generated in Tree view**.
- This action will open the corresponding source file in your editor and **navigate to the exact location where the failure has occurred**, as illustrated in the following figure.

![Test Suite Failure Ocuured](media/test_suite_failure_line.png)

0 comments on commit 566fcc8

Please sign in to comment.