fstest/test_all: upload a copy of the report to "current"

This commit is contained in:
Nick Craig-Wood 2018-10-24 12:21:07 +01:00
parent 52c7c738ca
commit 07addf74fd

View File

@ -242,14 +242,11 @@ func (r *Report) EmailHTML() {
_ = in.Close() _ = in.Close()
} }
// Upload uploads a copy of the report online // uploadTo uploads a copy of the report online to the dir given
func (r *Report) Upload() { func (r *Report) uploadTo(uploadDir string) {
if *uploadPath == "" || r.IndexHTML == "" { dst := path.Join(*uploadPath, uploadDir)
return
}
dst := path.Join(*uploadPath, r.DateTime)
log.Printf("Uploading results to %q", dst) log.Printf("Uploading results to %q", dst)
cmdLine := []string{"rclone", "copy", "-v", r.LogDir, dst} cmdLine := []string{"rclone", "sync", "--stats-log-level", "NOTICE", r.LogDir, dst}
cmd := exec.Command(cmdLine[0], cmdLine[1:]...) cmd := exec.Command(cmdLine[0], cmdLine[1:]...)
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr cmd.Stderr = os.Stderr
@ -258,3 +255,14 @@ func (r *Report) Upload() {
log.Fatalf("Failed to upload results: %v", err) log.Fatalf("Failed to upload results: %v", err)
} }
} }
// Upload uploads a copy of the report online
func (r *Report) Upload() {
if *uploadPath == "" || r.IndexHTML == "" {
return
}
// Upload into dated directory
r.uploadTo(r.DateTime)
// And again into current
r.uploadTo("current")
}