Blame SOURCES/gdb-6.7-testsuite-stable-results.patch

b94e32
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
b94e32
From: Jan Kratochvil <jan.kratochvil@redhat.com>
b94e32
Date: Fri, 27 Oct 2017 21:07:50 +0200
b94e32
Subject: gdb-6.7-testsuite-stable-results.patch
b94e32
b94e32
;; Testsuite fixes for more stable/comparable results.
b94e32
;;=fedoratest
b94e32
b94e32
gdb/testsuite/gdb.base/fileio.c:
b94e32
gdb/testsuite/gdb.base/fileio.exp:
b94e32
2007-12-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
b94e32
b94e32
	* gdb.base/fileio.c (ROOTSUBDIR): New macro.
b94e32
	(main): CHDIR into ROOTSUBDIR.  CHOWN ROOTSUBDIR and CHDIR into
b94e32
	ROOTSUBDIR if we are being run as root.
b94e32
	* gdb.base/fileio.exp: Change the startup and finish cleanup.
b94e32
	Change the test file reference to be into the `fileio.dir' directory.
b94e32
b94e32
sources/gdb/testsuite/gdb.base/dump.exp:
b94e32
Found on RHEL-5.s390x.
b94e32
b94e32
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/auxv.exp:
b94e32
random FAIL: gdb.base/auxv.exp: matching auxv data from live and gcore
b94e32
b94e32
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp:
b94e32
frames-invalid can happen asynchronously.
b94e32
b94e32
diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c
b94e32
--- a/gdb/testsuite/gdb.base/fileio.c
b94e32
+++ b/gdb/testsuite/gdb.base/fileio.c
b94e32
@@ -559,6 +559,28 @@ strerrno (int err)
b94e32
 int
b94e32
 main ()
b94e32
 {
b94e32
+  /* These tests
b94e32
+       Open for write but no write permission returns EACCES
b94e32
+       Unlinking a file in a directory w/o write access returns EACCES
b94e32
+     fail if we are being run as root - drop the privileges here.  */
b94e32
+
b94e32
+  if (geteuid () == 0)
b94e32
+    {
b94e32
+      uid_t uid = 99;
b94e32
+
b94e32
+      if (chown (OUTDIR, uid, uid) != 0)
b94e32
+	{
b94e32
+	  printf ("chown %d.%d %s: %s\n", (int) uid, (int) uid,
b94e32
+		  OUTDIR, strerror (errno));
b94e32
+	  exit (1);
b94e32
+	}
b94e32
+      if (setuid (uid) || geteuid () == 0)
b94e32
+	{
b94e32
+	  printf ("setuid %d: %s\n", (int) uid, strerror (errno));
b94e32
+	  exit (1);
b94e32
+	}
b94e32
+    }
b94e32
+
b94e32
   /* Don't change the order of the calls.  They partly depend on each other */
b94e32
   test_open ();
b94e32
   test_write ();
b94e32
diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp
b94e32
--- a/gdb/testsuite/gdb.base/fileio.exp
b94e32
+++ b/gdb/testsuite/gdb.base/fileio.exp
b94e32
@@ -24,9 +24,9 @@ if [target_info exists gdb,nofileio] {
b94e32
 standard_testfile
b94e32
 
b94e32
 if {[is_remote host]} {
b94e32
-    set outdir .
b94e32
+    set outdir "fileio.dir"
b94e32
 } else {
b94e32
-    set outdir [standard_output_file {}]
b94e32
+    set outdir [standard_output_file "fileio.dir"]
b94e32
 }
b94e32
 
b94e32
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
b94e32
@@ -47,7 +47,8 @@ set dir2 [standard_output_file dir2.fileio.test]
b94e32
 if {[file exists $dir2] && ![file writable $dir2]} {
b94e32
     system "chmod +w $dir2"
b94e32
 }
b94e32
-system "rm -rf [standard_output_file *.fileio.test]"
b94e32
+system "rm -rf [standard_output_file fileio.dir]"
b94e32
+system "mkdir -m777 [standard_output_file fileio.dir]"
b94e32
 
b94e32
 set oldtimeout $timeout
b94e32
 set timeout [expr "$timeout + 60"]
b94e32
@@ -89,7 +90,7 @@ gdb_test continue \
b94e32
 
b94e32
 gdb_test "continue" ".*" ""
b94e32
 
b94e32
-catch "system \"chmod -f -w [standard_output_file nowrt.fileio.test]\""
b94e32
+catch "system \"chmod -f -w [standard_output_file fileio.dir/nowrt.fileio.test]\""
b94e32
 
b94e32
 gdb_test continue \
b94e32
 "Continuing\\..*open 5:.*EACCES$stop_msg" \
b94e32
@@ -276,9 +277,7 @@ gdb_test continue \
b94e32
 gdb_exit
b94e32
 
b94e32
 # Make dir2 writable again so rm -rf of a build tree Just Works.
b94e32
-if {[file exists $dir2] && ![file writable $dir2]} {
b94e32
-    system "chmod +w $dir2"
b94e32
-}
b94e32
+system "chmod -R +w $outdir"
b94e32
 
b94e32
 set timeout $oldtimeout
b94e32
 return 0