예제 #1
0
func CheckXmlMemoryLeaks(t *testing.T) {
	help.LibxmlCleanUpParser()
	if !help.LibxmlCheckMemoryLeak() {
		t.Errorf("Memory leaks: %d!!!", help.LibxmlGetMemoryAllocation())
		help.LibxmlReportMemoryLeak()
	}
}
예제 #2
0
func CheckXmlMemoryLeaks(t *testing.T) {
	println("Cleaning up parser...")
	help.LibxmlCleanUpParser()
	println("Done cleaning parser, checking for libxml leaks...")
	if !help.LibxmlCheckMemoryLeak() {
		println("Found memory leaks!")
		t.Errorf("Memory leaks: %d!!!", help.LibxmlGetMemoryAllocation())
		help.LibxmlReportMemoryLeak()
	}
}
예제 #3
0
파일: runner.go 프로젝트: nmakiya/tritium
func All(command string, directory string, options ...string) {

	var mixerPath string
	if len(options) == 1 {
		//TODO: Instead of the mixer path, we should pass in just the name
		//and the version.
		mixerPath = filepath.Base(options[0])
	}

	logger := golog.NewLogger("tritium")
	debugger := &dummy.DummyDebugger{}

	logger.AddProcessor("info", golog.NewConsoleProcessor(golog.LOG_INFO, true))
	var eng tritium.Engine
	if command == "test" {
		eng = whale.NewEngine(debugger)
	}

	var pkg *tp.Package

	if len(mixerPath) > 0 {
		// Used when testing in ambrosia
		mixer, err := mixers.GetMixerFromFile(mixerPath)
		if err != nil {
			panic("Error, could not load mixer: " + mixerPath)
		}

		pkg = mixer.Package
	} else {
		bigPackage := legacy.BuildDefaultPackage()
		pkg = bigPackage.Package
	}

	globalResult := NewResult()
	globalResult.all(directory, pkg, eng, logger)

	// TODO : Walk over the results here and print errors.

	var foundError = false

	for _, err := range globalResult.Errors {
		foundError = true
		println("\n=========================================", err.Location, "\n")
		if err.Panic {
			fmt.Printf(err.Message)
		} else {
			fmt.Printf("\n==========\n%v :: %v \n\n Got \n----------\n%v\n\n Expected \n----------\n%v\n", err.Name, err.Message, err.Got, err.Expected)
		}
	}
	println("\n\n")
	println("+++TEST COMPLETE+++\n\n")

	if foundError {
		os.Exit(1)
	}
	eng.Free()
	xmlhelp.LibxmlCleanUpParser()
	if xmlhelp.LibxmlGetMemoryAllocation() != 0 {
		fmt.Printf("Memeory leaks %d!!!", xmlhelp.LibxmlGetMemoryAllocation())
		xmlhelp.LibxmlReportMemoryLeak()
	}
}