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

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