Skip to content

Commit

Permalink
[infra] delete directories with FI reports with rmtree (google#9265)
Browse files Browse the repository at this point in the history
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 google#9243.
  • Loading branch information
evverx authored and eamonnmcmanus committed Mar 15, 2023
1 parent 8b58a01 commit 7e69e4f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions infra/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7e69e4f

Please sign in to comment.