func main() { var ( conf Config ) confDir, _ := cc.GetConfigDir("qbox.me") var confName *string = flag.String("f", confDir+"/qboxtest.conf", "the config file") flag.Parse() log.Info("Use the config file of " + *confName) if err := config.LoadEx(&conf, *confName); err != nil { log.Error(err) return } runtime.GOMAXPROCS(conf.MaxProcs) cases := make(map[string]Interface) conf.Include = filepath1.Join(confDir, conf.Include) conf.DataPath = filepath1.Join(confDir, conf.DataPath) conf.Env = filepath1.Join(confDir, conf.Env) filepath.Walk(conf.Include, &Visitor{&conf, cases}, nil) check := func() bool { msg := fmt.Sprintf("begin check ...\n") errCount := 0 count := 0 for k, v := range cases { count++ log.Info("begin check", k, "...") msg += fmt.Sprintf("[%v/%v]process %v <<<\n", count, len(cases), k) info, err := v.Test() log.Info("check done :\n", info, k, err) msg += info msg += "\n" if err != nil { msg += fmt.Sprintf("!!!!!!!!!!mon case [%v] err!!![%v]\n", k, errors.Detail(err)) errCount++ } else { msg += fmt.Sprintf("[no err]%v done <<<\n", k) } } msg += fmt.Sprintf("all cases finish[%v/%v] <<<\n", len(cases)-errCount, len(cases)) fmt.Println("----------------- result ------------------") fmt.Println(msg) fmt.Println("-------------------------------------------") return errCount == 0 } b := check() if b { os.Exit(0) } else { os.Exit(1) } }
func (t *Task) Synced() (cl changelog.Logger, urls []string, err error) { dir, err := cc.GetConfigDir("fetch/") if err != nil { log.Warn(err, "GetConfigDir failed") return } pos := strings.LastIndex(t.SyncSrc, "/") if pos == -1 { pos = 0 } eigen := t.SyncSrc[pos:] + t.Bucket + t.Style cl, urls, err = OpenChangeLog(dir, eigen) return }