59 const size_t kRuleSize = 4000;
60 string long_rule_command =
"gcc ";
61 for (
int i = 0; long_rule_command.size() < kRuleSize; ++i) {
63 sprintf(buf,
"-I../../and/arbitrary/but/fairly/long/path/suffixed/%d ", i);
64 long_rule_command += buf;
66 long_rule_command +=
"$in -o $out\n";
70 if (!parser.
ParseTest(
"rule cxx\n command = " + long_rule_command, err))
75 const int kNumCommands = 30000;
77 for (
int i = 0; i < kNumCommands; ++i) {
79 sprintf(buf,
"build input%d.o: cxx input%d.cc\n", i, i);
86 for (
int i = 0; i < kNumCommands; ++i) {
101 fprintf(stderr,
"Failed to write test data: %s\n", err.c_str());
109 fprintf(stderr,
"Failed to read test data: %s\n", err.c_str());
113 const int kNumRepetitions = 5;
114 for (
int i = 0; i < kNumRepetitions; ++i) {
118 fprintf(stderr,
"Failed to read test data: %s\n", err.c_str());
122 printf(
"%dms\n", delta);
123 times.push_back(delta);
129 for (
size_t i = 0; i < times.size(); ++i) {
133 else if (times[i] > max)
137 printf(
"min %dms max %dms avg %.1fms\n",
138 min, max, total / times.size());
bool OpenForWrite(const string &path, string *err)
vector< Edge * > edges_
All the edges of the graph.
int64_t GetTimeMillis()
Get the current time as relative to some epoch.
Store a log of every command ran for every build.
void RecordCommand(Edge *edge, int start_time, int end_time, TimeStamp restat_mtime=0)
signed long long int64_t
A 64-bit integer type.
bool WriteTestData(string *err)
const char kTestFilename[]
Global state (file status, loaded rules) for a single run.
bool Load(const string &path, string *err)
Load the on-disk log.
bool ParseTest(const string &input, string *err)
Parse a text string of input. Used by tests.