c4-project / c4t

Runs concurrent C compiler tests
MIT License
1 stars 0 forks source link

Convert ReadSubjectFile to a FS #131

Open MattWindsor91 opened 3 years ago

MattWindsor91 commented 3 years ago

ReadSubjectFile is a function that does not spark joy. It is intended to behave like a call to os.Open, except that, in certain cases, it can traverse inside a tarball and pretend that tarball is transparently part of the filesystem. Its main reason for existence is to deal with the fact that plans can refer to files that only exist inside tarred snapshots of failed tests.

This feels like a useful example of where go1.16's FS could be useful: we can write a FS that behaves like a real filesystem most of the time but, if asked to go into a directory that is actually a tarball, delegates to something like tarfs instead.

In fact, we could probably replace current read-only uses of tarballs with such an FS.