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

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
This commit is contained in:
wangmingrong1 2025-01-22 18:47:39 +08:00 committed by Xiang Xiao
parent aefafc45e9
commit cd9f2d7099
2 changed files with 17 additions and 18 deletions

View File

@ -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
@ -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
```

View File

@ -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",
)
@ -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",
)
@ -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:
@ -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()