Example #1
0
func addProfileAndTargets(t *testing.T, name string) {
	t1, _ := profiles.NewTargetWithEnv("t1=cpu1-os1", "A=B,C=D")
	t2, _ := profiles.NewTargetWithEnv("t2=cpu2-os2@bar", "A=B,C=D")
	if err := profiles.AddProfileTarget(name, t1); err != nil {
		t.Fatal(err)
	}
	t2.InstallationDir = "bar"
	if err := profiles.AddProfileTarget(name, t2); err != nil {
		t.Fatal(err)
	}
}
Example #2
0
func TestCopyCommandLineEnv(t *testing.T) {
	env := "A=B,C=D"
	target, _ := profiles.NewTargetWithEnv("a=a-o", env)
	clenv := target.CommandLineEnv()
	if got, want := strings.Join(clenv.Vars, ","), env; got != want {
		t.Errorf("got %v, want %v", got, want)
	}
	// Make sure we can't mutate the command line env stored in target.
	clenv.Vars[0] = "oops"
	clenv2 := target.CommandLineEnv()
	if got, want := strings.Join(clenv2.Vars, ","), env; got != want {
		t.Errorf("got %v, want %v", got, want)
	}
}