[commit: testsuite] master: Replace 'if_os' and 'unless_os' with 'opsys' (f3c626e)

Ian Lynagh igloo at earth.li
Mon Feb 11 17:34:30 CET 2013


Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/f3c626eaa8410bcd52485ab0d0490ccc73dd9bb9

>---------------------------------------------------------------

commit f3c626eaa8410bcd52485ab0d0490ccc73dd9bb9
Author: Ian Lynagh <ian at well-typed.com>
Date:   Mon Feb 11 13:48:59 2013 +0000

    Replace 'if_os' and 'unless_os' with 'opsys'
    
    The name 'os' clashes with a python library

>---------------------------------------------------------------

 driver/testlib.py                  |   13 ++-----------
 tests/concurrent/should_run/all.T  |    4 ++--
 tests/driver/dynamicToo/all.T      |    2 +-
 tests/dynlibs/all.T                |    4 ++--
 tests/ghc-api/dynCompileExpr/all.T |    2 +-
 tests/ghci/linking/all.T           |    8 ++++----
 tests/ghci/should_run/all.T        |    2 +-
 tests/rts/all.T                    |   18 +++++++++---------
 8 files changed, 22 insertions(+), 31 deletions(-)

diff --git a/driver/testlib.py b/driver/testlib.py
index 985a7b3..08df631 100644
--- a/driver/testlib.py
+++ b/driver/testlib.py
@@ -313,17 +313,8 @@ def unless(b, f):
 def platform( plat ):
     return config.platform == plat
 
-def if_os( os, f ):
-    if config.os == os:
-        return f
-    else:
-        return normal
-
-def unless_os( os, f ):
-    if config.os == os:
-        return normal
-    else:
-        return f
+def opsys( os ):
+    return config.os == os
 
 def if_arch( arch, f ):
     if config.arch == arch:
diff --git a/tests/concurrent/should_run/all.T b/tests/concurrent/should_run/all.T
index 97dc4b1..f0a68de 100644
--- a/tests/concurrent/should_run/all.T
+++ b/tests/concurrent/should_run/all.T
@@ -52,7 +52,7 @@ test('numsparks001', only_ways(['threaded1']), compile_and_run, [''])
 
 test('T4262', [ skip, # skip for now, it doesn't give reliable results
                 only_ways(['threaded1']),
-                unless_os('linux',skip),
+                unless(opsys('linux'),skip),
                 if_compiler_lt('ghc', '7.1', expect_fail) ],
               compile_and_run, [''])
 
@@ -171,7 +171,7 @@ test('conc036', skip, compile_and_run, [''])
 
 # Interrupting foreign calls only makes sense if we are threaded
 test('foreignInterruptible', [skip_if_fast,
-                              if_os('mingw32',expect_fail),
+                              when(opsys('mingw32'),expect_fail),
                               # I don't think we support interrupting Sleep()
                               # on Windows.  --SDM
                               only_threaded_ways,
diff --git a/tests/driver/dynamicToo/all.T b/tests/driver/dynamicToo/all.T
index b85ff31..25d48b0 100644
--- a/tests/driver/dynamicToo/all.T
+++ b/tests/driver/dynamicToo/all.T
@@ -6,7 +6,7 @@ test('dynamicToo001',
                    'A001.dyn_o',  'B001.dyn_o',  'C001.dyn_o',
                    'A001.dyn_hi', 'B001.dyn_hi', 'C001.dyn_hi',
                    's001', 'd001']),
-      if_os('mingw32', expect_broken(7665)),
+      when(opsys('mingw32'), expect_broken(7665)),
       unless_have_vanilla(skip),
       unless_have_dynamic(skip)],
      run_command,
diff --git a/tests/dynlibs/all.T b/tests/dynlibs/all.T
index 2877c50..6a9dfd9 100644
--- a/tests/dynlibs/all.T
+++ b/tests/dynlibs/all.T
@@ -7,7 +7,7 @@ test('T3807',
                    'T3807-export.o', 'T3807-load.o',
                    'T3807test.so',
                    'T3807-load']),
-      if_os('mingw32', skip)],
+      when(opsys('mingw32'), skip)],
      run_command,
      ['$MAKE --no-print-directory -s T3807'])
 
@@ -16,7 +16,7 @@ test('T4464',
       extra_clean(['T4464B.o', 'T4464C.o', 'T4464H.hi', 'T4464H.o',
                    'T4464H_stub.c', 'T4464H_stub.h', 'T4464H_stub.o',
                    'HS4464.dll', 'HS4464.dll.a', 't4464.exe']),
-      unless_os('mingw32', skip)],
+      unless(opsys('mingw32'), skip)],
      run_command,
      ['$MAKE --no-print-directory -s T4464'])
 
diff --git a/tests/ghc-api/dynCompileExpr/all.T b/tests/ghc-api/dynCompileExpr/all.T
index b466a3a..c6034ea 100644
--- a/tests/ghc-api/dynCompileExpr/all.T
+++ b/tests/ghc-api/dynCompileExpr/all.T
@@ -1,5 +1,5 @@
 test('dynCompileExpr',
      [ extra_run_opts('"' + config.libdir + '"'),
-       if_os('mingw32', expect_broken_for(5987, ['dyn'])),
+       when(opsys('mingw32'), expect_broken_for(5987, ['dyn'])),
        omit_ways(prof_ways) ], # cannot run interpreted code with -prof
      compile_and_run, ['-package ghc'])
diff --git a/tests/ghci/linking/all.T b/tests/ghci/linking/all.T
index bd87173..d4724ca 100644
--- a/tests/ghci/linking/all.T
+++ b/tests/ghci/linking/all.T
@@ -12,8 +12,8 @@ test('ghcilink002',
 
 test('ghcilink003',
      [
-       if_os('mingw32', expect_broken(5289)), # still cannot load libstdc++
-                                              # on Windows.  See also #4468.
+       # still cannot load libstdc++ on Windows.  See also #4468.
+       when(opsys('mingw32'), expect_broken(5289)),
        skip_if_no_ghci,
        extra_clean(['dir003/*','dir003'])
      ],
@@ -34,8 +34,8 @@ test('ghcilink005',
 
 test('ghcilink006',
      [
-       if_os('mingw32', expect_broken(5289)), # still cannot load libstdc++
-                                              # on Windows.  See also #4468.
+       # still cannot load libstdc++ on Windows.  See also #4468.
+       when(opsys('mingw32'), expect_broken(5289)),
        skip_if_no_ghci,
        extra_clean(['dir006/*','dir006'])
      ],
diff --git a/tests/ghci/should_run/all.T b/tests/ghci/should_run/all.T
index a2552f6..fa03ac1 100644
--- a/tests/ghci/should_run/all.T
+++ b/tests/ghci/should_run/all.T
@@ -12,7 +12,7 @@ test('T2589',      just_ghci, compile_and_run, [''])
 test('T2881',      just_ghci, compile_and_run, [''])
 
 test('T3171',
-     [if_os('mingw32',skip),
+     [when(opsys('mingw32'),skip),
       req_interp,
       combined_output],
      run_command,
diff --git a/tests/rts/all.T b/tests/rts/all.T
index 380ce85..2276d35 100644
--- a/tests/rts/all.T
+++ b/tests/rts/all.T
@@ -19,11 +19,11 @@ test('derefnull',
              # Apparently the output can be different on different
              # Linux setups, so just ignore it. As long as we get
              # the right exit code we're OK.
-             if_os('linux', ignore_output),
+             when(opsys('linux'), ignore_output),
              # SIGBUS on OX X (PPC and x86 only; amd64 gives SEGV)
              when(platform('i386-apple-darwin'), exit_code(138)),
              when(platform('powerpc-apple-darwin'), exit_code(138)),
-             if_os('mingw32', exit_code(1))]),
+             when(opsys('mingw32'), exit_code(1))]),
      compile_and_run, [''])
 test('divbyzero',
      composes([
@@ -33,11 +33,11 @@ test('divbyzero',
              # Apparently the output can be different on different
              # Linux setups, so just ignore it. As long as we get
              # the right exit code we're OK.
-             if_os('linux', ignore_output),
-             if_os('mingw32', exit_code(1))]),
+             when(opsys('linux'), ignore_output),
+             when(opsys('mingw32'), exit_code(1))]),
      compile_and_run, [''])
 
-test('outofmem', if_os('darwin', skip), 
+test('outofmem', when(opsys('darwin'), skip), 
                  run_command, ['$MAKE -s --no-print-directory outofmem'])
 test('outofmem2', extra_run_opts('+RTS -M5m -RTS'),
                   run_command, ['$MAKE -s --no-print-directory outofmem2'])
@@ -80,11 +80,11 @@ test('rtsflags002', [ only_ways(['normal']) ], compile_and_run, ['-with-rtsopts=
 
 # Test to see if linker scripts link properly to real ELF files
 test('T2615',
-     [ if_os('mingw32', skip),
+     [ when(opsys('mingw32'), skip),
        # OS X doesn't seem to support linker scripts
-       if_os('darwin', skip),
+       when(opsys('darwin'), skip),
        # Solaris' linker does not support GNUish linker scripts
-       if_os('solaris2', skip),
+       when(opsys('solaris2'), skip),
        pre_cmd('$MAKE -s --no-print-directory T2615-prep'),
        # Add current directory to dlopen search path
        cmd_prefix('LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. '),
@@ -105,7 +105,7 @@ test('T4059',
 
 # Test for #4274
 test('exec_signals', [
-     if_os('mingw32', skip),
+     when(opsys('mingw32'), skip),
      pre_cmd('$MAKE -s --no-print-directory exec_signals-prep'),
      cmd_prefix('./exec_signals_prepare'),
      extra_clean(['exec_signals_child', 'exec_signals_prepare'])





More information about the ghc-commits mailing list