コード例 #1
0
func InitTests(startIndexer bool) {
	if !hasStartedTesting {
		flag.Parse()
		hasStartedTesting = true
		gou.SetLogger(log.New(os.Stderr, "", log.Ltime|log.Lshortfile), *logLevel)
		log.SetFlags(log.Ltime | log.Lshortfile)
		api.Domain = *eshost
	}
}
コード例 #2
0
ファイル: alltest.go プロジェクト: lytics/alltest
func main() {
	baseDir, err := os.Getwd()
	quitIfErr(err)

	skipDirFlag := flag.String("skip", "trash", "Comma-separated list of directories to skip")
	buildOnlyFlag := flag.Bool("buildOnly", false, "Do \"go build\" instead of \"go test\"")
	shortFlag := flag.Bool("short", false, `Run "go test" with "short" flag`)
	colorFlag := flag.Bool("c", true, "Use colorized log output, colored by severity")
	verboseFlag := flag.Bool("v", false, `Run "go test" with -v, also be more verbose elsewhere`)
	veryVerbose := flag.Bool("vv", false, `Very Verbose, comine stdout AND stderr to display`)
	raceFlag := flag.Bool("race", false, `Run "go test" with "race" flag`)
	flag.Parse()

	gou.SetLogger(log.New(os.Stderr, "", 0), "debug")
	if *colorFlag {
		gou.SetColorIfTerminal()
	}

	skipDirNames := strings.Split(*skipDirFlag, ",")
	skipDirStats := make([]os.FileInfo, 0)
	for _, skipDirName := range skipDirNames {
		if skipDirName == "" {
			continue
		}
		stat, err := os.Stat(skipDirName)
		if skipDirName == "trash" && err != nil {
			continue
		}
		if err != nil {
			gou.Errorf("Couldn't stat directory to skip %s: %s\n", skipDirName, err)
		}
		skipDirStats = append(skipDirStats, stat)
	}

	conf := NewConf(skipDirStats, *buildOnlyFlag, *shortFlag, *raceFlag, *verboseFlag, *veryVerbose)
	failedDirs := RunTestsRecursively(baseDir, baseDir, conf)

	if len(failedDirs) > 0 {
		gou.Error("\nFailed directories:")
		for _, dir := range failedDirs {
			gou.Errorf("  %s", dir)
		}
		os.Exit(1)
	} else {
		gou.Info("\nall tests/builds succeeded")
	}
}
コード例 #3
0
ファイル: harness.go プロジェクト: allisonmorgan/qlbridge
// SetupLogging enables -vv verbose logging or sends logs to /dev/null
// env var VERBOSELOGS=true was added to support verbose logging with alltests
func Setup() {
	setupOnce.Do(func() {

		if flag.CommandLine.Lookup("vv") == nil {
			verbose = flag.Bool("vv", false, "Verbose Logging?")
		}

		flag.Parse()
		if *verbose || os.Getenv("VERBOSELOGS") != "" {
			u.SetupLogging("debug")
			u.SetColorOutput()
		} else {
			// make sure logging is always non-nil
			dn, _ := os.Open(os.DevNull)
			u.SetLogger(log.New(dn, "", 0), "error")
		}

		builtins.LoadAllBuiltins()

	})
}
コード例 #4
0
ファイル: main.go プロジェクト: araddon/depr
func main() {
	gou.SetLogger(log.New(os.Stderr, "", log.Ltime|log.Lshortfile), "debug")
	gou.Debug("hello")
}