Blame SOURCES/gdb-6.3-test-movedir-20050125.patch

b94e32
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
b94e32
From: Elena Zannoni <ezannoni@redhat.com>
b94e32
Date: Fri, 27 Oct 2017 21:07:50 +0200
b94e32
Subject: gdb-6.3-test-movedir-20050125.patch
b94e32
b94e32
;; Fix to support executable moving
b94e32
;;=fedoratest
b94e32
b94e32
2005-01-25  Elena Zannoni  <ezannoni@redhat.com>
b94e32
b94e32
        * gdb.base/move-dir.exp: New test.
b94e32
        * gdb.base/move-dir.c: Ditto.
b94e32
        * gdb.base/move-dir.h: Ditto.
b94e32
b94e32
diff --git a/gdb/testsuite/gdb.base/move-dir.c b/gdb/testsuite/gdb.base/move-dir.c
b94e32
new file mode 100644
b94e32
--- /dev/null
b94e32
+++ b/gdb/testsuite/gdb.base/move-dir.c
b94e32
@@ -0,0 +1,9 @@
b94e32
+#include <stdio.h>
b94e32
+#include <stdlib.h>
b94e32
+#include "move-dir.h"
b94e32
+
b94e32
+int main() {
b94e32
+   const char* hw = "hello world.";
b94e32
+   printf ("%s\n", hw);;
b94e32
+   other();
b94e32
+}
b94e32
diff --git a/gdb/testsuite/gdb.base/move-dir.exp b/gdb/testsuite/gdb.base/move-dir.exp
b94e32
new file mode 100644
b94e32
--- /dev/null
b94e32
+++ b/gdb/testsuite/gdb.base/move-dir.exp
b94e32
@@ -0,0 +1,57 @@
b94e32
+#   Copyright 2005
b94e32
+#   Free Software Foundation, Inc.
b94e32
+
b94e32
+# This program is free software; you can redistribute it and/or modify
b94e32
+# it under the terms of the GNU General Public License as published by
b94e32
+# the Free Software Foundation; either version 2 of the License, or
b94e32
+# (at your option) any later version.
b94e32
+#
b94e32
+# This program is distributed in the hope that it will be useful,
b94e32
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
b94e32
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b94e32
+# GNU General Public License for more details.
b94e32
+#
b94e32
+# You should have received a copy of the GNU General Public License
b94e32
+# along with this program; if not, write to the Free Software
b94e32
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
b94e32
+
b94e32
+set testfile "move-dir"
b94e32
+set srcfile ${testfile}.c
b94e32
+set incfile ${testfile}.h
b94e32
+set binfile [standard_output_file ${testfile}]
b94e32
+
b94e32
+set testdir [standard_output_file incdir]
b94e32
+
b94e32
+remote_exec build "mkdir $testdir"
b94e32
+remote_exec build "cp ${srcdir}/${subdir}/${srcfile} [standard_output_file ${srcfile}]"
b94e32
+remote_exec build "cp ${srcdir}/${subdir}/${incfile} [standard_output_file ${incfile}]"
b94e32
+
b94e32
+set additional_flags "additional_flags=-I${subdir}/incdir"
b94e32
+
b94e32
+if  { [gdb_compile [standard_output_file ${srcfile}] "${binfile}" executable [list debug $additional_flags]] != "" } {
b94e32
+    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
b94e32
+}
b94e32
+
b94e32
+# Create and source the file that provides information about the compiler
b94e32
+# used to compile the test case.
b94e32
+
b94e32
+if [get_compiler_info ${binfile}] {
b94e32
+    return -1;
b94e32
+}
b94e32
+
b94e32
+
b94e32
+set oldtimeout $timeout
b94e32
+set timeout [expr "$timeout + 60"]
b94e32
+
b94e32
+# Start with a fresh gdb.
b94e32
+
b94e32
+gdb_exit
b94e32
+gdb_start
b94e32
+gdb_test "cd ../.." "" ""
b94e32
+gdb_load ${binfile}
b94e32
+gdb_test "list main" ".*hw.*other.*" "found main"
b94e32
+gdb_test "list other" ".*ostring.*" "found include file"
b94e32
+
b94e32
+
b94e32
+set timeout $oldtimeout
b94e32
+return 0
b94e32
diff --git a/gdb/testsuite/gdb.base/move-dir.h b/gdb/testsuite/gdb.base/move-dir.h
b94e32
new file mode 100644
b94e32
--- /dev/null
b94e32
+++ b/gdb/testsuite/gdb.base/move-dir.h
b94e32
@@ -0,0 +1,6 @@
b94e32
+#include <stdlib.h>
b94e32
+
b94e32
+void other() {
b94e32
+  const char* ostring = "other";
b94e32
+  printf ("%s\n", ostring);;
b94e32
+}