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

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