Patchwork tests: on windows, run command explicitly in sh for working command substitution

login
register
mail settings
Submitter Simon Heimberg
Date Feb. 8, 2014, 3:37 p.m.
Message ID <289c3b0e73da58ed81a0.1391873844@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/3521/
State Accepted
Commit a8e6ab7eb361411313508d4ffdb9fc24fcef40d9
Headers show

Comments

Simon Heimberg - Feb. 8, 2014, 3:37 p.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1391852477 -3600
# Node ID 289c3b0e73da58ed81a0be54956034437572b98d
# Parent  62daef5cf1fbd55783a1d26f361e73930ca4fb0a
tests: on windows, run command explicitly in sh for working command substitution

On windows, os.system runs the command in cmd.exe, which does not know command
substitution. To let this work, run the command explicitly in sh.

This fixes the failure of this test on windows.
Matt Mackall - Feb. 9, 2014, 10:22 p.m.
On Sat, 2014-02-08 at 16:37 +0100, Simon Heimberg wrote:
> # HG changeset patch
> # User Simon Heimberg <simohe@besonet.ch>
> # Date 1391852477 -3600
> # Node ID 289c3b0e73da58ed81a0be54956034437572b98d
> # Parent  62daef5cf1fbd55783a1d26f361e73930ca4fb0a
> tests: on windows, run command explicitly in sh for working command substitution

Queued for default, thanks.

Patch

diff -r 62daef5cf1fb -r 289c3b0e73da tests/test-commandserver.py
--- a/tests/test-commandserver.py	Die Jan 28 00:33:52 2014 +0100
+++ b/tests/test-commandserver.py	Sam Feb 08 10:41:17 2014 +0100
@@ -267,7 +267,10 @@ 
 
     runcommand(server, ['up', 'null'])
     runcommand(server, ['phase', '-df', 'tip'])
-    os.system('hg debugobsolete `hg log -r tip --template {node}`')
+    cmd = 'hg debugobsolete `hg log -r tip --template {node}`'
+    if os.name == 'nt':
+        cmd = 'sh -c "%s"' % cmd # run in sh, not cmd.exe
+    os.system(cmd)
     runcommand(server, ['log', '--hidden'])
     runcommand(server, ['log'])