|
Ninja
|
#include "build.h"#include <assert.h>#include "build_log.h"#include "deps_log.h"#include "graph.h"#include "test.h"
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, PoolWithDepthOne) | |
| TEST_F (PlanTest, ConsolePool) | |
| TEST_F (PlanTest, PoolsWithDepthTwo) | |
| TEST_F (PlanTest, PoolWithRedundantEdges) | |
| TEST_F (PlanTest, PoolWithFailingEdge) | |
| TEST_F (BuildTest, NoWork) | |
| TEST_F (BuildTest, OneStep) | |
| TEST_F (BuildTest, OneStep2) | |
| TEST_F (BuildTest, TwoStep) | |
| TEST_F (BuildTest, TwoOutputs) | |
| TEST_F (BuildTest, ImplicitOutput) | |
| 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, EncounterReadyTwice) | |
| TEST_F (BuildTest, OrderOnlyDeps) | |
| TEST_F (BuildTest, RebuildOrderOnlyDeps) | |
| TEST_F (BuildTest, Phony) | |
| TEST_F (BuildTest, PhonyNoWork) | |
| TEST_F (BuildTest, PhonySelfReference) | |
| TEST_F (BuildTest, Fail) | |
| TEST_F (BuildTest, SwallowFailures) | |
| TEST_F (BuildTest, SwallowFailuresLimit) | |
| TEST_F (BuildTest, SwallowFailuresPool) | |
| TEST_F (BuildTest, PoolEdgesReadyButNotWanted) | |
| TEST_F (BuildWithLogTest, NotInLogButOnDisk) | |
| TEST_F (BuildWithLogTest, RebuildAfterFailure) | |
| TEST_F (BuildWithLogTest, RebuildWithNoInputs) | |
| TEST_F (BuildWithLogTest, RestatTest) | |
| TEST_F (BuildWithLogTest, RestatMissingFile) | |
| TEST_F (BuildWithLogTest, RestatSingleDependentOutputDirty) | |
| 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, StatFailureAbortsBuild) | |
| TEST_F (BuildTest, PhonyWithNoInputs) | |
| TEST_F (BuildTest, DepsGccWithEmptyDepfileErrorsOut) | |
| TEST_F (BuildTest, StatusFormatElapsed) | |
| 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 (BuildTest, RestatDepfileDependency) | |
| Check that a restat rule generating a header cancels compilations correctly. More... | |
| TEST_F (BuildWithDepsLogTest, RestatDepfileDependencyDepsLog) | |
| Check that a restat rule generating a header cancels compilations correctly, depslog case. More... | |
| TEST_F (BuildWithDepsLogTest, DepFileOKDepsLog) | |
| TEST_F (BuildTest, RestatMissingDepfile) | |
| Check that a restat rule doesn't clear an edge if the depfile is missing. More... | |
| TEST_F (BuildWithDepsLogTest, RestatMissingDepfileDepslog) | |
| Check that a restat rule doesn't clear an edge if the deps are missing. More... | |
| TEST_F (BuildTest, WrongOutputInDepfileCausesRebuild) | |
| TEST_F (BuildTest, Console) | |
| TEST_F | ( | PlanTest | , |
| Basic | |||
| ) |
Definition at line 53 of file build_test.cc.
References ASSERT_EQ, ASSERT_FALSE, ASSERT_NO_FATAL_FAILURE, ASSERT_TRUE, AssertParse(), EXPECT_TRUE, and Plan::kEdgeSucceeded.
| TEST_F | ( | PlanTest | , |
| DoubleOutputDirect | |||
| ) |
Definition at line 86 of file build_test.cc.
References ASSERT_EQ, ASSERT_FALSE, ASSERT_NO_FATAL_FAILURE, ASSERT_TRUE, AssertParse(), EXPECT_TRUE, and Plan::kEdgeSucceeded.
| TEST_F | ( | PlanTest | , |
| DoubleOutputIndirect | |||
| ) |
Definition at line 113 of file build_test.cc.
References ASSERT_EQ, ASSERT_FALSE, ASSERT_NO_FATAL_FAILURE, ASSERT_TRUE, AssertParse(), EXPECT_TRUE, and Plan::kEdgeSucceeded.
| TEST_F | ( | PlanTest | , |
| DoubleDependent | |||
| ) |
Definition at line 151 of file build_test.cc.
References ASSERT_EQ, ASSERT_FALSE, ASSERT_NO_FATAL_FAILURE, ASSERT_TRUE, AssertParse(), EXPECT_TRUE, and Plan::kEdgeSucceeded.
| TEST_F | ( | PlanTest | , |
| PoolWithDepthOne | |||
| ) |
Definition at line 223 of file build_test.cc.
| TEST_F | ( | PlanTest | , |
| ConsolePool | |||
| ) |
Definition at line 234 of file build_test.cc.
| TEST_F | ( | PlanTest | , |
| PoolsWithDepthTwo | |||
| ) |
Definition at line 243 of file build_test.cc.
References ASSERT_EQ, ASSERT_FALSE, ASSERT_NO_FATAL_FAILURE, ASSERT_TRUE, AssertParse(), EXPECT_TRUE, Edge::inputs_, Plan::kEdgeSucceeded, and Edge::outputs_.
| TEST_F | ( | PlanTest | , |
| PoolWithRedundantEdges | |||
| ) |
Definition at line 321 of file build_test.cc.
References ASSERT_EQ, ASSERT_FALSE, ASSERT_NO_FATAL_FAILURE, ASSERT_TRUE, AssertParse(), EXPECT_TRUE, and Plan::kEdgeSucceeded.
| TEST_F | ( | PlanTest | , |
| PoolWithFailingEdge | |||
| ) |
Definition at line 399 of file build_test.cc.
References ASSERT_EQ, ASSERT_FALSE, ASSERT_NO_FATAL_FAILURE, ASSERT_TRUE, AssertParse(), EXPECT_TRUE, and Plan::kEdgeFailed.
| TEST_F | ( | BuildTest | , |
| NoWork | |||
| ) |
Definition at line 630 of file build_test.cc.
References EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| OneStep | |||
| ) |
Definition at line 635 of file build_test.cc.
References ASSERT_EQ, EXPECT_EQ, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| OneStep2 | |||
| ) |
Definition at line 649 of file build_test.cc.
References ASSERT_EQ, EXPECT_EQ, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| TwoStep | |||
| ) |
Definition at line 663 of file build_test.cc.
References ASSERT_EQ, EXPECT_EQ, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| TwoOutputs | |||
| ) |
Definition at line 694 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_EQ, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| ImplicitOutput | |||
| ) |
Definition at line 711 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_EQ, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| MultiOutIn | |||
| ) |
Definition at line 729 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_EQ, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| Chain | |||
| ) |
Definition at line 747 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_EQ, EXPECT_FALSE, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| MissingInput | |||
| ) |
Definition at line 783 of file build_test.cc.
References EXPECT_EQ, and EXPECT_FALSE.
| TEST_F | ( | BuildTest | , |
| MissingTarget | |||
| ) |
Definition at line 792 of file build_test.cc.
References EXPECT_EQ, and EXPECT_FALSE.
| TEST_F | ( | BuildTest | , |
| MakeDirs | |||
| ) |
Definition at line 799 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_EQ, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| DepFileMissing | |||
| ) |
Definition at line 819 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_EQ, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| DepFileOK | |||
| ) |
Definition at line 832 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), Edge::EvaluateCommand(), EXPECT_EQ, EXPECT_TRUE, and Edge::inputs_.
| TEST_F | ( | BuildTest | , |
| DepFileParseError | |||
| ) |
Definition at line 858 of file build_test.cc.
References ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_EQ, and EXPECT_FALSE.
| TEST_F | ( | BuildTest | , |
| EncounterReadyTwice | |||
| ) |
Definition at line 869 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_EQ, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| OrderOnlyDeps | |||
| ) |
Definition at line 892 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), Edge::EvaluateCommand(), EXPECT_EQ, EXPECT_TRUE, Edge::implicit_deps_, Edge::inputs_, and Edge::order_only_deps_.
| TEST_F | ( | BuildTest | , |
| RebuildOrderOnlyDeps | |||
| ) |
Definition at line 962 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_EQ, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| Phony | |||
| ) |
Definition at line 1041 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_FALSE, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| PhonyNoWork | |||
| ) |
Definition at line 1058 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| PhonySelfReference | |||
| ) |
Definition at line 1074 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| Fail | |||
| ) |
Definition at line 1084 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_FALSE, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| SwallowFailures | |||
| ) |
Definition at line 1099 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_FALSE, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| SwallowFailuresLimit | |||
| ) |
Definition at line 1120 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_FALSE, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| SwallowFailuresPool | |||
| ) |
Definition at line 1141 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_FALSE, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| PoolEdgesReadyButNotWanted | |||
| ) |
Definition at line 1165 of file build_test.cc.
References Pool::current_use(), EXPECT_GE, and State::LookupPool().
| TEST_F | ( | BuildWithLogTest | , |
| NotInLogButOnDisk | |||
| ) |
Definition at line 1198 of file build_test.cc.
References ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_FALSE, and EXPECT_TRUE.
| TEST_F | ( | BuildWithLogTest | , |
| RebuildAfterFailure | |||
| ) |
Definition at line 1223 of file build_test.cc.
References ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_EQ, EXPECT_FALSE, and EXPECT_TRUE.
| TEST_F | ( | BuildWithLogTest | , |
| RebuildWithNoInputs | |||
| ) |
Definition at line 1268 of file build_test.cc.
References ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_EQ, and EXPECT_TRUE.
| TEST_F | ( | BuildWithLogTest | , |
| RestatTest | |||
| ) |
Definition at line 1299 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_EQ, EXPECT_TRUE, and BuildStatus::kEdgeStarted.
| TEST_F | ( | BuildWithLogTest | , |
| RestatMissingFile | |||
| ) |
Definition at line 1364 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), and EXPECT_TRUE.
| TEST_F | ( | BuildWithLogTest | , |
| RestatSingleDependentOutputDirty | |||
| ) |
Definition at line 1405 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), and EXPECT_TRUE.
| TEST_F | ( | BuildWithLogTest | , |
| RestatMissingInput | |||
| ) |
Definition at line 1447 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, ASSERT_TRUE, AssertParse(), and EXPECT_TRUE.
| TEST_F | ( | BuildDryRun | , |
| AllCommandsShown | |||
| ) |
Definition at line 1505 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| RspFileSuccess | |||
| ) |
Definition at line 1536 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| RspFileFailure | |||
| ) |
Definition at line 1588 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_FALSE, and EXPECT_TRUE.
| TEST_F | ( | BuildWithLogTest | , |
| RspFileCmdLineChange | |||
| ) |
Definition at line 1627 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, ASSERT_TRUE, AssertHash(), AssertParse(), EXPECT_EQ, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| InterruptCleanup | |||
| ) |
Definition at line 1673 of file build_test.cc.
References ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_EQ, EXPECT_FALSE, EXPECT_GT, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| StatFailureAbortsBuild | |||
| ) |
Definition at line 1707 of file build_test.cc.
References ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_EQ, and EXPECT_FALSE.
| TEST_F | ( | BuildTest | , |
| PhonyWithNoInputs | |||
| ) |
Definition at line 1722 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_EQ, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| DepsGccWithEmptyDepfileErrorsOut | |||
| ) |
Definition at line 1748 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_FALSE, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| StatusFormatElapsed | |||
| ) |
Definition at line 1766 of file build_test.cc.
References EXPECT_EQ, and BuildStatus::kEdgeStarted.
| TEST_F | ( | BuildTest | , |
| StatusFormatReplacePlaceholder | |||
| ) |
Definition at line 1774 of file build_test.cc.
References EXPECT_EQ, and BuildStatus::kEdgeStarted.
| TEST_F | ( | BuildTest | , |
| FailedDepsParse | |||
| ) |
Definition at line 1780 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_EQ, EXPECT_FALSE, and EXPECT_TRUE.
| TEST_F | ( | BuildWithDepsLogTest | , |
| Straightforward | |||
| ) |
Run a straightforwad build where the deps log is used.
Definition at line 1822 of file build_test.cc.
References Builder::AddTarget(), ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, ASSERT_TRUE, AssertParse(), Builder::Build(), DepsLog::Close(), Builder::command_runner_, EXPECT_EQ, EXPECT_TRUE, 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 1889 of file build_test.cc.
References Builder::AddTarget(), ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, ASSERT_TRUE, AssertParse(), Builder::Build(), DepsLog::Close(), Builder::command_runner_, EXPECT_EQ, EXPECT_TRUE, DepsLog::Load(), and DepsLog::OpenForWrite().
| TEST_F | ( | BuildWithDepsLogTest | , |
| DepsIgnoredInDryRun | |||
| ) |
Definition at line 1959 of file build_test.cc.
References Builder::AddTarget(), ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), Builder::Build(), Builder::command_runner_, and EXPECT_TRUE.
| TEST_F | ( | BuildTest | , |
| RestatDepfileDependency | |||
| ) |
Check that a restat rule generating a header cancels compilations correctly.
Definition at line 1989 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_EQ, and EXPECT_TRUE.
| TEST_F | ( | BuildWithDepsLogTest | , |
| RestatDepfileDependencyDepsLog | |||
| ) |
Check that a restat rule generating a header cancels compilations correctly, depslog case.
Definition at line 2012 of file build_test.cc.
References Builder::AddTarget(), ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, ASSERT_TRUE, AssertParse(), Builder::Build(), DepsLog::Close(), Builder::command_runner_, EXPECT_EQ, EXPECT_TRUE, DepsLog::Load(), and DepsLog::OpenForWrite().
| TEST_F | ( | BuildWithDepsLogTest | , |
| DepFileOKDepsLog | |||
| ) |
Definition at line 2075 of file build_test.cc.
References Builder::AddTarget(), ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, ASSERT_TRUE, AssertParse(), Builder::Build(), DepsLog::Close(), Builder::command_runner_, State::edges_, Edge::EvaluateCommand(), EXPECT_EQ, EXPECT_TRUE, State::GetNode(), Edge::inputs_, DepsLog::Load(), Node::MarkDirty(), and DepsLog::OpenForWrite().
| TEST_F | ( | BuildTest | , |
| RestatMissingDepfile | |||
| ) |
Check that a restat rule doesn't clear an edge if the depfile is missing.
Follows from: https://github.com/ninja-build/ninja/issues/603
Definition at line 2204 of file build_test.cc.
References ASSERT_EQ.
| TEST_F | ( | BuildWithDepsLogTest | , |
| RestatMissingDepfileDepslog | |||
| ) |
Check that a restat rule doesn't clear an edge if the deps are missing.
https://github.com/ninja-build/ninja/issues/603
Definition at line 2228 of file build_test.cc.
References ASSERT_EQ.
| TEST_F | ( | BuildTest | , |
| WrongOutputInDepfileCausesRebuild | |||
| ) |
Definition at line 2278 of file build_test.cc.
References ASSERT_EQ.
| TEST_F | ( | BuildTest | , |
| Console | |||
| ) |
Definition at line 2295 of file build_test.cc.
References ASSERT_EQ, ASSERT_NO_FATAL_FAILURE, AssertParse(), EXPECT_EQ, and EXPECT_TRUE.
1.8.14