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

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