PR jit/64752 - Rewrite jit testsuite to eliminate use of "file"
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 6 Feb 2015 23:19:32 +0000 (23:19 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Fri, 6 Feb 2015 23:19:32 +0000 (23:19 +0000)
gcc/testsuite/ChangeLog:
PR jit/64752
* jit.dg/create-code-for-hello-world-executable.h: New file, taken
from jit.dg/test-compile-to-executable.c's create_code, with a
clarification of the output message.
* jit.dg/harness.h (CHECK_NO_ERRORS): Add test and __func__ to the
pass/fail message.
(test_jit): Use CHECK_NO_ERRORS when calling
gcc_jit_context_compile_to_file.
* jit.dg/jit.exp (jit-dg-test): Update grep for rename of
jit-verify-compile-to-file to jit-verify-output-file-was-created.
(jit-setup-compile-to-file): Likewise.  Add a verbose comment
about deletions that are attempted.
(jit-verify-compile-to-file): Rename to...
(jit-verify-output-file-was-created): ...this, and drop the
attempt to run "file" and verify the output.
(jit-verify-assembler): New function.
(jit-verify-object): New function.
(jit-verify-dynamic-library): New function.
* jit.dg/test-compile-to-assembler.c (create_code): Eliminate in
favor of an implementation from new file
create-code-for-hello-world-executable.h, which also adds a
"main".
(dg-final): Replace jit-verify-compile-to-file with
jit-verify-output-file-was-created, and invoke new function
jit-verify-assembler.
* jit.dg/test-compile-to-dynamic-library.c (create_code): Clarify
the output message.
(dg-final): Replace jit-verify-compile-to-file with
jit-verify-output-file-was-created, and invoke new function
jit-verify-dynamic-library.
* jit.dg/test-compile-to-executable.c (create_code): Eliminate in
favor of an implementation from new file
create-code-for-hello-world-executable.h, which also adds a
"main".
(dg-final): Replace jit-verify-compile-to-file with
jit-verify-output-file-was-created.  Strengthen the expected stdout
from the built executable.
* jit.dg/test-compile-to-object.c (create_code): Eliminate in
favor of an implementation from new file
create-code-for-hello-world-executable.h, which also adds a
"main".
(dg-final): Replace jit-verify-compile-to-file with
jit-verify-output-file-was-created, and invoke new function
jit-verify-object.
* jit.dg/verify-dynamic-library.c: New source file.

From-SVN: r220494

gcc/testsuite/ChangeLog
gcc/testsuite/jit.dg/harness.h
gcc/testsuite/jit.dg/jit.exp
gcc/testsuite/jit.dg/test-compile-to-assembler.c
gcc/testsuite/jit.dg/test-compile-to-dynamic-library.c
gcc/testsuite/jit.dg/test-compile-to-executable.c
gcc/testsuite/jit.dg/test-compile-to-object.c

index e10f7782b44846f04c8a76c76f42d4a837f26610..dbe52cf0fd6f5c6388339a77fbcecf3dab84bc48 100644 (file)
@@ -1,3 +1,51 @@
+2015-02-06  David Malcolm  <dmalcolm@redhat.com>
+
+       PR jit/64752
+       * jit.dg/create-code-for-hello-world-executable.h: New file, taken
+       from jit.dg/test-compile-to-executable.c's create_code, with a
+       clarification of the output message.
+       * jit.dg/harness.h (CHECK_NO_ERRORS): Add test and __func__ to the
+       pass/fail message.
+       (test_jit): Use CHECK_NO_ERRORS when calling
+       gcc_jit_context_compile_to_file.
+       * jit.dg/jit.exp (jit-dg-test): Update grep for rename of
+       jit-verify-compile-to-file to jit-verify-output-file-was-created.
+       (jit-setup-compile-to-file): Likewise.  Add a verbose comment
+       about deletions that are attempted.
+       (jit-verify-compile-to-file): Rename to...
+       (jit-verify-output-file-was-created): ...this, and drop the
+       attempt to run "file" and verify the output.
+       (jit-verify-assembler): New function.
+       (jit-verify-object): New function.
+       (jit-verify-dynamic-library): New function.
+       * jit.dg/test-compile-to-assembler.c (create_code): Eliminate in
+       favor of an implementation from new file
+       create-code-for-hello-world-executable.h, which also adds a
+       "main".
+       (dg-final): Replace jit-verify-compile-to-file with
+       jit-verify-output-file-was-created, and invoke new function
+       jit-verify-assembler.
+       * jit.dg/test-compile-to-dynamic-library.c (create_code): Clarify
+       the output message.
+       (dg-final): Replace jit-verify-compile-to-file with
+       jit-verify-output-file-was-created, and invoke new function
+       jit-verify-dynamic-library.
+       * jit.dg/test-compile-to-executable.c (create_code): Eliminate in
+       favor of an implementation from new file
+       create-code-for-hello-world-executable.h, which also adds a
+       "main".
+       (dg-final): Replace jit-verify-compile-to-file with
+       jit-verify-output-file-was-created.  Strengthen the expected stdout
+       from the built executable.
+       * jit.dg/test-compile-to-object.c (create_code): Eliminate in
+       favor of an implementation from new file
+       create-code-for-hello-world-executable.h, which also adds a
+       "main".
+       (dg-final): Replace jit-verify-compile-to-file with
+       jit-verify-output-file-was-created, and invoke new function
+       jit-verify-object.
+       * jit.dg/verify-dynamic-library.c: New source file.
+
 2015-02-06  Sebastian Pop  <s.pop@samsung.com>
            Brian Rzycki  <b.rzycki@samsung.com>
 
index a702a23a27b01ff981e32c2fd6f885813e666e2c..907da5620b1aa2418077349d65eb7ef9a494a8c3 100644 (file)
@@ -112,9 +112,9 @@ static char test[1024];
   do { \
     const char *err = gcc_jit_context_get_first_error (CTXT); \
     if (err) \
-      fail ("error unexpectedly occurred: %s", err); \
+      fail ("%s: %s: error unexpectedly occurred: %s", test, __func__, err); \
     else \
-      pass ("no errors occurred"); \
+      pass ("%s: %s: no errors occurred", test, __func__); \
   } while (0)
 
 /* Hooks that testcases should provide.  */
@@ -362,6 +362,7 @@ test_jit (const char *argv0, void *user_data)
   gcc_jit_context_compile_to_file (ctxt,
                                   (OUTPUT_KIND),
                                   (OUTPUT_FILENAME));
+  CHECK_NO_ERRORS (ctxt);
 #else /* #ifdef TEST_COMPILING_TO_FILE */
   /* This actually calls into GCC and runs the build, all
      in a mutex for now.  */
index c853f22addecdb802b6a3b03b1a02959e9dd9493..d13f6b5e19143ec5a0636386eb642e763eb9f739 100644 (file)
@@ -375,11 +375,10 @@ proc jit-dg-test { prog do_what extra_tool_flags } {
        append extra_tool_flags " -lpthread"
     }
 
-    # Any test case that uses
-    #   { dg-final { jit-verify-compile-to-file FOO } }
+    # Any test case that uses jit-verify-output-file-was-created
     # needs to call jit-setup-compile-to-file here.
     # (is there a better way to handle setup/finish pairs in dg?)
-    set tmp [grep $prog "jit-verify-compile-to-file"]
+    set tmp [grep $prog "jit-verify-output-file-was-created"]
     if {![string match "" $tmp]} {
        jit-setup-compile-to-file $prog
     }
@@ -601,7 +600,7 @@ proc jit-get-output-filename {prog} {
     return ""
 }
 
-# For testcases that use jit-verify-compile-to-file,
+# For testcases that use jit-verify-output-file-was-created
 # delete OUTPUT_FILENAME beforehand, to ensure that the
 # testcase is indeed creating it.
 
@@ -610,21 +609,13 @@ proc jit-setup-compile-to-file { prog } {
     set output_filename [jit-get-output-filename $prog]
     verbose "  output_filename: $output_filename"
     if {![string match "" $output_filename]} {
+       verbose "  deleting any $output_filename"
        catch "exec rm -f $output_filename"
     }
 }
 
-# Locate OUTPUT_FILENAME within the testcase.  Verify
-# that a file with that name was created, and that
-# the output of running the "file" utility on it
-# matches the given regex.
-# For use by the various test-compile-to-*.c testcases.
-
-proc jit-verify-compile-to-file {args} {
-    verbose "jit-verify-compile-to-file: $args"
-
-    set file_regex [lindex $args 0]
-    verbose "file_regex: $file_regex"
+proc jit-verify-output-file-was-created { args } {
+    verbose "jit-verify-output-file-was-created: $args"
 
     upvar 2 prog prog
     verbose "prog: $prog"
@@ -636,25 +627,7 @@ proc jit-verify-compile-to-file {args} {
        pass "$output_filename exists"
     } else {
        fail "$output_filename does not exist"
-       return
-    }
-
-    # Run "file" on OUTPUT_FILENAME, and verify that the output
-    # matches $file_regex.
-    spawn -noecho "file" $output_filename
-    set file_id $spawn_id
-    expect "\n" {
-       verbose "got newline: $expect_out(buffer)"
-       set classification $expect_out(buffer)
-       verbose "classification: $classification"
-       if { [regexp $file_regex $classification] } {
-           pass "'file' output on $output_filename matched: $file_regex"
-       } else {
-           fail "'file' output on $output_filename did not match: $file_regex"
-       }
     }
-    set $spawn_id $file_id
-    close
 }
 
 # Verify that the given file exists, and is executable.
@@ -709,6 +682,154 @@ proc jit-run-executable { args } {
     }
 }
 
+# Assuming that a .s file has been written out named
+# OUTPUT_FILENAME, invoke the driver to try to turn it into
+# an executable, and try to run the result.
+# For use by the test-compile-to-assembler.c testcase.
+proc jit-verify-assembler { args } {
+    verbose "jit-verify-assembler: $args"
+
+    set dg-output-text [lindex $args 0]
+    verbose "dg-output-text: ${dg-output-text}"
+
+    upvar 2 name name
+    verbose "name: $name"
+
+    upvar 2 prog prog
+    verbose "prog: $prog"
+    set asm_filename [jit-get-output-filename $prog]
+    verbose "  asm_filename: ${asm_filename}"
+
+    # Name the built executable as OUTPUT_FILENAME with
+    # ".exe" appended.
+    set executable_from_asm ${asm_filename}.exe
+    verbose "  executable_from_asm: ${executable_from_asm}"
+
+    # Invoke the driver to assemble/link the .s file to the .exe
+    set comp_output [gcc_target_compile \
+                        ${asm_filename} \
+                        ${executable_from_asm} \
+                        "executable" \
+                        "{}"]
+    if ![jit_check_compile \
+            "$name" \
+            "assemble/link of ${asm_filename}" \
+            ${executable_from_asm} \
+            $comp_output] then {
+      return
+    }
+
+    # Verify that the executable was created.
+    if { [file exists $executable_from_asm] == 1} {
+       pass "$executable_from_asm exists"
+    } else {
+       fail "$executable_from_asm does not exist"
+    }
+
+    # Run it and verify that the output matches the regex.
+    jit-run-executable ${executable_from_asm} ${dg-output-text}
+}
+
+# Assuming that a .o file has been written out named
+# OUTPUT_FILENAME, invoke the driver to try to turn it into
+# an executable, and try to run the result.
+# For use by the test-compile-to-object.c testcase.
+proc jit-verify-object { args } {
+    verbose "jit-verify-object: $args"
+
+    set dg-output-text [lindex $args 0]
+    verbose "dg-output-text: ${dg-output-text}"
+
+    upvar 2 name name
+    verbose "name: $name"
+
+    upvar 2 prog prog
+    verbose "prog: $prog"
+    set obj_filename [jit-get-output-filename $prog]
+    verbose "  obj_filename: ${obj_filename}"
+
+    # Name the linked executable as OUTPUT_FILENAME with
+    # ".exe" appended.
+    set executable_from_obj ${obj_filename}.exe
+    verbose "  executable_from_obj: ${executable_from_obj}"
+
+    # Invoke the driver to link the .o file to the .exe
+    set comp_output [gcc_target_compile \
+                        ${obj_filename} \
+                        ${executable_from_obj} \
+                        "executable" \
+                        "{}"]
+    if ![jit_check_compile \
+            "$name" \
+            "link of ${obj_filename}" \
+            ${executable_from_obj} \
+            $comp_output] then {
+      return
+    }
+
+    # Verify that the executable was created.
+    if { [file exists $executable_from_obj] == 1} {
+       pass "$executable_from_obj exists"
+    } else {
+       fail "$executable_from_obj does not exist"
+    }
+
+    # Run it and verify that the output matches the regex.
+    jit-run-executable ${executable_from_obj} ${dg-output-text}
+}
+
+# Assuming that a .so file has been written out named
+# OUTPUT_FILENAME, build a test executable to use it,
+# and try to run the result.
+# For use by the test-compile-to-dynamic-library.c testcase.
+proc jit-verify-dynamic-library { args } {
+    verbose "jit-verify-object: $args"
+
+    global srcdir
+    global subdir
+
+    set dg-output-text [lindex $args 0]
+    verbose "dg-output-text: ${dg-output-text}"
+
+    upvar 2 name name
+    verbose "name: $name"
+
+    upvar 2 prog prog
+    verbose "prog: $prog"
+    set obj_filename [jit-get-output-filename $prog]
+    verbose "  obj_filename: ${obj_filename}"
+
+    # Build a test executable from
+    # verify-dynamic-library.c
+    set test_src "verify-dynamic-library.c"
+    set test_executable ${test_src}.exe
+    verbose "  test_executable: ${test_executable}"
+
+    # Invoke the driver to build the test executable
+    set comp_output [gcc_target_compile \
+                        $srcdir/$subdir/${test_src} \
+                        ${test_executable} \
+                        "executable" \
+                        "{additional_flags=-ldl}"]
+    if ![jit_check_compile \
+            "$name" \
+            "build of ${test_executable}" \
+            ${test_executable} \
+            $comp_output] then {
+      return
+    }
+
+    # Verify that the test executable was created.
+    if { [file exists $test_executable] == 1} {
+       pass "$test_executable exists"
+    } else {
+       fail "$test_executable does not exist"
+    }
+
+    # Run it and verify that the output matches the regex.
+    jit-run-executable ${test_executable} ${dg-output-text}
+}
+
 # A way to invoke "jit-run-executable" with the given regex,
 # using OUTPUT_FILENAME within the testcase to determine
 # the name of the executable to run.
index c5b282c28704d46a511c991eb04feaf0238ec111..e3a6d2edd20898b0b2cd47e6a88ae6ac9724c7fa 100644 (file)
@@ -7,59 +7,7 @@
 #define OUTPUT_KIND      GCC_JIT_OUTPUT_KIND_ASSEMBLER
 #define OUTPUT_FILENAME  "output-of-test-compile-to-assembler.c.s"
 #include "harness.h"
+#include "create-code-for-hello-world-executable.h"
 
-void
-create_code (gcc_jit_context *ctxt, void *user_data)
-{
-  /* Let's try to inject the equivalent of:
-     void
-     hello_world (const char *name)
-     {
-       // a test comment
-       printf ("hello %s\n", name);
-     }
-  */
-  gcc_jit_type *void_type =
-    gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_VOID);
-  gcc_jit_type *const_char_ptr_type =
-    gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_CONST_CHAR_PTR);
-  gcc_jit_param *param_name =
-    gcc_jit_context_new_param (ctxt, NULL, const_char_ptr_type, "name");
-  gcc_jit_function *func =
-    gcc_jit_context_new_function (ctxt, NULL,
-                                 GCC_JIT_FUNCTION_EXPORTED,
-                                 void_type,
-                                 "hello_world",
-                                 1, &param_name,
-                                 0);
-
-  gcc_jit_param *param_format =
-    gcc_jit_context_new_param (ctxt, NULL, const_char_ptr_type, "format");
-  gcc_jit_function *printf_func =
-    gcc_jit_context_new_function (ctxt, NULL,
-                                 GCC_JIT_FUNCTION_IMPORTED,
-                                 gcc_jit_context_get_type (
-                                    ctxt, GCC_JIT_TYPE_INT),
-                                 "printf",
-                                 1, &param_format,
-                                 1);
-  gcc_jit_rvalue *args[2];
-  args[0] = gcc_jit_context_new_string_literal (ctxt, "hello %s\n");
-  args[1] = gcc_jit_param_as_rvalue (param_name);
-
-  gcc_jit_block *block = gcc_jit_function_new_block (func, NULL);
-
-  gcc_jit_block_add_comment (
-    block, NULL,
-    "a test comment");
-
-  gcc_jit_block_add_eval (
-    block, NULL,
-    gcc_jit_context_new_call (ctxt,
-                             NULL,
-                             printf_func,
-                             2, args));
-  gcc_jit_block_end_with_void_return (block, NULL);
-}
-
-/* { dg-final { jit-verify-compile-to-file "assembler source text" } } */
+/* { dg-final { jit-verify-output-file-was-created "" } } */
+/* { dg-final { jit-verify-assembler "hello from ./output-of-test-compile-to-assembler.c.s.exe" } } */
index 095f75127f3cf5963fa38e418da421f3d41e7c79..c29e6f6d6289b0e209e21afa6d47e9f8f6123b20 100644 (file)
@@ -16,7 +16,7 @@ create_code (gcc_jit_context *ctxt, void *user_data)
      hello_world (const char *name)
      {
        // a test comment
-       printf ("hello %s\n", name);
+       printf ("hello from %s\n", name);
      }
   */
   gcc_jit_type *void_type =
@@ -44,7 +44,7 @@ create_code (gcc_jit_context *ctxt, void *user_data)
                                  1, &param_format,
                                  1);
   gcc_jit_rvalue *args[2];
-  args[0] = gcc_jit_context_new_string_literal (ctxt, "hello %s\n");
+  args[0] = gcc_jit_context_new_string_literal (ctxt, "hello from %s\n");
   args[1] = gcc_jit_param_as_rvalue (param_name);
 
   gcc_jit_block *block = gcc_jit_function_new_block (func, NULL);
@@ -62,4 +62,5 @@ create_code (gcc_jit_context *ctxt, void *user_data)
   gcc_jit_block_end_with_void_return (block, NULL);
 }
 
-/* { dg-final { jit-verify-compile-to-file "shared object.+dynamically linked" } } */
+/* { dg-final { jit-verify-output-file-was-created "" } } */
+/* { dg-final { jit-verify-dynamic-library "hello from ./verify-dynamic-library.c.exe" } } */
index 8d7b428b89f3ba0b607d459a5e773ca8b4a5c43d..2fb0bd91cc927637dcf3531474bf3511bd1e3d5e 100644 (file)
@@ -7,104 +7,7 @@
 #define OUTPUT_KIND      GCC_JIT_OUTPUT_KIND_EXECUTABLE
 #define OUTPUT_FILENAME  "output-of-test-compile-to-executable.c.exe"
 #include "harness.h"
+#include "create-code-for-hello-world-executable.h"
 
-void
-create_code (gcc_jit_context *ctxt, void *user_data)
-{
-  /* Let's try to inject the equivalent of:
-     static void
-     hello_world (const char *name)
-     {
-       // a test comment
-       printf ("hello %s\n", name);
-     }
-
-     extern int
-     main (int argc, char **argv)
-     {
-       hello_world (argv[0]);
-       return 0;
-     }
-  */
-  gcc_jit_type *void_type =
-    gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_VOID);
-  gcc_jit_type *const_char_ptr_type =
-    gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_CONST_CHAR_PTR);
-  gcc_jit_param *param_name =
-    gcc_jit_context_new_param (ctxt, NULL, const_char_ptr_type, "name");
-  gcc_jit_function *func =
-    gcc_jit_context_new_function (ctxt, NULL,
-                                 GCC_JIT_FUNCTION_INTERNAL,
-                                 void_type,
-                                 "hello_world",
-                                 1, &param_name,
-                                 0);
-
-  gcc_jit_param *param_format =
-    gcc_jit_context_new_param (ctxt, NULL, const_char_ptr_type, "format");
-  gcc_jit_function *printf_func =
-    gcc_jit_context_new_function (ctxt, NULL,
-                                 GCC_JIT_FUNCTION_IMPORTED,
-                                 gcc_jit_context_get_type (
-                                    ctxt, GCC_JIT_TYPE_INT),
-                                 "printf",
-                                 1, &param_format,
-                                 1);
-  gcc_jit_rvalue *args[2];
-  args[0] = gcc_jit_context_new_string_literal (ctxt, "hello %s\n");
-  args[1] = gcc_jit_param_as_rvalue (param_name);
-
-  gcc_jit_block *block = gcc_jit_function_new_block (func, NULL);
-
-  gcc_jit_block_add_comment (
-    block, NULL,
-    "a test comment");
-
-  gcc_jit_block_add_eval (
-    block, NULL,
-    gcc_jit_context_new_call (ctxt,
-                             NULL,
-                             printf_func,
-                             2, args));
-  gcc_jit_block_end_with_void_return (block, NULL);
-
-  gcc_jit_type *int_type = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT);
-  gcc_jit_param *param_argc =
-    gcc_jit_context_new_param (ctxt, NULL, int_type, "argc");
-  gcc_jit_type *char_ptr_ptr_type =
-    gcc_jit_type_get_pointer (
-      gcc_jit_type_get_pointer (
-       gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_CHAR)));
-  gcc_jit_param *param_argv =
-    gcc_jit_context_new_param (ctxt, NULL, char_ptr_ptr_type, "argv");
-  gcc_jit_param *params[2] = {param_argc, param_argv};
-  gcc_jit_function *func_main =
-    gcc_jit_context_new_function (ctxt, NULL,
-                                 GCC_JIT_FUNCTION_EXPORTED,
-                                 int_type,
-                                 "main",
-                                 2, params,
-                                 0);
-  block = gcc_jit_function_new_block (func_main, NULL);
-  gcc_jit_rvalue *zero = gcc_jit_context_zero (ctxt, int_type);
-  args[0] = gcc_jit_context_new_cast (
-       ctxt,
-       NULL,
-       gcc_jit_lvalue_as_rvalue (
-         gcc_jit_context_new_array_access (
-           ctxt,
-           NULL,
-           gcc_jit_param_as_rvalue (param_argv),
-           zero)),
-       const_char_ptr_type);
-  gcc_jit_block_add_eval (
-    block, NULL,
-    gcc_jit_context_new_call (ctxt,
-                             NULL,
-                             func,
-                             1, args));
-  gcc_jit_block_end_with_return (block, NULL, zero);
-}
-
-/* { dg-final { jit-verify-compile-to-file "executable" } } */
-/* { dg-final { jit-verify-executable "hello .*" } } */
+/* { dg-final { jit-verify-output-file-was-created "" } } */
+/* { dg-final { jit-verify-executable "hello from ./output-of-test-compile-to-executable.c.exe" } } */
index 1f7fcc6e549ae6a073018fbd43f0cc3b4550114a..81d41c21d4027db26f03c88e118a1986eb13e0b9 100644 (file)
@@ -7,59 +7,7 @@
 #define OUTPUT_KIND      GCC_JIT_OUTPUT_KIND_OBJECT_FILE
 #define OUTPUT_FILENAME  "output-of-test-compile-to-object.c.o"
 #include "harness.h"
+#include "create-code-for-hello-world-executable.h"
 
-void
-create_code (gcc_jit_context *ctxt, void *user_data)
-{
-  /* Let's try to inject the equivalent of:
-     void
-     hello_world (const char *name)
-     {
-       // a test comment
-       printf ("hello %s\n", name);
-     }
-  */
-  gcc_jit_type *void_type =
-    gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_VOID);
-  gcc_jit_type *const_char_ptr_type =
-    gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_CONST_CHAR_PTR);
-  gcc_jit_param *param_name =
-    gcc_jit_context_new_param (ctxt, NULL, const_char_ptr_type, "name");
-  gcc_jit_function *func =
-    gcc_jit_context_new_function (ctxt, NULL,
-                                 GCC_JIT_FUNCTION_EXPORTED,
-                                 void_type,
-                                 "hello_world",
-                                 1, &param_name,
-                                 0);
-
-  gcc_jit_param *param_format =
-    gcc_jit_context_new_param (ctxt, NULL, const_char_ptr_type, "format");
-  gcc_jit_function *printf_func =
-    gcc_jit_context_new_function (ctxt, NULL,
-                                 GCC_JIT_FUNCTION_IMPORTED,
-                                 gcc_jit_context_get_type (
-                                    ctxt, GCC_JIT_TYPE_INT),
-                                 "printf",
-                                 1, &param_format,
-                                 1);
-  gcc_jit_rvalue *args[2];
-  args[0] = gcc_jit_context_new_string_literal (ctxt, "hello %s\n");
-  args[1] = gcc_jit_param_as_rvalue (param_name);
-
-  gcc_jit_block *block = gcc_jit_function_new_block (func, NULL);
-
-  gcc_jit_block_add_comment (
-    block, NULL,
-    "a test comment");
-
-  gcc_jit_block_add_eval (
-    block, NULL,
-    gcc_jit_context_new_call (ctxt,
-                             NULL,
-                             printf_func,
-                             2, args));
-  gcc_jit_block_end_with_void_return (block, NULL);
-}
-
-/* { dg-final { jit-verify-compile-to-file "relocatable" } } */
+/* { dg-final { jit-verify-output-file-was-created "" } } */
+/* { dg-final { jit-verify-object "hello from ./output-of-test-compile-to-object.c.o.exe" } } */