diff mbox series

Fix gdc testsuite failures on Solaris

Message ID yddva27y19t.fsf@CeBiTec.Uni-Bielefeld.DE
State New
Headers show
Series Fix gdc testsuite failures on Solaris | expand

Commit Message

Rainer Orth Jan. 29, 2019, 2:41 p.m. UTC
This patch fixes two gdc testsuite failures on Solaris:

UNRESOLVED: gdc.test/runnable/dhry.d   compilation failed to produce executable
UNRESOLVED: gdc.test/runnable/dhry.d -shared-libphobos   compilation failed to produce executable

gdc.test/runnable/dhry.d:489:16: error: undefined identifier 'dtime'
gdc.test/runnable/dhry.d:543:14: error: undefined identifier 'dtime'

In line with the existing code, I've added yet another (identical)
implementation of dtime.  However, to avoid further duplication, it's
probably way better to introduce (say) version (Have_Gettimeofday)
instead.

The other failures is

UNRESOLVED: gdc.test/runnable/cppa.d   compilation failed to produce executable
UNRESOLVED: gdc.test/runnable/cppa.d -g   compilation failed to produce executable
UNRESOLVED: gdc.test/runnable/cppa.d -g -shared-libphobos   compilation failed to produce executable
UNRESOLVED: gdc.test/runnable/cppa.d -shared-libphobos   compilation failed to produce executable

In file included from gdc.test/runnable/extra-files/cppb.cpp:36:
/vol/gcc/src/hg/trunk/local/gcc/testsuite/../../libstdc++-v3/libsupc++/exception:37:10: fatal error: bits/c++config.h: No such file or directory
compilation terminated.

It turns out that one the -I flags added by is wrong for the non-default
multilib:

$objdir/gcc/testsuite/gdc1/../../gdc -B$objdir/gcc/testsuite/gdc1/../../ gdc.test/runnable/cppa.d -m64 -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers -fdiagnostics-color=never -I$objdir/i386-pc-solaris2.11/amd64/libphobos/libdruntime -I$srcdir/gcc/testsuite/../../libphobos/libdruntime -I$srcdir/gcc/testsuite/../../libphobos/src -I$objdir/i386-pc-solaris2.11/amd64/libstdc++-v3/include -I$objdir/i386-pc-solaris2.11/amd64/libstdc++-v3/include/amd64 -I$srcdir/gcc/testsuite/../../libstdc++-v3/libsupc++ -I$srcdir/gcc/testsuite/gdc.test/runnable gdc.test/runnable/extra-files/cppb.cpp -B$objdir/i386-pc-solaris2.11/amd64/libphobos/src -L$objdir/i386-pc-solaris2.11/amd64/libphobos/src/.libs -L$objdir/i386-pc-solaris2.11/amd64/libphobos/libdruntime/.libs -L$objdir/i386-pc-solaris2.11/amd64/libstdc++-v3/src/.libs -lm -o ./cppa.exe

While bits/c++config.h is in

  i386-pc-solaris2.11/amd64/libstdc++-v3/include/i386-pc-solaris2.11

gdc searches .../libstdc++-v3/include/amd64 instead which doesn't
exist.  This needs to be $target_triplet instead, which lets the test
PASS for both the default and the 64-bit multilib.  The same issue
exists with multilib testing on Linux, btw.

Tested on i386-pc-solaris2.11 and x86_64-pc-linux-gnu.  Ok for mainline?

	Rainer
diff mbox series

Patch

# HG changeset patch
# Parent  c9fb71dd0383141099bbe01ff36128303e774f7a
Fix gdc testsuite failures on Solaris

diff --git a/gcc/testsuite/gdc.test/runnable/dhry.d b/gcc/testsuite/gdc.test/runnable/dhry.d
--- a/gcc/testsuite/gdc.test/runnable/dhry.d
+++ b/gcc/testsuite/gdc.test/runnable/dhry.d
@@ -925,3 +925,19 @@  version (NetBSD)
      return q;
     }
 }
+
+version (Solaris)
+{
+    import core.sys.posix.sys.time;
+
+    double dtime()
+    {
+     double q;
+     timeval tv;
+
+     gettimeofday(&tv,null);
+     q = cast(double)tv.tv_sec + cast(double)tv.tv_usec * 1.0e-6;
+
+     return q;
+    }
+}
diff --git a/gcc/testsuite/lib/gdc.exp b/gcc/testsuite/lib/gdc.exp
--- a/gcc/testsuite/lib/gdc.exp
+++ b/gcc/testsuite/lib/gdc.exp
@@ -68,7 +68,7 @@  proc gdc_version { } {
 #
 
 proc gdc_include_flags { paths } {
-    global srcdir
+    global srcdir target_triplet
     global TESTING_IN_BUILD_TREE
 
     set flags ""
@@ -78,7 +78,6 @@  proc gdc_include_flags { paths } {
     }
 
     set gccpath ${paths}
-    set target [file tail [file normalize ${paths}]]
 
     if { $gccpath != "" } {
         if [file exists "${gccpath}/libphobos/libdruntime"] {
@@ -92,7 +91,7 @@  proc gdc_include_flags { paths } {
     if { $gccpath != "" } {
         if [file exists "${gccpath}/libstdc++-v3/include"] {
             append flags "-I${gccpath}/libstdc++-v3/include "
-            append flags "-I${gccpath}/libstdc++-v3/include/$target "
+            append flags "-I${gccpath}/libstdc++-v3/include/$target_triplet "
         }
     }
     append flags "-I${srcdir}/../../libstdc++-v3/libsupc++"