Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docu/gcov: Modify the description and fix the script error #15650

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Documentation/applications/system/gcov/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ Examples of applicable platforms
find ./ -name "*.gcda"
```

5. Examples:
```
$ ./tools/configure.sh sim:nsh
nsh: poweroff
$ ./nuttx/tools/gcov.py -t gcov
Then open ./gcov/result/index.html with your browser
```

2. Applicable to device

2. Applicable to device

Due to differences in implementation methods, the device side is divided into GCC and CLANG
Expand Down Expand Up @@ -129,10 +139,10 @@ Examples of applicable platforms
# The -t parameter specifies the gcov version, which needs to match the gcc version

# sim
./tools/gcov.sh -t gcov-13
./tools/gcov.py -t gcov

# arm platform
./tools/gcov.sh -t arm-none-eabi-gcov
./tools/gcov.py -t arm-none-eabi-gcov

5. Impact and precautions
```
Expand Down
21 changes: 5 additions & 16 deletions tools/gcov.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,17 @@ def arg_parser():
)
parser.add_argument("-i", "--input", help="Input dump data")
parser.add_argument("-t", dest="gcov_tool", help="Path to gcov tool")
parser.add_argument(
"-b", dest="base_dir", default=os.getcwd(), help="Compile base directory"
)
parser.add_argument("-b", dest="base_dir", help="Compile base directory")
parser.add_argument(
"-s",
dest="gcno_dir",
default=os.getcwd(),
default=".",
help="Directory containing gcno files",
)
parser.add_argument(
"-a",
dest="gcda_dir",
default=os.getcwd(),
default=".",
nargs="+",
help="Directory containing gcda files",
)
Expand All @@ -136,8 +134,7 @@ def arg_parser():
parser.add_argument(
"-o",
dest="gcov_dir",
nargs="?",
default=os.getcwd(),
default="gcov",
help="Directory to store gcov data and report",
)

Expand All @@ -151,10 +148,7 @@ def main():
gcov_dir = os.path.abspath(args.gcov_dir)
gcno_dir = os.path.abspath(args.gcno_dir)

if os.path.exists(gcov_dir):
shutil.rmtree(gcov_dir)

os.makedirs(gcov_dir)
os.makedirs(gcov_dir, exist_ok=True)

gcda_dir = []
for i in args.gcda_dir:
Expand Down Expand Up @@ -249,11 +243,6 @@ def main():
print("Failed to generate coverage file.")
sys.exit(1)

for i in gcov_data_dir:
shutil.rmtree(i)

os.remove(coverage_file)


if __name__ == "__main__":
main()
Loading