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

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