[infra] delete directories with FI reports with rmtree (#9265)

Those directories aren't empty usually so `rmdir` fails with
```
INFO:fuzz_introspector.json_report:Finish handling sections that need json output
INFO:__main__:Ending fuzz introspector report generation
INFO:__main__:Ending fuzz introspector post-processing
Traceback (most recent call last):
  File "/home/vagrant/oss-fuzz-2/./infra/helper.py", line 1513, in <module>
    sys.exit(main())
  File "/home/vagrant/oss-fuzz-2/./infra/helper.py", line 192, in main
    result = introspector(args)
  File "/home/vagrant/oss-fuzz-2/./infra/helper.py", line 1243, in introspector
    os.rmdir(introspector_dst)
OSError: [Errno 39] Directory not empty: '/home/vagrant/oss-fuzz-2/build/out/dbus-broker/introspector-report'
```

It should make it possible to run `introspector` a few times in a row
when for example fuzz targets are changed locally between subsequent
runs.

It's a follow-up to https://github.com/google/oss-fuzz/pull/9243.
This commit is contained in:
Evgeny Vereshchagin 2022-12-22 20:57:13 +03:00 committed by GitHub
parent dfbb43a779
commit 63e3493664
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -1239,8 +1239,7 @@ def introspector(args):
return False
introspector_dst = os.path.join(args.project.out, "introspector-report")
if os.path.isdir(introspector_dst):
os.rmdir(introspector_dst)
shutil.rmtree(introspector_dst, ignore_errors=True)
shutil.copytree(os.path.join(args.project.out, "inspector"), introspector_dst)
# Copy the coverage reports into the introspector report.