Ninja
Classes | Functions
build_test.cc File Reference
#include "build.h"
#include "build_log.h"
#include "deps_log.h"
#include "graph.h"
#include "test.h"
Include dependency graph for build_test.cc:

Go to the source code of this file.

Classes

struct  BuildDryRun
 
struct  BuildTest
 
struct  BuildWithDepsLogTest
 Tests of builds involving deps logs necessarily must span multiple builds. More...
 
struct  BuildWithLogTest
 
struct  FakeCommandRunner
 Fake implementation of CommandRunner, useful for tests. More...
 
struct  PlanTest
 Fixture for tests involving Plan. More...
 

Functions

 TEST_F (PlanTest, Basic)
 
 TEST_F (PlanTest, DoubleOutputDirect)
 
 TEST_F (PlanTest, DoubleOutputIndirect)
 
 TEST_F (PlanTest, DoubleDependent)
 
 TEST_F (PlanTest, DependencyCycle)
 
 TEST_F (PlanTest, PoolWithDepthOne)
 
 TEST_F (PlanTest, PoolsWithDepthTwo)
 
 TEST_F (PlanTest, PoolWithRedundantEdges)
 
 TEST_F (BuildTest, NoWork)
 
 TEST_F (BuildTest, OneStep)
 
 TEST_F (BuildTest, OneStep2)
 
 TEST_F (BuildTest, TwoStep)
 
 TEST_F (BuildTest, TwoOutputs)
 
 TEST_F (BuildTest, MultiOutIn)
 
 TEST_F (BuildTest, Chain)
 
 TEST_F (BuildTest, MissingInput)
 
 TEST_F (BuildTest, MissingTarget)
 
 TEST_F (BuildTest, MakeDirs)
 
 TEST_F (BuildTest, DepFileMissing)
 
 TEST_F (BuildTest, DepFileOK)
 
 TEST_F (BuildTest, DepFileParseError)
 
 TEST_F (BuildTest, OrderOnlyDeps)
 
 TEST_F (BuildTest, RebuildOrderOnlyDeps)
 
 TEST_F (BuildTest, Phony)
 
 TEST_F (BuildTest, PhonyNoWork)
 
 TEST_F (BuildTest, Fail)
 
 TEST_F (BuildTest, SwallowFailures)
 
 TEST_F (BuildTest, SwallowFailuresLimit)
 
 TEST_F (BuildWithLogTest, NotInLogButOnDisk)
 
 TEST_F (BuildWithLogTest, RestatTest)
 
 TEST_F (BuildWithLogTest, RestatMissingFile)
 
 TEST_F (BuildWithLogTest, RestatMissingInput)
 
 TEST_F (BuildDryRun, AllCommandsShown)
 
 TEST_F (BuildTest, RspFileSuccess)
 
 TEST_F (BuildTest, RspFileFailure)
 
 TEST_F (BuildWithLogTest, RspFileCmdLineChange)
 
 TEST_F (BuildTest, InterruptCleanup)
 
 TEST_F (BuildTest, PhonyWithNoInputs)
 
 TEST_F (BuildTest, DepsGccWithEmptyDepfileErrorsOut)
 
 TEST_F (BuildTest, StatusFormatReplacePlaceholder)
 
 TEST_F (BuildTest, FailedDepsParse)
 
 TEST_F (BuildWithDepsLogTest, Straightforward)
 Run a straightforwad build where the deps log is used. More...
 
 TEST_F (BuildWithDepsLogTest, ObsoleteDeps)
 Verify that obsolete dependency info causes a rebuild. More...
 
 TEST_F (BuildWithDepsLogTest, DepsIgnoredInDryRun)
 
 TEST_F (BuildWithDepsLogTest, RestatDepfileDependency)
 Check that a restat rule generating a header cancels compilations correctly. More...
 

Function Documentation

TEST_F ( PlanTest  ,
Basic   
)

Definition at line 49 of file build_test.cc.

References AssertParse().

TEST_F ( PlanTest  ,
DoubleOutputDirect   
)

Definition at line 82 of file build_test.cc.

References AssertParse().

TEST_F ( PlanTest  ,
DoubleOutputIndirect   
)

Definition at line 109 of file build_test.cc.

References AssertParse().

TEST_F ( PlanTest  ,
DoubleDependent   
)

Definition at line 147 of file build_test.cc.

References AssertParse().

TEST_F ( PlanTest  ,
DependencyCycle   
)

Definition at line 184 of file build_test.cc.

References AssertParse().

TEST_F ( PlanTest  ,
PoolWithDepthOne   
)

Definition at line 200 of file build_test.cc.

References AssertParse().

TEST_F ( PlanTest  ,
PoolsWithDepthTwo   
)

Definition at line 242 of file build_test.cc.

References AssertParse(), Edge::inputs_, and Edge::outputs_.

TEST_F ( PlanTest  ,
PoolWithRedundantEdges   
)

Definition at line 320 of file build_test.cc.

References AssertParse().

TEST_F ( BuildTest  ,
NoWork   
)

Definition at line 527 of file build_test.cc.

TEST_F ( BuildTest  ,
OneStep   
)

Definition at line 532 of file build_test.cc.

TEST_F ( BuildTest  ,
OneStep2   
)

Definition at line 546 of file build_test.cc.

TEST_F ( BuildTest  ,
TwoStep   
)

Definition at line 560 of file build_test.cc.

TEST_F ( BuildTest  ,
TwoOutputs   
)

Definition at line 591 of file build_test.cc.

References AssertParse().

TEST_F ( BuildTest  ,
MultiOutIn   
)

Definition at line 610 of file build_test.cc.

References AssertParse().

TEST_F ( BuildTest  ,
Chain   
)

Definition at line 628 of file build_test.cc.

References AssertParse().

TEST_F ( BuildTest  ,
MissingInput   
)

Definition at line 664 of file build_test.cc.

TEST_F ( BuildTest  ,
MissingTarget   
)

Definition at line 673 of file build_test.cc.

TEST_F ( BuildTest  ,
MakeDirs   
)

Definition at line 680 of file build_test.cc.

References AssertParse().

TEST_F ( BuildTest  ,
DepFileMissing   
)

Definition at line 705 of file build_test.cc.

References AssertParse().

TEST_F ( BuildTest  ,
DepFileOK   
)

Definition at line 718 of file build_test.cc.

References AssertParse(), Edge::EvaluateCommand(), and Edge::inputs_.

TEST_F ( BuildTest  ,
DepFileParseError   
)

Definition at line 744 of file build_test.cc.

References AssertParse().

TEST_F ( BuildTest  ,
OrderOnlyDeps   
)
TEST_F ( BuildTest  ,
RebuildOrderOnlyDeps   
)

Definition at line 826 of file build_test.cc.

References AssertParse().

TEST_F ( BuildTest  ,
Phony   
)

Definition at line 873 of file build_test.cc.

References AssertParse().

TEST_F ( BuildTest  ,
PhonyNoWork   
)

Definition at line 890 of file build_test.cc.

References AssertParse().

TEST_F ( BuildTest  ,
Fail   
)

Definition at line 903 of file build_test.cc.

References AssertParse().

TEST_F ( BuildTest  ,
SwallowFailures   
)

Definition at line 918 of file build_test.cc.

References AssertParse().

TEST_F ( BuildTest  ,
SwallowFailuresLimit   
)

Definition at line 939 of file build_test.cc.

References AssertParse().

TEST_F ( BuildWithLogTest  ,
NotInLogButOnDisk   
)

Definition at line 968 of file build_test.cc.

References AssertParse().

TEST_F ( BuildWithLogTest  ,
RestatTest   
)

Definition at line 993 of file build_test.cc.

References AssertParse().

TEST_F ( BuildWithLogTest  ,
RestatMissingFile   
)

Definition at line 1056 of file build_test.cc.

References AssertParse().

TEST_F ( BuildWithLogTest  ,
RestatMissingInput   
)

Definition at line 1099 of file build_test.cc.

References AssertParse().

TEST_F ( BuildDryRun  ,
AllCommandsShown   
)

Definition at line 1157 of file build_test.cc.

References AssertParse().

TEST_F ( BuildTest  ,
RspFileSuccess   
)

Definition at line 1188 of file build_test.cc.

References AssertParse().

TEST_F ( BuildTest  ,
RspFileFailure   
)

Definition at line 1230 of file build_test.cc.

References AssertParse().

TEST_F ( BuildWithLogTest  ,
RspFileCmdLineChange   
)

Definition at line 1269 of file build_test.cc.

References AssertHash(), and AssertParse().

TEST_F ( BuildTest  ,
InterruptCleanup   
)

Definition at line 1315 of file build_test.cc.

References AssertParse().

TEST_F ( BuildTest  ,
PhonyWithNoInputs   
)

Definition at line 1349 of file build_test.cc.

References AssertParse().

TEST_F ( BuildTest  ,
DepsGccWithEmptyDepfileErrorsOut   
)

Definition at line 1375 of file build_test.cc.

References AssertParse().

TEST_F ( BuildTest  ,
StatusFormatReplacePlaceholder   
)

Definition at line 1393 of file build_test.cc.

TEST_F ( BuildTest  ,
FailedDepsParse   
)

Definition at line 1398 of file build_test.cc.

References AssertParse().

TEST_F ( BuildWithDepsLogTest  ,
Straightforward   
)

Run a straightforwad build where the deps log is used.

Definition at line 1440 of file build_test.cc.

References Builder::AddTarget(), AssertParse(), Builder::Build(), DepsLog::Close(), Builder::command_runner_, DepsLog::Load(), and DepsLog::OpenForWrite().

TEST_F ( BuildWithDepsLogTest  ,
ObsoleteDeps   
)

Verify that obsolete dependency info causes a rebuild.

1) Run a successful build where everything has time t, record deps. 2) Move input/output to time t+1 – despite files in alignment, should still need to rebuild due to deps at older time.

Definition at line 1507 of file build_test.cc.

References Builder::AddTarget(), AssertParse(), Builder::Build(), DepsLog::Close(), Builder::command_runner_, DepsLog::Load(), and DepsLog::OpenForWrite().

TEST_F ( BuildWithDepsLogTest  ,
DepsIgnoredInDryRun   
)
TEST_F ( BuildWithDepsLogTest  ,
RestatDepfileDependency   
)

Check that a restat rule generating a header cancels compilations correctly.

Definition at line 1607 of file build_test.cc.

References Builder::AddTarget(), AssertParse(), Builder::Build(), DepsLog::Close(), Builder::command_runner_, DepsLog::Load(), and DepsLog::OpenForWrite().