MIPS: run tst-mode-switch-{1,2,3}.c using test-skeleton.c

Message ID 1467039612-6050-1-git-send-email-aurelien@aurel32.net
State New, archived
Headers

Commit Message

Aurelien Jarno June 27, 2016, 3 p.m. UTC
  For some reasons I have not investigated yet, tst-mode-switch-1 hangs on
a MIPS UTM-8 machine running an o32 userland and a 3.6.1 kernel.

This patch changes the test so that it runs under the test-skeleton
framework, causing the test to fail after a timeout instead of hanging
the whole testsuite. At the same time, also change the tst-mode-switch-2
and tst-mode-switch-3 tests.

Changelog:
	* sysdeps/mips/tst-mode-switch-1.c (main): Converted to ...
	(do_test): ... this.
	(TEST_FUNCTION): New macro.
	 Include test-skeleton.c.
	* sysdeps/mips/tst-mode-switch-2.c (main): Likewise.
	* sysdeps/mips/tst-mode-switch-3.c (main): Likewise.
---
 ChangeLog                        | 9 +++++++++
 sysdeps/mips/tst-mode-switch-1.c | 5 ++++-
 sysdeps/mips/tst-mode-switch-2.c | 5 ++++-
 sysdeps/mips/tst-mode-switch-3.c | 5 ++++-
 4 files changed, 21 insertions(+), 3 deletions(-)
  

Comments

Joseph Myers June 27, 2016, 3:51 p.m. UTC | #1
On Mon, 27 Jun 2016, Aurelien Jarno wrote:

> For some reasons I have not investigated yet, tst-mode-switch-1 hangs on
> a MIPS UTM-8 machine running an o32 userland and a 3.6.1 kernel.
> 
> This patch changes the test so that it runs under the test-skeleton
> framework, causing the test to fail after a timeout instead of hanging
> the whole testsuite. At the same time, also change the tst-mode-switch-2
> and tst-mode-switch-3 tests.

OK with do_test made static in all three tests (unless there's some reason 
it can't be made static).
  
Aurelien Jarno June 27, 2016, 4 p.m. UTC | #2
On 2016-06-27 15:51, Joseph Myers wrote:
> On Mon, 27 Jun 2016, Aurelien Jarno wrote:
> 
> > For some reasons I have not investigated yet, tst-mode-switch-1 hangs on
> > a MIPS UTM-8 machine running an o32 userland and a 3.6.1 kernel.
> > 
> > This patch changes the test so that it runs under the test-skeleton
> > framework, causing the test to fail after a timeout instead of hanging
> > the whole testsuite. At the same time, also change the tst-mode-switch-2
> > and tst-mode-switch-3 tests.
> 
> OK with do_test made static in all three tests (unless there's some reason 
> it can't be made static).

Good catch, there is not reason it could not be made static. I'll change
that before committing.
  
Maciej W. Rozycki July 13, 2016, 6:11 p.m. UTC | #3
On Mon, 27 Jun 2016, Aurelien Jarno wrote:

> For some reasons I have not investigated yet, tst-mode-switch-1 hangs on
> a MIPS UTM-8 machine running an o32 userland and a 3.6.1 kernel.
> 
> This patch changes the test so that it runs under the test-skeleton
> framework, causing the test to fail after a timeout instead of hanging
> the whole testsuite. At the same time, also change the tst-mode-switch-2
> and tst-mode-switch-3 tests.

 FWIW I've noticed that too, with o32 and Linux 4.6.0-rc7.  As I found the 
hang quite annoying I made and have been using a similar change locally, 
albeit to `tst-mode-switch-1' only, which I didn't get to submitting as I 
got distracted with other stuff.

 Interestingly enough the lone switch to running under the skeleton made 
the hang go away for me entirely -- the test started succeeding rather 
than hitting the skeleton's timeout.  So I guess there's a race somewhere 
leading to a deadlock or suchlike, and by hiding the failure this way we 
may be making it more difficult to notice, let alone encourage someone to 
actually fix it.

 This was on an UP machine BTW, so the recent fix to prctl(2) (Linux 
commit 6b8322576e9d ("MIPS: Force CPUs to lose FP context during mode 
switches")) to use an IPI on MP configurations isn't supposed to apply. 
I've tried running the test case both without and with the fix applied 
anyway, just to make sure it indeed does not change anything, and -- as 
expected -- there was no change whatsoever.

  Maciej
  

Patch

diff --git a/ChangeLog b/ChangeLog
index 0847c8d..571333f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@ 
+2016-06-27  Aurelien Jarno  <aurelien@aurel32.net>
+
+	* sysdeps/mips/tst-mode-switch-1.c (main): Converted to ...
+	(do_test): ... this.
+	(TEST_FUNCTION): New macro.
+	 Include test-skeleton.c.
+	* sysdeps/mips/tst-mode-switch-2.c (main): Likewise.
+	* sysdeps/mips/tst-mode-switch-3.c (main): Likewise.
+
 2016-06-21  Aurelien Jarno  <aurelien@aurel32.net>
 
 	* sysdeps/unix/sysv/linux/mips/vfork.S (__vfork): Rename into
diff --git a/sysdeps/mips/tst-mode-switch-1.c b/sysdeps/mips/tst-mode-switch-1.c
index 1a26e4c..24e6f25 100644
--- a/sysdeps/mips/tst-mode-switch-1.c
+++ b/sysdeps/mips/tst-mode-switch-1.c
@@ -72,7 +72,7 @@  thread_function (void * arg __attribute__ ((unused)))
 }
 
 int
-main (void)
+do_test (void)
 {
   int count = sysconf (_SC_NPROCESSORS_ONLN);
   if (count <= 0)
@@ -121,3 +121,6 @@  main (void)
 
   return result;
 }
+
+#define TEST_FUNCTION do_test ()
+#include "../../test-skeleton.c"
diff --git a/sysdeps/mips/tst-mode-switch-2.c b/sysdeps/mips/tst-mode-switch-2.c
index b41acf4..f4be2c4 100644
--- a/sysdeps/mips/tst-mode-switch-2.c
+++ b/sysdeps/mips/tst-mode-switch-2.c
@@ -78,7 +78,7 @@  thread_function (void * arg __attribute__ ((unused)))
 }
 
 int
-main (void)
+do_test (void)
 {
   int count = sysconf (_SC_NPROCESSORS_ONLN);
   if (count <= 0)
@@ -161,3 +161,6 @@  main (void)
 
   return result;
 }
+
+#define TEST_FUNCTION do_test ()
+#include "../../test-skeleton.c"
diff --git a/sysdeps/mips/tst-mode-switch-3.c b/sysdeps/mips/tst-mode-switch-3.c
index 65e2b5e..02f7a43 100644
--- a/sysdeps/mips/tst-mode-switch-3.c
+++ b/sysdeps/mips/tst-mode-switch-3.c
@@ -44,7 +44,7 @@  float check1 = 2.0;
 double check2 = 3.0;
 
 int
-main (void)
+do_test (void)
 {
   int i;
   int result = 0;
@@ -88,3 +88,6 @@  main (void)
 
   return result;
 }
+
+#define TEST_FUNCTION do_test ()
+#include "../../test-skeleton.c"