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

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