summaryrefslogtreecommitdiffstats
path: root/src/graph_test.cc
Commit message (Collapse)AuthorAgeFilesLines
* Parser accepts no explicit outputs.Nicolas Despres2016-05-251-0/+39
| | | | | | | | | | There is a class of commands that take an output directory where they create their output files. Among them are cp(1), tar(1) to name a few. These commands have one or more implicit outputs but no explicit output. With this patch, Ninja's parser accepts build edge with an empty list of explicit outputs.
* Add support for build statement implicit outputsBrad King2016-02-031-0/+44
| | | | | | | | | | | | | | | | | | Some build rules produce outputs that are not mentioned on the command line but that should be part of the build graph. Such outputs should not be named in the `$out` variable. Extend the build statement syntax to support specification of implicit outputs using the syntax `| out1 out2` after the explicit outputs and before the `:`. For example, compilation of a Fortran source file `foo.f90` that defines `MODULE FOO` may now be specified as: rule fc command = f95 -c $in -o $out build foo.o | foo.mod: fc foo.f90 The `foo.mod` file is an implicit output generated by the compiler based on the content of the source file and not mentioned on the command line.
* Make links point to org pageNico Weber2015-11-111-2/+2
|
* Let DependencyScan::RecomputeDirty() work correclty with cyclic graphs.Nico Weber2014-12-081-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RecomputDirty(edge) currently works roughly like this: RecomputeDirty(edge): LoadDeps(edge) for in in edge.inputs: if in.StatIfNecessary(): RecomputeDirty(in.in_edge) # recurse into inputs for out in edge.outputs: out.StatIfNecessary() # mark outputs as visited It uses the stat state of each node to mark nodes as visited and doesn't traverse across nodes that have been visited already. For cyclic graphs with an edge with multiple outputs on the cycle, nothing prevents an edge to be visited more than once if the cycle is entered through an output that isn't on the cycle. In other words, RecomputeDirty() for the same edge can be on the call stack more than once. This is bad for at least two reasons: 1. Deps are added multiple times, making the graph confusing to reason about. 2. LoadDeps() will insert into the inputs_ of an edge that's iterated over in a callframe higher up. This can invalidate the iterator, which causes a crash when the callframe with the loop over the now-invalidated iterator resumes. To fix this, let RecomputeDirty() mark all outputs of an edge as visited as the first thing it does. This way, even if the edge is on a cycle with several outputs, each output is already marked and no edge will have its deps loaded more than once. Fixes the crashes in #875. (In practice, it turns the crashes into "stuck [this is a bug]" messages for now, due to the example without duplicate rules in #867)
* path decanonicalization when building commandScott Graham2014-11-081-0/+21
|
* More robust escaping of $in, $out pathsNicholas Hutchinson2014-01-061-3/+8
| | | | | | In summary: don’t escape if the path doesn’t contain problematic characters, otherwise: - Shell: enclose string in single quotes, escape embedded single quotes with the magic quote-backslash-quote sequence - Win32: Escape double quotes by doubling the number of consecutive backslashes that precede them (if any) and adding one more. Finally, double the number of trailing backslashes, and enclose the whole thing in double quotes.
* Fix for missing "no work to do." message if all build edges are phony rules.Richard Geary2013-08-111-0/+20
| | | | Added NestedPhonyPrintsDone unit test
* plumb DepsLog load through BuilderEvan Martin2013-04-081-1/+1
|
* move test virtual time "now_" into VirtualFileSystemEvan Martin2013-04-081-24/+28
| | | | It's the only piece that cares about the current time.
* rearrange handling of builtin bindings to make rules simplerEvan Martin2012-12-291-0/+35
| | | | | Now, a 'build' block can override any special binding like 'command' or 'description' if it needs to.
* move BuildLog to DependencyScanEvan Martin2012-09-041-1/+1
| | | | | | | The build log is needed in computing whether an edge is dirty, so I think it belongs here. (It's a bit weird that Builder needs to reach into it to record completed commands, maybe it will become cleaner with more thought.)
* split out dirty recomputation logic from Edge classEvan Martin2012-09-021-8/+11
| | | | | | | | | | Rather than passing States and DiskInterfaces through all the calls, put the necessary ambient information in a new DependencyScan object and move the code accordingly. Note: I didn't move the source location of the functions to preserve history, though this does result in a sort of weird order for the functions in graph.cc.
* safer build: consider target dirty if depfile is missingMaxim Kalaev2012-08-301-0/+25
|
* Add a regression test for issue #380 (which fails at the moment)Nico Weber2012-07-281-0/+19
|
* Add a test for quoting spaces in expanded $in and $out.Jeremy Apthorp2012-01-041-0/+9
|
* make Node::in_edge_ privateEvan Martin2011-12-071-5/+5
|
* make Node::dirty_ privateEvan Martin2011-12-071-5/+5
|
* merge FileStat into NodeEvan Martin2011-12-071-1/+1
| | | | | | The two were always one-to-one anyway. I started adding accessors to FileStat and then realized most users wanted them on Node and that forwarding them through was silly.
* SEMANTIC CHANGE: implicit inputs are now required to existEvan Martin2011-05-131-2/+20
| | | | | | Edges found through depfiles are special: they get an extra empty "phony" rule. (This is identical to the way you hack this with Makefiles.)
* windows: successfully link testsEvan Martin2011-05-061-1/+1
| | | | | It links, with some hacks. Tests still fail.
* add test for RootNodes(); fix commentEvan Martin2011-05-011-0/+16
|
* fix SEGV in graph_testHiroyuki Iwatsuki2011-04-291-5/+5
|
* add doxygen-compatibile comments to most classesEvan Martin2011-04-291-0/+18
|
* Move CanonicalizePath into util.h so it can be shared by the other modules.Thiago Farina2011-04-151-33/+0
| | | | | | Also add util_test.cc and move the CanonicalizePathTest into there. Signed-off-by: Thiago Farina <tfarina@chromium.org>
* files that have both implicit and explicit edges should be implicitEvan Martin2011-03-071-0/+24
| | | | | | | This is just deleting some code that was written in anticipation of staying memory-resident; when loading a depfile, we don't need to attempt to update existing entries in the dependency list, we just need to blindly add them.
* canonicalize paths loaded from depfilesEvan Martin2011-03-071-0/+90
If a C file #includes "../foo.cc", then gcc will emit paths like "bar/../foo.cc" into the dependency file; canonicalize these when we load the file. Add a test module for testing the graph dirty recomputation directly, without all the build classes around it.