I disagree it's responsibility of the tool. Program should just reach out for files and some higher order or meta runner should trace what the process does. One of the commenters mentioned `strace`, this is the correct approach, but should be done in well engineered way.
Other way is to run program in symbomlic interpreter and trace what it wants to read in any of the branches.