Пример #1
0
		if len(remotes) == 2 {
			debugf("Fetch remote %s", remotes[0])
			t.FetchRemote(pkg, "prhead", remotes[0])
			debugf("Fetch remote %s", remotes[1])
			t.FetchRemote(pkg, "prbase", remotes[1])
		}
		debugf("Checkout %s", from)
		err = t.Checkout(pkg, from)
		if err != nil {
			log.Fatal(err)
		}

		t.Stdout = ioutil.Discard
		t.Stderr = ioutil.Discard
		debugf("Runin tests from %s", from)
		res := tester.Run(t, list, ioutil.Discard)

		if verbose {
			t.Stdout = os.Stdout
			t.Stderr = os.Stderr
		}
		skipped := res.TotalFailed()

		debugf("Checkout %s", to)
		err = t.Checkout(pkg, to)
		if err != nil {
			log.Fatal(err)
		}
		debugf("Runin tests from %s", to)
		res = tester.Run(t, res.OK, os.Stdout)
		log.Printf("%d packages skipped due to tests failing in %s", skipped, from)
Пример #2
0
		if err != nil {
			log.Fatal(err)
		}
		if verbose {
			t.Stdout = os.Stdout
			t.Stderr = os.Stderr
		}
		err = t.Get(pkg)
		if err != nil {
			log.Fatal(err)
		}
		err = t.Checkout(pkg, checkout)
		if err != nil {
			log.Fatal(err)
		}
		res := tester.Run(t, list, os.Stdout)
		if err := res.Err(); err != nil {
			log.Fatal(err)
		}
		fmt.Println(res.String())
	},
}

var checkout string

func init() {
	RootCmd.AddCommand(testCmd)
	testCmd.Flags().BoolVar(&insecure, "insecure", false, "Allows running testing packages from godoc")
	testCmd.Flags().StringVarP(&checkout, "checkout", "c", "master", "The commit/tag/branch of the tested package we want to checkout")
}