Excluding FAILs from UNSUPPORTED test cases

Arsen Arsenović <[email protected]> Thu, 22 Sep 2022 15:36:25 +0200
Newsgroups gmane.comp.sysutils.dejagnu.general
Message-ID <3098007.9lzEvFFZx2@bstg>
Hi,

While working on freestanding libstdc++, we came up with the idea to use 
a special error message to detect tests that use headers that don't work 
in freestanding, and mark them as unsupported by emitting 
::unsupported:: from libstdc++-dg-test.
However, in combination with dg-warn and dg-error, this does not behave 
as intended: the errors those expect will not be emitted, and extra 
errors will be emitted, hence files that should be UNSUPPORTED are 
counted as FAILs (test for excess errors/test for errors, line NN) as 
well as UNSUPPORTED.

I have a workaround for this issue:
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/
testsuite/lib/libstdc++.exp
index f9a165c3d61..526f0fbab73 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -428,6 +428,10 @@ proc libstdc++-dg-test { prog do_what 
extra_tool_flags } {
 
     set unsupported_message [libstdc++_check_unsupported_p 
$comp_output]
     if { $unsupported_message != "" } {
+	upvar dg-messages messages
+	upvar dg-excess-errors-flag excess-errors-flag
+	set messages [list]
+	set excess-errors-flag 1
 	set comp_output "::unsupported::$unsupported_message"
     }
 

... however, it feels prone to breakage (since it depends on how dg-test 
is implemented).

Is there a better way to solve this?

Thanks in advance, and have a most wonderful day,
-- 
Arsen Arsenović
signature.asc (application/pgp-signature, 358 B)
-----BEGIN PGP SIGNATURE-----

iNUEABYKAH0WIQT+4rPRE/wAoxYtYGFSwpQwHqLEkwUCYyxkvl8UgAAAAAAuAChp
c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0RkVF
MkIzRDExM0ZDMDBBMzE2MkQ2MDYxNTJDMjk0MzAxRUEyQzQ5MwAKCRBSwpQwHqLE
k108APsF2BMYJBooQpgCcOBOr03Ya72yLieaIK51kkFu3sOoFQD+MrSgRmCTyGCE
c8pvy4Cdk3ho6KCXMAqxvRxCRFoDdQk=
=pCvN
-----END PGP SIGNATURE-----