[commit: testsuite] master: Replace 'if_platform' and 'unless_platform' with 'platform' (22951cd)

Ian Lynagh igloo at earth.li
Fri Feb 8 15:19:13 CET 2013


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

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/22951cdab93ab21dab9fe5597954b922c9c89a48

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

commit 22951cdab93ab21dab9fe5597954b922c9c89a48
Author: Ian Lynagh <ian at well-typed.com>
Date:   Fri Feb 8 00:38:42 2013 +0000

    Replace 'if_platform' and 'unless_platform' with 'platform'

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

 driver/testlib.py                  |   13 ++-----------
 tests/codeGen/should_gen_asm/all.T |    6 +++---
 tests/ffi/should_run/all.T         |    2 +-
 tests/ghci/scripts/all.T           |    2 +-
 tests/numeric/should_run/all.T     |    2 +-
 tests/perf/compiler/all.T          |    6 +++---
 tests/rts/all.T                    |   12 ++++++------
 7 files changed, 17 insertions(+), 26 deletions(-)

diff --git a/driver/testlib.py b/driver/testlib.py
index 4c9b2c2..aa601f7 100644
--- a/driver/testlib.py
+++ b/driver/testlib.py
@@ -312,17 +312,8 @@ def when(b, f):
 def unless(b, f):
     return when(not b, f)
 
-def if_platform( plat, f ):
-    if config.platform == plat:
-        return f
-    else:
-        return normal
-
-def unless_platform( plat, f ):
-    if config.platform != plat:
-        return f
-    else:
-        return normal
+def platform( plat ):
+    return config.platform == plat
 
 def if_os( os, f ):
     if config.os == os:
diff --git a/tests/codeGen/should_gen_asm/all.T b/tests/codeGen/should_gen_asm/all.T
index a24ae31..be30d5f 100644
--- a/tests/codeGen/should_gen_asm/all.T
+++ b/tests/codeGen/should_gen_asm/all.T
@@ -1,6 +1,6 @@
 test('memcpy',
-     unless_platform('x86_64-unknown-linux',skip), compile_cmp_asm, [''])
+     unless(platform('x86_64-unknown-linux'),skip), compile_cmp_asm, [''])
 test('memcpy-unroll',
-     unless_platform('x86_64-unknown-linux',skip), compile_cmp_asm, [''])
+     unless(platform('x86_64-unknown-linux'),skip), compile_cmp_asm, [''])
 test('memcpy-unroll-conprop',
-     unless_platform('x86_64-unknown-linux',skip), compile_cmp_asm, [''])
+     unless(platform('x86_64-unknown-linux'),skip), compile_cmp_asm, [''])
diff --git a/tests/ffi/should_run/all.T b/tests/ffi/should_run/all.T
index 1811f42..09e6944 100644
--- a/tests/ffi/should_run/all.T
+++ b/tests/ffi/should_run/all.T
@@ -33,7 +33,7 @@ test('ffi004', skip, compile_and_run, [''])
 #
 test('ffi005', [ omit_ways(prof_ways), 
                  if_arch('i386', skip),
-                 if_platform('i386-apple-darwin', expect_broken(4105)),
+                 when(platform('i386-apple-darwin'), expect_broken(4105)),
                  exit_code(3) ],
                compile_and_run, [''])
 
diff --git a/tests/ghci/scripts/all.T b/tests/ghci/scripts/all.T
index f204af7..0b8f62e 100755
--- a/tests/ghci/scripts/all.T
+++ b/tests/ghci/scripts/all.T
@@ -38,7 +38,7 @@ test('ghci022', normal, ghci_script, ['ghci022.script'])
 test('ghci023', normal, ghci_script, ['ghci023.script'])
 test('ghci024',
      [skip_if_fast,
-      if_platform("powerpc-apple-darwin", expect_broken(1845))],
+      when(platform("powerpc-apple-darwin"), expect_broken(1845))],
      run_command,
      ['$MAKE -s --no-print-directory ghci024'])
 test('ghci025', normal, ghci_script, ['ghci025.script'])
diff --git a/tests/numeric/should_run/all.T b/tests/numeric/should_run/all.T
index b2109de..d2f017a 100644
--- a/tests/numeric/should_run/all.T
+++ b/tests/numeric/should_run/all.T
@@ -7,7 +7,7 @@ test('arith001', normal, compile_and_run, [''])
 test('arith002', normal, compile_and_run, [''])
 test('arith003', normal, compile_and_run, [''])
 test('arith004', normal, compile_and_run, [''])
-test('arith005', if_platform('i386-apple-darwin', expect_broken_for(7043, 'ghci')), compile_and_run, [''])
+test('arith005', when(platform('i386-apple-darwin'), expect_broken_for(7043, 'ghci')), compile_and_run, [''])
 test('arith006', normal, compile_and_run, [''])
 test('arith007', normal, compile_and_run, [''])
 
diff --git a/tests/perf/compiler/all.T b/tests/perf/compiler/all.T
index 09a0297..1ba4c15 100644
--- a/tests/perf/compiler/all.T
+++ b/tests/perf/compiler/all.T
@@ -117,7 +117,7 @@ test('T4801',
                    # 12/11/2012: 49 (amd64/Linux) (REASON UNKNOWN!)
 
       # expected value: 58 (amd64/OS X):
-      if_platform('x86_64-apple-darwin',
+      when(platform('x86_64-apple-darwin'),
           compiler_stats_range_field('peak_megabytes_allocated', 58, 1)),
       # expected value: 228286660 (x86/OS X)
       when(wordsize(32),
@@ -130,7 +130,7 @@ test('T4801',
                    # 19/10/2012: 392409984 (amd64/Linux) (-fPIC turned off)
 
       # expected value: 510938976 (amd64/OS X):
-      if_platform('x86_64-apple-darwin',
+      when(platform('x86_64-apple-darwin'),
           compiler_stats_range_field('bytes allocated', 510938976, 5)),
 
       when(wordsize(32),
@@ -144,7 +144,7 @@ test('T4801',
                 # 19/10/2012: 26882576 (-fPIC turned on)
                 # 19/10/2012: 18619912 (-fPIC turned off)
                 # 24/12/2012: 21657520 (perhaps gc sampling time wibbles?)
-      if_platform('x86_64-apple-darwin',
+      when(platform('x86_64-apple-darwin'),
           compiler_stats_range_field('max_bytes_used', 21657520, 5)),
        only_ways(['normal']),
        extra_hc_opts('-static')
diff --git a/tests/rts/all.T b/tests/rts/all.T
index 05510e9..380ce85 100644
--- a/tests/rts/all.T
+++ b/tests/rts/all.T
@@ -9,7 +9,7 @@ test('testblockalloc', compose(c_src,
 test('bug1010', normal, compile_and_run, ['+RTS -c -RTS'])
 test('derefnull',
      composes([
-             if_platform('x86_64-unknown-mingw32', expect_broken(6079)),
+             when(platform('x86_64-unknown-mingw32'), expect_broken(6079)),
              # LLVM Optimiser considers dereference of a null pointer
              # undefined and marks the code as unreachable which means
              # that later optimisations remove it altogether.
@@ -21,13 +21,13 @@ test('derefnull',
              # the right exit code we're OK.
              if_os('linux', ignore_output),
              # SIGBUS on OX X (PPC and x86 only; amd64 gives SEGV)
-             if_platform('i386-apple-darwin', exit_code(138)),
-             if_platform('powerpc-apple-darwin', exit_code(138)),
+             when(platform('i386-apple-darwin'), exit_code(138)),
+             when(platform('powerpc-apple-darwin'), exit_code(138)),
              if_os('mingw32', exit_code(1))]),
      compile_and_run, [''])
 test('divbyzero',
      composes([
-             if_platform('x86_64-unknown-mingw32', expect_broken(6079)),
+             when(platform('x86_64-unknown-mingw32'), expect_broken(6079)),
              # SIGFPE on Linux
              exit_code(136),
              # Apparently the output can be different on different
@@ -121,8 +121,8 @@ def config_T5250(name, opts):
 
 test('T5250', [ config_T5250,
                 # stack ptr is not 16-byte aligned on 32-bit Windows
-                if_platform('i386-unknown-mingw32', expect_fail),
-                if_platform('i386-unknown-linux',
+                when(platform('i386-unknown-mingw32'), expect_fail),
+                when(platform('i386-unknown-linux'),
                             expect_broken_for(4211,['llvm'])),
                 extra_clean(['spalign.o']),
                 omit_ways(['ghci']) ],





More information about the ghc-commits mailing list