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

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