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

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