mirror of
https://github.com/rclone/rclone
synced 2024-09-03 21:31:30 +02:00
test_all: make -clean not give up on the first error
This commit is contained in:
parent
f5c853b5c8
commit
578d00666c
@ -11,12 +11,13 @@ import (
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/ncw/rclone/fs/list"
|
||||
"github.com/ncw/rclone/fs/operations"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// MatchTestRemote matches the remote names used for testing (copied
|
||||
// from fstest/fstest.go so we don't have to import that and get all
|
||||
// its flags)
|
||||
var MatchTestRemote = regexp.MustCompile(`^rclone-test-[abcdefghijklmnopqrstuvwxyz0123456789]{24}$`)
|
||||
var MatchTestRemote = regexp.MustCompile(`^rclone-test-[abcdefghijklmnopqrstuvwxyz0123456789]{24}(_segments)?$`)
|
||||
|
||||
// cleanFs runs a single clean fs for left over directories
|
||||
func cleanFs(remote string) error {
|
||||
@ -28,7 +29,8 @@ func cleanFs(remote string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return entries.ForDirError(func(dir fs.Directory) error {
|
||||
var lastErr error
|
||||
err = entries.ForDirError(func(dir fs.Directory) error {
|
||||
dirPath := dir.Remote()
|
||||
fullPath := remote + dirPath
|
||||
if MatchTestRemote.MatchString(dirPath) {
|
||||
@ -39,12 +41,25 @@ func cleanFs(remote string) error {
|
||||
log.Printf("Purging %s", fullPath)
|
||||
dir, err := fs.NewFs(fullPath)
|
||||
if err != nil {
|
||||
return err
|
||||
err = errors.Wrap(err, "NewFs failed")
|
||||
lastErr = err
|
||||
fs.Errorf(fullPath, "%v", err)
|
||||
return nil
|
||||
}
|
||||
err = operations.Purge(dir, "")
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "Purge failed")
|
||||
lastErr = err
|
||||
fs.Errorf(dir, "%v", err)
|
||||
return nil
|
||||
}
|
||||
return operations.Purge(dir, "")
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return lastErr
|
||||
}
|
||||
|
||||
// cleanRemotes cleans the list of remotes passed in
|
||||
|
Loading…
Reference in New Issue
Block a user