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

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