Patchwork [05,of,11,STABLE] tests: use "sh -c 'script'" style to invoke commands safely anywhere

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Oct. 20, 2014, 1:26 p.m.
Message ID <da9791c9eb40fc5f2fdb.1413811619@juju>
Download mbox | patch
Permalink /patch/6422/
State Changes Requested
Headers show

Comments

Katsunori FUJIWARA - Oct. 20, 2014, 1:26 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1413810488 -32400
#      Mon Oct 20 22:08:08 2014 +0900
# Branch stable
# Node ID da9791c9eb40fc5f2fdb89b97b487e80dcd1a04d
# Parent  ae05e90779d6a2a6d094f05933ba8a8c34f4c517
tests: use "sh -c 'script'" style to invoke commands safely anywhere

Before this patch, a part of "test-transplant.t" fails unexpectedly on
Windows environment, because semicolon (";") in HGEDITOR isn't
recognized as the command separator by "cmd.exe".

This patch uses "sh -c 'script'" style to invoke multiple commands
(script "checkeditform.sh" and "cat" command) in HGEDITOR safely
anywhere.
Mads Kiilerich - Oct. 20, 2014, 1:58 p.m.
On 10/20/2014 03:26 PM, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1413810488 -32400
> #      Mon Oct 20 22:08:08 2014 +0900
> # Branch stable
> # Node ID da9791c9eb40fc5f2fdb89b97b487e80dcd1a04d
> # Parent  ae05e90779d6a2a6d094f05933ba8a8c34f4c517
> tests: use "sh -c 'script'" style to invoke commands safely anywhere
>
> Before this patch, a part of "test-transplant.t" fails unexpectedly on
> Windows environment, because semicolon (";") in HGEDITOR isn't
> recognized as the command separator by "cmd.exe".
>
> This patch uses "sh -c 'script'" style to invoke multiple commands
> (script "checkeditform.sh" and "cat" command) in HGEDITOR safely
> anywhere.
>
> diff --git a/tests/test-transplant.t b/tests/test-transplant.t
> --- a/tests/test-transplant.t
> +++ b/tests/test-transplant.t
> @@ -99,7 +99,7 @@ clone so subsequent rollback isn't affec
>     > env | grep HGEDITFORM
>     > true
>     > EOF
> -  $ HGEDITOR="sh $TESTTMP/checkeditform.sh; cat" hg transplant --edit 7
> +  $ HGEDITOR="sh -c 'sh \$TESTTMP/checkeditform.sh; cat \$0'" hg transplant --edit 7

Could we just include the cat in checkeditform.sh for this test?

/Mads

Patch

diff --git a/tests/test-transplant.t b/tests/test-transplant.t
--- a/tests/test-transplant.t
+++ b/tests/test-transplant.t
@@ -99,7 +99,7 @@  clone so subsequent rollback isn't affec
   > env | grep HGEDITFORM
   > true
   > EOF
-  $ HGEDITOR="sh $TESTTMP/checkeditform.sh; cat" hg transplant --edit 7
+  $ HGEDITOR="sh -c 'sh \$TESTTMP/checkeditform.sh; cat \$0'" hg transplant --edit 7
   applying ffd6818a3975
   HGEDITFORM=transplant.normal
   b3