+2017-10-13  Pedro Alves  <palves@redhat.com>
+
+       * gdb.base/corefile.exp (corefile_test_run): Skip if gdb_protocol
+       is set.
+       (corefile_test_attach): Likewise.  Check can_spawn_for_attach
+       instead of is_remote.
+
 2017-10-13  Pedro Alves  <palves@redhat.com>
 
        * gdb.base/remote.exp: Check gdb_protocol instead of is_remote.
 
 proc corefile_test_run {} {
     global corefile gdb_prompt
 
+    # This test is trying to check whether the "run" command finds the
+    # default run target when already debugging a core, so it would
+    # fail on boards that set auto-connect-native-target off.  Since
+    # there's no real point in running the test but with the native
+    # target, it's easier to just skip elsewhere.
+    if {[target_info gdb_protocol] != ""} {
+       return
+    }
+
     gdb_test "core-file $corefile" "Core was generated by .*" "run: load core again"
     gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "run: sanity check we see the core file"
 
 proc corefile_test_attach {} {
     global binfile corefile gdb_prompt
 
-    if ![is_remote target] {
+    # This test is checking whether the "attach" command finds the
+    # default run target when already debugging a core, so it would
+    # fail on boards that set auto-connect-native-target off.  Since
+    # there's no real point in running the test but with the native
+    # target, it's easier to just skip elsewhere.
+    if {[target_info gdb_protocol] != ""} {
+       return
+    }
+
+    if [can_spawn_for_attach] {
        set test "attach: spawn sleep"
        set res [remote_spawn host "$binfile sleep"]
        if { $res < 0 || $res == "" } {