Skip to content

Commit

Permalink
为了测试用例增加了从.sh到.bat的转换脚本;应对vc没有装在c盘的情形
Browse files Browse the repository at this point in the history
  • Loading branch information
duyanning committed Jul 25, 2019
1 parent 9073ff3 commit 4a71742
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
23 changes: 12 additions & 11 deletions minised/test/a.bat
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
@REM cl /EHsc /showIncludes main.cpp > main.inc

@REM 剔除库文件;剩下的写入one.txt后并从标准输出中删除。有bug:foo.h在one.txt中出现两次
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"

@REM 把最后一个-e的内容用管道再次给minised,就可以避免这个bug
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"

@REM 可以运行a.sh以跟正常sed的行为做对比


@REM 这个文件换行用dos风格才行,用unix风格换行会报错
@REM cl /EHsc /showIncludes main.cpp > main.inc

@REM 剔除库文件;剩下的写入one.txt后并从标准输出中删除。有bug:foo.h在one.txt中出现两次
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"

@REM 把最后一个-e的内容用管道再次给minised,就可以避免这个bug
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"

@REM 可以运行a.sh以跟正常sed的行为做对比


2 changes: 1 addition & 1 deletion src/VcCpp2ObjAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ bool VcCpp2ObjAction::execute(const DepInfo& info)
#if USE_SED_FROM_GITFORWINDOWS
cmd += R"( /showIncludes | sed -r -e "/Note: including file:[[:space:]]+C:\\\\Program Files/d" -e "/Note: including file:/w)";
#elif USE_MINISED_FROM_GNUWIN32
cmd += R"( /showIncludes | minised -e "/Note: including file:[ \t]\+C:\\Program Files/d" -e "/Note: including file:/w)";
cmd += R"( /showIncludes | minised -e "/Note: including file:[ \t]\+[A-Z]:\\Program Files/d" -e "/Note: including file:/w)";
#endif
cmd += " ";
string showIncludes_path_string = showIncludes_path.string();
Expand Down
18 changes: 2 additions & 16 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,5 @@
每个目录下得提供一个test-mingw.bat

# 将一个测试用例在gcc/mingw/vc三者间调整
需要修改部分的对照表

| GCC | MinGW | VC |
| --- | --- | --- |
| # | REM | REM |
| -c vc | -c mingw | -c vc |
| gcc.exe | mingw.exe | vc.exe |
| 'a b' | "a b" | "a b" |








../sh2bat.sh run-gcc.sh vc > run-vc.sh
../sh2bat.sh run-gcc.sh mingw > run-mingw.sh
13 changes: 13 additions & 0 deletions test/sh2bat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

if [ $# -lt 2 ] ; then
echo "Usage: $0 <.sh name> vc"
exit 1
fi

#batname="${1%.*}.bat"
#echo $batname

#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'
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'

0 comments on commit 4a71742

Please sign in to comment.