[Git][ghc/ghc][wip/angerman/cross-test-suite] Better TEST_WRAPPER injection.

Moritz Angermann gitlab at gitlab.haskell.org
Thu Jul 16 07:13:41 UTC 2020



Moritz Angermann pushed to branch wip/angerman/cross-test-suite at Glasgow Haskell Compiler / GHC


Commits:
cdb0d3ea by Moritz Angermann at 2020-07-16T07:13:26+00:00
Better TEST_WRAPPER injection.

- - - - -


1 changed file:

- testsuite/driver/testlib.py


Changes:

=====================================
testsuite/driver/testlib.py
=====================================
@@ -1643,12 +1643,11 @@ def simple_run(name: TestName, way: WayName, prog: str, extra_run_opts: str) ->
     else:
         stats_args = ''
 
+    # 1. Build command
     # Put extra_run_opts last: extra_run_opts('+RTS foo') should work.
     cmd = ' '.join([prog, stats_args, my_rts_flags, extra_run_opts])
 
-    if opts.cmd_wrapper is not None:
-        cmd = opts.cmd_wrapper(cmd)
-
+    # 2. prefix with TEST_WRAPPER
     # The test wrapper. Default to $TOP / driver / id
     # for the identity test-wrapper.
     if config.test_wrapper is None:
@@ -1656,9 +1655,15 @@ def simple_run(name: TestName, way: WayName, prog: str, extra_run_opts: str) ->
     else:
         test_wrapper = config.test_wrapper
 
-    cmd = 'cd "{opts.testdir}" && TEST_WRAPPER="{test_wrapper}" {cmd}'.format(**locals())
+    cmd = 'TEST_WRAPPER="{test_wrapper}" && {cmd}'.format(**locals())
+
+    # 3. Apply cmd_wrapper if set.
+    if opts.cmd_wrapper is not None:
+        cmd = opts.cmd_wrapper(cmd)
+
+    cmd = 'cd "{opts.testdir}" && {cmd}'.format(**locals())
 
-    # run the command
+    # 4. Finally, run the command
     exit_code = runCmd(cmd, stdin_arg, stdout_arg, stderr_arg, opts.run_timeout_multiplier)
 
     # check the exit code



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/cdb0d3ea29109e4d409d415cfe19d84fc949e7af

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/cdb0d3ea29109e4d409d415cfe19d84fc949e7af
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200716/574ff4be/attachment-0001.html>


More information about the ghc-commits mailing list