Skip to content

Commit 4d8f194

Browse files
committed
增加测试用例;美化时间报告格式
1 parent ef7a654 commit 4d8f194

File tree

8 files changed

+64
-17
lines changed

8 files changed

+64
-17
lines changed

src/GccCpp2ObjAction.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,7 @@ bool GccCpp2ObjAction::execute(const DepInfo& info)
7373
obj->generate_birth_cert(dep_path);
7474
//obj->generate_birth_cert();
7575

76-
MINILOG(build_exe_timer_logger, "compiling " << cpp_path.filename()
77-
<< " "
78-
<< timer.format(boost::timer::default_places, "%ws"));
76+
MINILOG(build_exe_timer_logger, timer.format(boost::timer::default_places, "%ws") << " compiling " << cpp_path.filename());
7977

8078
return true;
81-
8279
}

src/GccObj2ExeAction.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ bool GccObj2ExeAction::execute(const DepInfo& info)
6969

7070
exe->generate_birth_cert();
7171

72-
MINILOG(build_exe_timer_logger, "linking " << exe_path.filename()
73-
<< " "
74-
<< timer.format(boost::timer::default_places, "%ws"));
72+
MINILOG(build_exe_timer_logger, timer.format(boost::timer::default_places, "%ws") << " linking " << exe_path.filename());
7573

7674
return true;
7775
}

src/VcCpp2ObjAction.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,7 @@ bool VcCpp2ObjAction::execute(const DepInfo& info)
175175
obj->generate_birth_cert(dep_path);
176176
//obj->generate_birth_cert();
177177

178-
MINILOG(build_exe_timer_logger, "compiling " << cpp_path.filename()
179-
<< " "
180-
<< timer.format(boost::timer::default_places, "%ws"));
178+
MINILOG(build_exe_timer_logger, timer.format(boost::timer::default_places, "%ws") << " compiling " << cpp_path.filename());
181179

182180
return true;
183181

src/VcObj2ExeAction.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ bool VcObj2ExeAction::execute(const DepInfo& info)
7878

7979
exe->generate_birth_cert();
8080

81-
MINILOG(build_exe_timer_logger, "linking " << exe_path.filename()
82-
<< " "
83-
<< timer.format(boost::timer::default_places, "%ws"));
81+
MINILOG(build_exe_timer_logger, timer.format(boost::timer::default_places, "%ws") << " linking " << exe_path.filename());
8482

8583
return true;
8684
}

src/main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,20 @@ try {
99
// 解析命令行选项,读取配置文件
1010
parse(argc, argv);
1111

12+
MINILOG(build_exe_timer_logger, timer.format(boost::timer::default_places, "%ws") << " PARSE ");
13+
1214
// 扫描源文件,搜集信息
1315
collect();
16+
MINILOG(build_exe_timer_logger, timer.format(boost::timer::default_places, "%ws") << " COLLECT");
1417
if (collect_only) return 0;
1518

1619
// 构建
1720
bool success = build();
21+
MINILOG(build_exe_timer_logger, timer.format(boost::timer::default_places, "%ws") << " BUILD");
1822
if (!success) return 0;
1923
if (build_only) return 0;
2024

21-
MINILOG(build_exe_timer_logger, "total " << timer.format(boost::timer::default_places, "%ws"));
25+
MINILOG(build_exe_timer_logger, timer.format(boost::timer::default_places, "%ws") << " TOTAL = PARSE + COLLECT + BUILD");
2226

2327
// 运行
2428
run();

src/scan.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,7 @@ void collect_source(fs::path src_path)
220220
// 将采集到的部分信息合并到整体中
221221
merge(pack);
222222

223-
MINILOG(build_exe_timer_logger, "collecting " << src_path.filename()
224-
<< " "
225-
<< timer.format(boost::timer::default_places, "%ws"));
223+
MINILOG(build_exe_timer_logger, timer.format(boost::timer::default_places, "%ws") << " collecting " << src_path.filename());
226224

227225
// 采集引用的.cpp文件
228226
for (auto a : pack.referenced_sources) {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@ECHO OFF
2+
3+
DEL one.* > NUL
4+
copy backup\void-one.cpp .\one.cpp
5+
copy backup\void-one.h .\one.h
6+
DEL three.* > NUL
7+
copy backup\void-three.cpp .\three.cpp
8+
copy backup\void-three.h .\three.h
9+
10+
cpps --clear -c mingw -v main.cpp
11+
REM CHECK: scanning main.cpp
12+
REM CHECK-NEXT: scanning one.cpp
13+
REM CHECK-NEXT: scanning two.cpp
14+
REM CHECK-NEXT: scanning three.cpp
15+
REM CHECK-NEXT: scanning four.cpp
16+
REM CHECK-NEXT: scanning five.cpp
17+
18+
del one.* > NUL
19+
copy backup\int-one.cpp .\one.cpp
20+
copy backup\int-one.h .\one.h
21+
del three.* > NUL
22+
copy backup\int-three.cpp .\three.cpp
23+
copy backup\int-three.h .\three.h
24+
25+
cpps -c mingw -v main.cpp
26+
REM CHECK: scanning one.cpp
27+
REM CHECK-NEXT: scanning three.cpp

test/incremental-scan/run-vc.bat

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@ECHO OFF
2+
3+
DEL one.* > NUL
4+
copy backup\void-one.cpp .\one.cpp
5+
copy backup\void-one.h .\one.h
6+
DEL three.* > NUL
7+
copy backup\void-three.cpp .\three.cpp
8+
copy backup\void-three.h .\three.h
9+
10+
cpps --clear -c vc -v main.cpp
11+
REM CHECK: scanning main.cpp
12+
REM CHECK-NEXT: scanning one.cpp
13+
REM CHECK-NEXT: scanning two.cpp
14+
REM CHECK-NEXT: scanning three.cpp
15+
REM CHECK-NEXT: scanning four.cpp
16+
REM CHECK-NEXT: scanning five.cpp
17+
18+
del one.* > NUL
19+
copy backup\int-one.cpp .\one.cpp
20+
copy backup\int-one.h .\one.h
21+
del three.* > NUL
22+
copy backup\int-three.cpp .\three.cpp
23+
copy backup\int-three.h .\three.h
24+
25+
cpps -c vc -v main.cpp
26+
REM CHECK: scanning one.cpp
27+
REM CHECK-NEXT: scanning three.cpp

0 commit comments

Comments
 (0)