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

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