public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Iain Buclaw <ibuclaw@gdcproject.org>
To: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] libphobos: Allow building libphobos using Solaris/x86 assembler
Date: Mon, 11 Jan 2021 17:46:35 +0100	[thread overview]
Message-ID: <1610383371.2euuc10rzc.astroid@galago.none> (raw)
In-Reply-To: <1610041123.b2i26y1t01.astroid@galago.none>

Excerpts from Iain Buclaw's message of January 7, 2021 6:48 pm:
> Excerpts from Rainer Orth's message of January 7, 2021 5:17 pm:
>> Hi Iain,
>> 
>>>> The Solaris assemblers don't support UTF-8 identifiers.  Unless gdc can
>>>> encode them in some way for toolchains like this (no idea if this is
>>>> worth the effort), it may be possible to guard the tests with the ucn
>>>> effective-target keyword.
>>>> 
>>>> Apart from that, it seems strange that the failing tests should only
>>>> show up as UNSUPPORTED.  I'd have expected the compilation to FAIL, but
>>>> IIRC the gdc testsuite has to ignore all output, so the test for excess
>>>> errors which would usually catch this is disabled effectively.
>>>
>>> Indeed, the testsuite is far too verbose.  Although many tests have a
>>> TEST_OUTPUT directive, converting them to a Dejagnu style is probably
>>> too much effort for the gain.
>>>
>>> Those tests can just be explicitly disabled, I'll look into that.
>> 
>> Great, thanks.
>> 

Having a look, actually I can just use the presence of TEST_OUTPUT to be
a gate for whether to prune all output or not.

Maybe this can be improved later to extract the contents of TEST_OUTPUT,
but for now, it has caught a few hidden bugs in the tests that I have
handled in the patch below (no changelog entry yet).

Iain.

---

diff --git a/gcc/testsuite/lib/gdc-utils.exp b/gcc/testsuite/lib/gdc-utils.exp
index 6d4a15e9a67..3d9fd401ee8 100644
--- a/gcc/testsuite/lib/gdc-utils.exp
+++ b/gcc/testsuite/lib/gdc-utils.exp
@@ -173,6 +173,27 @@ proc gdc-copy-extra { base extra } {
     return $extra
 }
 
+#
+# Some tests in the DMD testsuite have specific target requirements,
+# handle them explicitly here.
+#
+
+proc gdc-extra-test-options { fdout test } {
+    switch $test {
+	"runnable/mangle.d" -
+	"runnable/testmodule.d" -
+	"runnable/ufcs.d" {
+	    # Tests that require effective-target-ucn
+	    puts $fdout "// { dg-skip-if \"\" { ! ucn } }"
+	}
+
+	"runnable/test42.d" {
+	    # Tests that overflow line limits of older assemblers.
+	    puts $fdout "// { dg-xfail-if \"Lines exceed 10240 characters\" { *-*-solaris2.* && { ! gas } } }"
+	}
+    }
+}
+
 #
 # Translate DMD test directives to dejagnu equivalent.
 #
@@ -209,8 +230,10 @@ proc gdc-convert-test { base test } {
 
     set extra_sources ""
     set extra_files ""
+    set ddoc_options ""
     set needs_phobos 0
     set saw_test_flags 0
+    set saw_test_output 0
 
     upvar 1 compilable_do_what compilable_do_what
     set compilable_output_file_ext ""
@@ -243,6 +266,14 @@ proc gdc-convert-test { base test } {
 	    # LINK sets dg-do-what-default "link"
 	    set compilable_do_what "link"
 
+	} elseif [regexp -- {TEST_OUTPUT} $copy_line] {
+	    # TEST_OUTPUT contents are ignored, but it might be possible to
+	    # convert it into a series of either dg-prune or dg-errors.
+	    # Currently, only saw_test_output is set so that dg-prune is
+	    # added before running the test.
+	    regsub -- {TEST_OUTPUT.*$} $copy_line "" out_line
+	    set saw_test_output 1
+
 	} elseif [regexp -- {POST_SCRIPT} $copy_line] {
 	    # POST_SCRIPT is not handled
 	    regsub -- {POST_SCRIPT.*$} $copy_line "" out_line
@@ -276,7 +307,15 @@ proc gdc-convert-test { base test } {
 	} elseif [regexp -- {EXTRA_SOURCES\s*:\s*(.*)} $copy_line match sources] {
 	    # EXTRA_SOURCES are appended to extra_sources list
 	    foreach srcfile $sources {
-		lappend extra_sources $srcfile
+		# Ddoc files are not handled by the compiler directly, they are
+		# instead passed in using -fdoc-inc=
+		if [regexp -- {\.ddoc$} $srcfile extmatch] {
+		    lappend extra_files $srcfile
+		    lappend ddoc_options "-fdoc-inc=$type/$srcfile"
+
+		} else {
+		    lappend extra_sources $srcfile
+		}
 	    }
 	    regsub -- {EXTRA_SOURCES.*$} $copy_line "" out_line
 
@@ -311,7 +350,7 @@ proc gdc-convert-test { base test } {
 	} elseif [regexp -- {COMPILABLE_MATH_TEST} $copy_line match sources] {
 	    # COMPILABLE_MATH_TEST annotates tests that import the std.math
 	    # module.  Which will need skipping if not available on the target.
-	    regsub -- {RUNNABLE_PHOBOS_TEST.*$} $copy_line "" out_line
+	    regsub -- {COMPILABLE_MATH_TEST.*$} $copy_line "" out_line
 	    set needs_phobos 1
 	}
 
@@ -334,11 +373,17 @@ proc gdc-convert-test { base test } {
 	puts $fdout "// { dg-additional-files \"$extra_files\" }"
     }
 
+    if { [llength $ddoc_options] > 0 } {
+	puts $fdout "// { dg-additional-options \"$ddoc_options\" }"
+    }
+
     # Add specific options for test type
 
     # DMD's testsuite is extremely verbose, compiler messages from constructs
     # such as pragma(msg, ...) would otherwise cause tests to fail.
-    puts $fdout "// { dg-prune-output .* }"
+    if $saw_test_output {
+	puts $fdout "// { dg-prune-output .* }"
+    }
 
     # Compilable files are successful if an output is generated.
     # Fail compilable are successful if an output is not generated.
@@ -357,6 +402,11 @@ proc gdc-convert-test { base test } {
 	    if !$saw_test_flags {
 		set PERMUTE_ARGS $DEFAULT_DFLAGS
 	    }
+	    # Tests mix C++ and D, but not all test options are common between
+	    # the two front-end languages.
+	    if { $type == "runnable_cxx" } {
+		puts $fdout "// { dg-prune-output \"'-frelease' is valid for D but not for C\" }"
+	    }
 	}
 
 	compilable {
@@ -384,6 +434,8 @@ proc gdc-convert-test { base test } {
 	}
     }
 
+    gdc-extra-test-options $fdout $test
+
     close $fdin
     close $fdout
 


  reply	other threads:[~2021-01-11 16:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05 21:43 Iain Buclaw
2021-01-05 21:57 ` Rainer Orth
2021-01-06 13:57   ` Rainer Orth
2021-01-07 16:11     ` Iain Buclaw
2021-01-07 16:17       ` Rainer Orth
2021-01-07 17:48         ` Iain Buclaw
2021-01-11 16:46           ` Iain Buclaw [this message]
2021-01-12 14:54             ` Rainer Orth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1610383371.2euuc10rzc.astroid@galago.none \
    --to=ibuclaw@gdcproject.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ro@CeBiTec.Uni-Bielefeld.DE \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).