On 01/07/15 13:16, Tom de Vries wrote:
Hi,

testcase libgomp.oacc-c-c++-common/lib-3.c is supposed to fail.

It fails currently in two ways:
- no device found, if there is no nonhost device type supported, so
   just host and host_nonshm
- no device initialized, if there is a nonhost device type supported,
   f.i. nvidia

The reason for the different failure modes is the usage of
acc_device_not_host.

Neither of the current failure modes is matches by the current dg-output:
...
/* { dg-output "device \[0-9\]+\\\(\[0-9\]+\\\) is initialized" } */
...
I don't understand what this dg-output is trying to achieve.

Attached patch makes sure that both current failure modes are tested and
accepted.

OK for gomp-4_0-branch?


Ping.

Thanks,
- Tom

0003-Fix-libgomp.oacc-c-c-common-lib-3.c.patch


Fix libgomp.oacc-c-c++-common/lib-3.c

2015-07-01  Tom de Vries<t...@codesourcery.com>

        * testsuite/lib/libgomp.exp (offload_targets_nonhost): New var.
        (check_effective_target_offload_target_nonhost_supported): New proc.
        * testsuite/libgomp.oacc-c-c++-common/lib-3.c: Only run if
        offload_target_nonhost_supported.
        * testsuite/libgomp.oacc-c-c++-common/lib-3b.c: New test.  Copy of
        lib-3.c, but only run if !offload_target_nonhost_supported.
---
  libgomp/testsuite/lib/libgomp.exp                    | 13 +++++++++++++
  libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c  |  4 ++--
  libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3b.c | 16 ++++++++++++++++
  3 files changed, 31 insertions(+), 2 deletions(-)
  create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3b.c

diff --git a/libgomp/testsuite/lib/libgomp.exp 
b/libgomp/testsuite/lib/libgomp.exp
index 6dba22b..951e043 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -38,9 +38,11 @@ load_file libgomp-test-support.exp
  # Populate offload_targets_s (offloading targets separated by a space), and
  # offload_targets_s_openacc (the same, but with OpenACC names; OpenACC spells
  # some of them a little differently).
+set offload_targets_nonhost 0
  set offload_targets_s [split $offload_targets ","]
  set offload_targets_s_openacc {}
  foreach offload_target_openacc $offload_targets_s {
+    set nonhost 1
      switch $offload_target_openacc {
        intelmic {
            # TODO.  Skip; will all FAIL because of missing
@@ -50,8 +52,14 @@ foreach offload_target_openacc $offload_targets_s {
        nvptx {
            set offload_target_openacc "nvidia"
        }
+       host_nonshm {
+           set nonhost 0
+       }
      }
      lappend offload_targets_s_openacc "$offload_target_openacc"
+    if { $nonhost == 1 } {
+       set offload_targets_nonhost 1
+    }
  }
  lappend offload_targets_s_openacc "host"

@@ -369,6 +377,11 @@ proc check_effective_target_offload_device { } {
      } ]
  }

+proc check_effective_target_offload_target_nonhost_supported { } {
+    global offload_targets_nonhost
+    return $offload_targets_nonhost;
+}
+
  proc check_effective_target_openacc_nvidia_accel_supported { } {
      global offload_targets_s_openacc
      set res [lsearch $offload_targets_s_openacc "nvidia" ]
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c 
b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c
index bb76c82..2a8c437 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-do run { target { offload_target_nonhost_supported } } } */

  #include <openacc.h>

@@ -12,5 +12,5 @@ main (int argc, char **argv)
    return 0;
  }

-/* { dg-output "device \[0-9\]+\\\(\[0-9\]+\\\) is initialized" } */
+/* { dg-output "no device initialized" } */
  /* { dg-shouldfail "" } */
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3b.c 
b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3b.c
new file mode 100644
index 0000000..f21830c
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3b.c
@@ -0,0 +1,16 @@
+/* { dg-do run { target { ! offload_target_nonhost_supported } } } */
+
+#include <openacc.h>
+
+int
+main (int argc, char **argv)
+{
+  acc_init (acc_device_host);
+
+  acc_shutdown (acc_device_not_host);
+
+  return 0;
+}
+
+/* { dg-output "no device found" } */
+/* { dg-shouldfail "" } */
-- 1.9.1


Reply via email to