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

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