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" 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 2. Applicable to device
Due to differences in implementation methods, the device side is divided into GCC and CLANG 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 # The -t parameter specifies the gcov version, which needs to match the gcc version
# sim # sim
./tools/gcov.sh -t gcov-13 ./tools/gcov.py -t gcov
# arm platform # arm platform
./tools/gcov.sh -t arm-none-eabi-gcov ./tools/gcov.py -t arm-none-eabi-gcov
5. Impact and precautions 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("-i", "--input", help="Input dump data")
parser.add_argument("-t", dest="gcov_tool", help="Path to gcov tool") parser.add_argument("-t", dest="gcov_tool", help="Path to gcov tool")
parser.add_argument( parser.add_argument("-b", dest="base_dir", help="Compile base directory")
"-b", dest="base_dir", default=os.getcwd(), help="Compile base directory"
)
parser.add_argument( parser.add_argument(
"-s", "-s",
dest="gcno_dir", dest="gcno_dir",
default=os.getcwd(), default=".",
help="Directory containing gcno files", help="Directory containing gcno files",
) )
parser.add_argument( parser.add_argument(
"-a", "-a",
dest="gcda_dir", dest="gcda_dir",
default=os.getcwd(), default=".",
nargs="+", nargs="+",
help="Directory containing gcda files", help="Directory containing gcda files",
) )
@ -136,8 +134,7 @@ def arg_parser():
parser.add_argument( parser.add_argument(
"-o", "-o",
dest="gcov_dir", dest="gcov_dir",
nargs="?", default="gcov",
default=os.getcwd(),
help="Directory to store gcov data and report", help="Directory to store gcov data and report",
) )
@ -151,10 +148,7 @@ def main():
gcov_dir = os.path.abspath(args.gcov_dir) gcov_dir = os.path.abspath(args.gcov_dir)
gcno_dir = os.path.abspath(args.gcno_dir) gcno_dir = os.path.abspath(args.gcno_dir)
if os.path.exists(gcov_dir): os.makedirs(gcov_dir, exist_ok=True)
shutil.rmtree(gcov_dir)
os.makedirs(gcov_dir)
gcda_dir = [] gcda_dir = []
for i in args.gcda_dir: for i in args.gcda_dir:
@ -249,11 +243,6 @@ def main():
print("Failed to generate coverage file.") print("Failed to generate coverage file.")
sys.exit(1) sys.exit(1)
for i in gcov_data_dir:
shutil.rmtree(i)
os.remove(coverage_file)
if __name__ == "__main__": if __name__ == "__main__":
main() main()