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

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