[commit: testsuite] master: Only run dynamicToo001 if we have both vanilla and dynamic libraries (890fea0)

Ian Lynagh <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/890fea060ec8507f31f3ff212aaf8b56a80b1671

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

commit 890fea060ec8507f31f3ff212aaf8b56a80b1671
Author: Ian Lynagh <[email protected]>
Date:   Fri Dec 14 23:29:47 2012 +0000

    Only run dynamicToo001 if we have both vanilla and dynamic libraries

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

 config/ghc                    |    3 +++
 driver/testglobals.py         |    3 +++
 driver/testlib.py             |   36 ++++++++++++++++++++++++++++++++++++
 mk/test.mk                    |    9 ++++++++-
 tests/driver/dynamicToo/all.T |   12 +++++++-----
 5 files changed, 57 insertions(+), 6 deletions(-)

diff --git a/config/ghc b/config/ghc
index 6803248..73ff7d3 100644
--- a/config/ghc
+++ b/config/ghc
@@ -40,6 +40,9 @@ config.compiler_debugged = ghc_debugged
 if (ghc_with_vanilla == 1):
     config.have_vanilla = True
 
+if (ghc_with_dynamic == 1):
+    config.have_dynamic = True
+
 if (ghc_with_profiling == 1):
     config.have_profiling = True
     config.compile_ways.append('profasm')
diff --git a/driver/testglobals.py b/driver/testglobals.py
index f1dd4fb..10a1105 100644
--- a/driver/testglobals.py
+++ b/driver/testglobals.py
@@ -81,6 +81,9 @@ class TestConfig:
         # Do we have vanilla libraries?
         self.have_vanilla = False
 
+        # Do we have dynamic libraries?
+        self.have_dynamic = False
+
         # Do we have profiling support?
         self.have_profiling = False
 
diff --git a/driver/testlib.py b/driver/testlib.py
index 524acda..4bdcd2d 100644
--- a/driver/testlib.py
+++ b/driver/testlib.py
@@ -354,6 +354,42 @@ def if_cygwin( f ):
     else:
         return normal
 
+def when_have_vanilla( f ):
+    if config.have_vanilla:
+        return f
+    else:
+        return normal
+
+def unless_have_vanilla( f ):
+    if config.have_vanilla:
+        return normal
+    else:
+        return f
+
+def when_have_dynamic( f ):
+    if config.have_dynamic:
+        return f
+    else:
+        return normal
+
+def unless_have_dynamic( f ):
+    if config.have_dynamic:
+        return normal
+    else:
+        return f
+
+def when_have_profiling( f ):
+    if config.have_profiling:
+        return f
+    else:
+        return normal
+
+def unless_have_profiling( f ):
+    if config.have_profiling:
+        return normal
+    else:
+        return f
+
 # ---
 
 def if_ghci_dynamic( f ):
diff --git a/mk/test.mk b/mk/test.mk
index 942271c..6c974cc 100644
--- a/mk/test.mk
+++ b/mk/test.mk
@@ -49,7 +49,8 @@ endif
 
 BASE_LIBDIR := $(shell "$(GHC_PKG)" field base library-dirs | sed 's/^[^:]*: *//')
 HAVE_VANILLA := $(shell if [ -f $(subst \,/,$(BASE_LIBDIR))/Prelude.hi ]; then echo YES; else echo NO; fi)
-HAVE_PROFILING := $(shell if [ -f $(subst \,/,$(BASE_LIBDIR))/Prelude.p_a ]; then echo YES; else echo NO; fi)
+HAVE_DYNAMIC := $(shell if [ -f $(subst \,/,$(BASE_LIBDIR))/Prelude.dyn_hi ]; then echo YES; else echo NO; fi)
+HAVE_PROFILING := $(shell if [ -f $(subst \,/,$(BASE_LIBDIR))/Prelude.p_hi ]; then echo YES; else echo NO; fi)
 
 ifeq "$(HAVE_VANILLA)" "YES"
 RUNTEST_OPTS += -e ghc_with_vanilla=1
@@ -57,6 +58,12 @@ else
 RUNTEST_OPTS += -e ghc_with_vanilla=0
 endif
 
+ifeq "$(HAVE_DYNAMIC)" "YES"
+RUNTEST_OPTS += -e ghc_with_dynamic=1
+else
+RUNTEST_OPTS += -e ghc_with_dynamic=0
+endif
+
 ifeq "$(HAVE_PROFILING)" "YES"
 RUNTEST_OPTS += -e ghc_with_profiling=1
 else
diff --git a/tests/driver/dynamicToo/all.T b/tests/driver/dynamicToo/all.T
index c10aa2e..a03c314 100644
--- a/tests/driver/dynamicToo/all.T
+++ b/tests/driver/dynamicToo/all.T
@@ -1,11 +1,13 @@
 setTestOpts(only_compiler_types(['ghc']))
 
 test('dynamicToo001',
-     extra_clean(['A001.o',      'B001.o',      'C001.o',
-                  'A001.hi',     'B001.hi',     'C001.hi',
-                  'A001.dyn_o',  'B001.dyn_o',  'C001.dyn_o',
-                  'A001.dyn_hi', 'B001.dyn_hi', 'C001.dyn_hi',
-                  's001', 'd001']),
+     [extra_clean(['A001.o',      'B001.o',      'C001.o',
+                   'A001.hi',     'B001.hi',     'C001.hi',
+                   'A001.dyn_o',  'B001.dyn_o',  'C001.dyn_o',
+                   'A001.dyn_hi', 'B001.dyn_hi', 'C001.dyn_hi',
+                   's001', 'd001']),
+      unless_have_vanilla(skip),
+      unless_have_dynamic(skip)],
      run_command,
      ['$MAKE -s --no-print-directory dynamicToo001'])
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.