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

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