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

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