Commit Graph

19 Commits

Author SHA1 Message Date
Michail Kargakis 816954d9ff
Remove go1.13 from travis build matrix 2020-12-07 20:53:32 +01:00
Mike Futerko cdee88cb2d Add go1.15 to the build matrix 2020-12-07 19:36:56 +02:00
sreekanth370 5dc7152bc6
test 2020-10-20 14:58:32 +05:30
L. Alberto Giménez a4ea980f2d
Add tarfs implementation (reopen #265) (#266)
* Initial commit for tarfs

* tarfs: reword "open" status field

* tarfs: use TestMain for FS setup

We want to have the FS variable available through all the tests, so we
we use a common "setup" function to initialise it.

* tarfs: test: early exit for nonexisting files

* tarfs: create test for filesystem Open

* tarfs: implement File.Stat

* tarfs: implement Fs.Open

* tarfs: return error on non-supported methods

As tarfs is a read-only filesystem backend, we return EROFS (Read-only
file system) from any method that makes modifications.

* tarfs: implement File.data as bytes.Reader

Most of the operations that we want to implement for tarfs.File are
already defined in bytes.Reader.

We could use a plain slice and implement all the seeking manually, but I
think using this is more convenient.

* tarfs: short format for simple methods

* tarfs: add missing closing brace in tests

* tarfs: add test for File.ReadAt

* tarfs: test File.ReadAt

* tarfs: add tests for File.Read

* tarfs: implement File.Read

* tarfs: add tests for File.Seek

* tarfs: implement File.Seek

* tarfs: add tests for File.Name

* tarfs: implement File.Name

* tarfs: add tests for File.Close

* tarfs: implement File.Close

* tarfs: add tests for OpenFile

* tarfs: fix test for Fs.OpenFile

If the call fails, we don't have to close the file

* tarfs: remove code not needed after using filepath.Clean

* tarfs: Open: return a copy of the internal structure

As we modify the struct fields when closing, we don't want to lose the
internal representation of the file, in case we want to reopen it.

Return a copy of the File, although we keep using the same pointers to
tar.Header and buffer.Reader. Maybe we will need to change that in the
future.

* tarfs: implement Fs.OpenFile

* tarfs: use Fatalf for unexpected error in TestFsOpen

* tarfs: add tests for Fs.Stat

* tarfs: implement Fs.Stat

* tarfs: remove TestNewFs

That test depends too much on the internal imlementation, and it is
easier to break if we change it.

* tarfs: remove unused code

* tarfs: change internal implementation

To be able to handle directories (File.Readdir, File.Readdirnames), the
naive single-map implementation makes it a bit harder to implement.

Inspired by the zipfs backend, switch to an internal implementation of a
map of directories that contains a map of files, so the directory
methods are easier to implement.

Also, treat the "virtual" filesystem as absolute, just like zipfs does.

* tarfs: use Fatal errors to avoid panics

* tarfs: add pseudoroot

* tarfs: add tests for File.Readdir

* tarfs: add pointer Fs in the File structure

For directory-related operations we will need to access the internal
structure in the Fs.

As Readdir and Readdirnames are File methods, we need to access such
structure from the File.

* tarfs: fix error

* tarfs: use just the names for TestReaddir, easier than using fill os.FileInfo entries

* tarfs: create a copy of the original entry when opening a file

We added the fs field in the File struct to reference the underlying Fs
object, but in the Open cal we were not passing it, making all the
opened files to have a nil pointer in that field.

Change to make a copy of the original file, and returning that

* tarfs: implement File.Readdir

* tarfs: add tests for File.Readdirnames

* tarfs: implement Readdirnames

* tarfs: add test for File.Name

* tarfs: change tests to use the Afero interface instead

* tarfs: add tests for Glob from zipfs

* tarfs: update main repo references to tarfs

* tarfs: use OS-specific file separator for pseudoroot

* tarfs: fix path handling in Windows systems
2020-09-14 20:44:56 +02:00
ialidzhikov 7aa0da4f47 Change CRLF line endings to LF
Signed-off-by: ialidzhikov <i.alidjikov@gmail.com>
2020-05-03 14:03:17 +03:00
Michail Kargakis d66a0674ca
Add gofmt and go vet checks in CI 2020-04-10 23:59:21 +02:00
Michail Kargakis 72d3215259
Build and test CI improvements 2020-03-28 14:01:49 +01:00
Martin Bertschler a880a37ed1 upgrade travis Go versions to current and previous (1.10 and 1.9), remove 1.8 2018-03-22 23:51:30 +01:00
Jamie Wilkinson bbf41cb36d Removes go 1.7 from the build matrix, adds 1.9
Travis builds are failing on go 1.7.5 because of github.com/pkg/sftp doesn't support that version anymore.
2018-02-12 03:27:14 +11:00
Martin Bertschler 473997e418 add test that shows a bug with FileMode not being set for MemMapFs directories, clean up tests 2017-10-03 23:17:35 +02:00
Corentin Debains d29940f63d mem/file.go - Fix some races in accessing fields of FileData
* Splitting SetModeTime to avoid double locking
* Adding locks all over the place.
2017-09-30 22:59:59 -07:00
Bjørn Erik Pedersen 9be650865e travis: Bump to Go 1.7.5 and 1.8 2017-02-17 17:41:46 +01:00
Bjørn Erik Pedersen b28a7effac Add Go 1.7 to Travis config 2016-08-16 10:07:57 +02:00
Bjørn Erik Pedersen cc9c21814b Bump Travis to Go 1.6.3 2016-07-18 23:47:48 +02:00
Bjørn Erik Pedersen 1a8ecf8b9d Test on both Linux and OSX 2016-06-06 00:02:38 +02:00
Bjørn Erik Pedersen 6b1e71387a Fix Travis config 2016-06-05 23:53:54 +02:00
Bjørn Erik Pedersen f0b36a98d3 Update Travis config 2016-05-08 20:08:58 +02:00
Martin Bertschler a19c2e3d70 make test output verbose on travis 2016-01-07 11:58:02 +01:00
spf13 11dade3cc0 Adding Travis-CI support 2014-11-01 00:25:15 -04:00