Beispiel #1
0
func mknodelist(graph *dag.DAG, names ...string) []dag.Node {
	result := make([]dag.Node, len(names))
	for i, name := range names {
		result[i] = dag.MakeStubNode(graph, name)
	}
	return result
}
Beispiel #2
0
func Test_BuildState_BuildTargets_add_source(t *testing.T) {
	// do a full build (all targets missing), then add one source file
	// and ensure that downstream targets are rebuilt
	sig := []byte{0}
	db, goal, opts := fullBuild(t, sig)

	// feep.h is the new file, a parent of tool1.o: we will rebuild
	// tool1.o and tool1 (after ensuring that tool1.o is changed by
	// the rebuild)
	graph, executed := setupBuild(true, sig)
	newnode := dag.MakeStubNode(graph, "feep.h")
	newnode.SetState(dag.SOURCE)
	child := graph.Lookup("tool1.o").(*dag.StubNode)
	graph.AddParent(child, newnode)
	child.SetSignature([]byte{1})

	expect := []buildexpect{
		{"tool1.o", dag.BUILT},
		{"tool1", dag.BUILT}}
	bstate := NewBuildState(graph, db, opts)
	err := bstate.BuildTargets(goal)
	assert.Nil(t, err)
	assertBuild(t, graph, expect, *executed)
}