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
1 changed files with 15 additions and 7 deletions

View File

@ -242,14 +242,11 @@ func (r *Report) EmailHTML() {
_ = in.Close()
}
// Upload uploads a copy of the report online
func (r *Report) Upload() {
if *uploadPath == "" || r.IndexHTML == "" {
return
}
dst := path.Join(*uploadPath, r.DateTime)
// uploadTo uploads a copy of the report online to the dir given
func (r *Report) uploadTo(uploadDir string) {
dst := path.Join(*uploadPath, uploadDir)
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.Stdout = os.Stdout
cmd.Stderr = os.Stderr
@ -258,3 +255,14 @@ func (r *Report) Upload() {
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")
}