From 3e1c3977ce92957d325e297d9b561207f2fab74e Mon Sep 17 00:00:00 2001
From: Achim Gratz <Achim.Gratz@Stromeko.DE>
Date: Sat, 30 Apr 2022 15:48:50 +0200
Subject: [PATCH 102/102] Cygwin: testsuite fixes for libgccjit

The .exe suffix is handled specially by Cygwin, so using that for JIT
objects make the testsuite fail almost all tests.  Changing the suffix
doesn't quite work everywhere unfortunately.
---
 gcc/testsuite/jit.dg/jit.exp                           | 10 +++++-----
 gcc/testsuite/jit.dg/test-compile-to-assembler.c       |  2 +-
 gcc/testsuite/jit.dg/test-compile-to-dynamic-library.c |  2 +-
 gcc/testsuite/jit.dg/test-compile-to-executable.c      |  4 ++--
 gcc/testsuite/jit.dg/test-compile-to-object.c          |  2 +-
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/gcc/testsuite/jit.dg/jit.exp b/gcc/testsuite/jit.dg/jit.exp
index 57b133b6d8c..547518cb9ec 100644
--- a/gcc/testsuite/jit.dg/jit.exp
+++ b/gcc/testsuite/jit.dg/jit.exp
@@ -495,7 +495,7 @@ proc jit-dg-test { prog do_what extra_tool_flags } {
     # This also ensures that the source name makes it into the
     # pass/fail output, so that we can distinguish e.g. which test-foo
     # is failing.
-    set output_file "[file tail $prog].exe"
+    set output_file "[file tail $prog].xcx"
     verbose "output_file: $output_file"
 
     # Create the test executable:
@@ -636,7 +636,7 @@ proc jit-dg-test { prog do_what extra_tool_flags } {
 	# Verify that a reproducer was generated
 	if { [file exists $generated_reproducer] == 1} {
 	    pass "found generated reproducer: $generated_reproducer"
-	    set output_file "${generated_reproducer}.exe"
+	    set output_file "${generated_reproducer}.xcx"
 	    # (this overwrites output_file)
 
 	    # Try to compile the generated reproducer
@@ -810,7 +810,7 @@ proc jit-verify-assembler { args } {
 
     # Name the built executable as OUTPUT_FILENAME with
     # ".exe" appended.
-    set executable_from_asm ${asm_filename}.exe
+    set executable_from_asm ${asm_filename}.xsx
     verbose "  executable_from_asm: ${executable_from_asm}"
 
     # Invoke the driver to assemble/link the .s file to the .exe
@@ -952,7 +952,7 @@ proc jit-verify-object { args } {
 
     # Name the linked executable as OUTPUT_FILENAME with
     # ".exe" appended.
-    set executable_from_obj ${obj_filename}.exe
+    set executable_from_obj ${obj_filename}.xox
     verbose "  executable_from_obj: ${executable_from_obj}"
 
     # Invoke the driver to link the .o file to the .exe
@@ -1004,7 +1004,7 @@ proc jit-verify-dynamic-library { args } {
     # Build a test executable from
     # verify-dynamic-library.c
     set test_src "verify-dynamic-library.c"
-    set test_executable ${test_src}.exe
+    set test_executable ${test_src}.xdx
     verbose "  test_executable: ${test_executable}"
 
     # Invoke the driver to build the test executable
diff --git a/gcc/testsuite/jit.dg/test-compile-to-assembler.c b/gcc/testsuite/jit.dg/test-compile-to-assembler.c
index e3a6d2edd20..6321402e20e 100644
--- a/gcc/testsuite/jit.dg/test-compile-to-assembler.c
+++ b/gcc/testsuite/jit.dg/test-compile-to-assembler.c
@@ -10,4 +10,4 @@
 #include "create-code-for-hello-world-executable.h"
 
 /* { dg-final { jit-verify-output-file-was-created "" } } */
-/* { dg-final { jit-verify-assembler "hello from ./output-of-test-compile-to-assembler.c.s.exe" } } */
+/* { dg-final { jit-verify-assembler "hello from ./output-of-test-compile-to-assembler.c.s.xsx" } } */
diff --git a/gcc/testsuite/jit.dg/test-compile-to-dynamic-library.c b/gcc/testsuite/jit.dg/test-compile-to-dynamic-library.c
index c29e6f6d628..ead2085d303 100644
--- a/gcc/testsuite/jit.dg/test-compile-to-dynamic-library.c
+++ b/gcc/testsuite/jit.dg/test-compile-to-dynamic-library.c
@@ -63,4 +63,4 @@ create_code (gcc_jit_context *ctxt, void *user_data)
 }
 
 /* { dg-final { jit-verify-output-file-was-created "" } } */
-/* { dg-final { jit-verify-dynamic-library "hello from ./verify-dynamic-library.c.exe" } } */
+/* { dg-final { jit-verify-dynamic-library "hello from ./verify-dynamic-library.c.xdx" } } */
diff --git a/gcc/testsuite/jit.dg/test-compile-to-executable.c b/gcc/testsuite/jit.dg/test-compile-to-executable.c
index 2fb0bd91cc9..f9c5c583aae 100644
--- a/gcc/testsuite/jit.dg/test-compile-to-executable.c
+++ b/gcc/testsuite/jit.dg/test-compile-to-executable.c
@@ -5,9 +5,9 @@
 
 #define TEST_COMPILING_TO_FILE
 #define OUTPUT_KIND      GCC_JIT_OUTPUT_KIND_EXECUTABLE
-#define OUTPUT_FILENAME  "output-of-test-compile-to-executable.c.exe"
+#define OUTPUT_FILENAME  "output-of-test-compile-to-executable.c.xcx.exe"
 #include "harness.h"
 #include "create-code-for-hello-world-executable.h"
 
 /* { dg-final { jit-verify-output-file-was-created "" } } */
-/* { dg-final { jit-verify-executable "hello from ./output-of-test-compile-to-executable.c.exe" } } */
+/* { dg-final { jit-verify-executable "hello from ./output-of-test-compile-to-executable.c.xcx" } } */
diff --git a/gcc/testsuite/jit.dg/test-compile-to-object.c b/gcc/testsuite/jit.dg/test-compile-to-object.c
index 81d41c21d40..56914cf9e20 100644
--- a/gcc/testsuite/jit.dg/test-compile-to-object.c
+++ b/gcc/testsuite/jit.dg/test-compile-to-object.c
@@ -10,4 +10,4 @@
 #include "create-code-for-hello-world-executable.h"
 
 /* { dg-final { jit-verify-output-file-was-created "" } } */
-/* { dg-final { jit-verify-object "hello from ./output-of-test-compile-to-object.c.o.exe" } } */
+/* { dg-final { jit-verify-object "hello from ./output-of-test-compile-to-object.c.o.xox" } } */
-- 
2.45.1

