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

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