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

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