Пример #1
0
func (m *Mixer) loadDependentMixer(buildPath string, name string) {

	// TODO(SJ) : Do I want to check access for these mixers?
	// -- or do I just want a generic 'build' feature access?
	var newMixer *Mixer

	if strings.HasSuffix(name, ".mxr") {
		mxr, err := mixer.GetMixerFromFile(name)
		if err != nil {
			panic("Couldn't resolve mixer: " + name)
		}

		newMixer = &Mixer{
			Mixer: mxr,
		}
	} else {
		newMixer = BuildMixer(buildPath, name, m.DataPath)
	}

	m.Merge(newMixer)
}
Пример #2
0
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()
	}
}