Skip to content

Commit 4a71742

Browse files
committed
为了测试用例增加了从.sh到.bat的转换脚本;应对vc没有装在c盘的情形
1 parent 9073ff3 commit 4a71742

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

minised/test/a.bat

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
@REM cl /EHsc /showIncludes main.cpp > main.inc
2-
3-
@REM 剔除库文件;剩下的写入one.txt后并从标准输出中删除。有bug:foo.h在one.txt中出现两次
4-
TYPE main.inc | ..\minised -e "/Note: including file:[ \t]\+C:\\Program Files/d" -e "/Note: including file:/w bug.txt" -e "/Note: including file:/d"
5-
6-
@REM 把最后一个-e的内容用管道再次给minised,就可以避免这个bug
7-
TYPE main.inc | ..\minised -e "/Note: including file:[ \t]\+C:\\Program Files/d" -e "/Note: including file:/w ok.txt" | ..\minised -e "/Note: including file:/d"
8-
9-
@REM 可以运行a.sh以跟正常sed的行为做对比
10-
11-
1+
@REM 这个文件换行用dos风格才行,用unix风格换行会报错
2+
@REM cl /EHsc /showIncludes main.cpp > main.inc
3+
4+
@REM 剔除库文件;剩下的写入one.txt后并从标准输出中删除。有bug:foo.h在one.txt中出现两次
5+
TYPE main.inc | ..\minised -e "/Note: including file:[ \t]\+[A-Z]:\\Program Files/d" -e "/Note: including file:/w bug.txt" -e "/Note: including file:/d"
6+
7+
@REM 把最后一个-e的内容用管道再次给minised,就可以避免这个bug
8+
TYPE main.inc | ..\minised -e "/Note: including file:[ \t]\+[A-Z]:\\Program Files/d" -e "/Note: including file:/w ok.txt" | ..\minised -e "/Note: including file:/d"
9+
10+
@REM 可以运行a.sh以跟正常sed的行为做对比
11+
12+

src/VcCpp2ObjAction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ bool VcCpp2ObjAction::execute(const DepInfo& info)
8181
#if USE_SED_FROM_GITFORWINDOWS
8282
cmd += R"( /showIncludes | sed -r -e "/Note: including file:[[:space:]]+C:\\\\Program Files/d" -e "/Note: including file:/w)";
8383
#elif USE_MINISED_FROM_GNUWIN32
84-
cmd += R"( /showIncludes | minised -e "/Note: including file:[ \t]\+C:\\Program Files/d" -e "/Note: including file:/w)";
84+
cmd += R"( /showIncludes | minised -e "/Note: including file:[ \t]\+[A-Z]:\\Program Files/d" -e "/Note: including file:/w)";
8585
#endif
8686
cmd += " ";
8787
string showIncludes_path_string = showIncludes_path.string();

test/README.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,5 @@
4040
每个目录下得提供一个test-mingw.bat
4141

4242
# 将一个测试用例在gcc/mingw/vc三者间调整
43-
需要修改部分的对照表
44-
45-
| GCC | MinGW | VC |
46-
| --- | --- | --- |
47-
| # | REM | REM |
48-
| -c vc | -c mingw | -c vc |
49-
| gcc.exe | mingw.exe | vc.exe |
50-
| 'a b' | "a b" | "a b" |
51-
52-
53-
54-
55-
56-
57-
58-
43+
../sh2bat.sh run-gcc.sh vc > run-vc.sh
44+
../sh2bat.sh run-gcc.sh mingw > run-mingw.sh

test/sh2bat.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
if [ $# -lt 2 ] ; then
4+
echo "Usage: $0 <.sh name> vc"
5+
exit 1
6+
fi
7+
8+
#batname="${1%.*}.bat"
9+
#echo $batname
10+
11+
#sed -e "/#!/d" -e "s/^#/@REM/g" -e "s/gcc.exe/$2.exe/g" -e "s/-c gcc/-c $2/g" -e "s@/dev/null@NUL@g" $1 -e "s/^cp /COPY /g" -e "s/rm/DEL/g" -e 's/\//\\/g'
12+
sed -e 's/#!.*/@ECHO OFF/g' -e "s/^#/@REM/g" -e "s/gcc.exe/$2.exe/g" -e "s/-c gcc/-c $2/g" -e "s@/dev/null@NUL@g" $1 -e "s/^cp /COPY /g" -e "s/rm/DEL/g" -e 's/\//\\/g'
13+

0 commit comments

Comments
 (0)