Skip to content

Commit

Permalink
Docu/gcov: Modify the description and fix the script error
Browse files Browse the repository at this point in the history
Signed-off-by: wangmingrong1 <[email protected]>
  • Loading branch information
W-M-R authored and xiaoxiang781216 committed Jan 22, 2025
1 parent aefafc4 commit cd9f2d7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
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()

0 comments on commit cd9f2d7

Please sign in to comment.