[5/7] nptl/tst-rwlock14: Test pthread/rwlock_timedwrlock correctly
diff mbox series

Message ID 5b1b47a18bf6296b635badfeb7b4d1e1c5225340.1551291557.git-series.mac@mcrowe.com
State New
Headers show
Series
  • Implement proposed POSIX _clockwait variants of existing _timedwait functions
Related show

Commit Message

Mike Crowe Feb. 27, 2019, 6:23 p.m. UTC
The tests for out-of-bounds timespecs first test pthread_rwlock_timedrdlock
and then pthread_rwlock_timedwrlock. It appears that the second and third
tests suffered from copy-and-paste errors and each test
pthread_rwlock_timedrdlock twice in a row. Let's correct that so that
pthread_rwlock_timedwrlock is tested too.
---
 nptl/tst-rwlock14.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Adhemerval Zanella March 5, 2019, 5:36 p.m. UTC | #1
On 27/02/2019 15:23, Mike Crowe wrote:
> The tests for out-of-bounds timespecs first test pthread_rwlock_timedrdlock
> and then pthread_rwlock_timedwrlock. It appears that the second and third
> tests suffered from copy-and-paste errors and each test
> pthread_rwlock_timedrdlock twice in a row. Let's correct that so that
> pthread_rwlock_timedwrlock is tested too.

This patch looks ok and it should be pushed upstream independently of the
patchset. It also requires a propor ChangeLog.

> ---
>  nptl/tst-rwlock14.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/nptl/tst-rwlock14.c b/nptl/tst-rwlock14.c
> index f8c2183..6f57169 100644
> --- a/nptl/tst-rwlock14.c
> +++ b/nptl/tst-rwlock14.c
> @@ -117,15 +117,15 @@ do_test (void)
>        result = 1;
>      }
>  
> -  e = pthread_rwlock_timedrdlock (&r, &ts);
> +  e = pthread_rwlock_timedwrlock (&r, &ts);
>    if (e == 0)
>      {
> -      puts ("second rwlock_timedrdlock did not fail");
> +      puts ("second rwlock_timedwrlock did not fail");
>        result = 1;
>      }
>    else if (e != EINVAL)
>      {
> -      puts ("second rwlock_timedrdlock did not return EINVAL");
> +      puts ("second rwlock_timedwrlock did not return EINVAL");
>        result = 1;
>      }
>  
> @@ -145,15 +145,15 @@ do_test (void)
>        result = 1;
>      }
>  
> -  e = pthread_rwlock_timedrdlock (&r, &ts);
> +  e = pthread_rwlock_timedwrlock (&r, &ts);
>    if (e == 0)
>      {
> -      puts ("third rwlock_timedrdlock did not fail");
> +      puts ("third rwlock_timedwrlock did not fail");
>        result = 1;
>      }
>    else if (e != EINVAL)
>      {
> -      puts ("third rwlock_timedrdlock did not return EINVAL");
> +      puts ("third rwlock_timedwrlock did not return EINVAL");
>        result = 1;
>      }
>  
>

Patch
diff mbox series

diff --git a/nptl/tst-rwlock14.c b/nptl/tst-rwlock14.c
index f8c2183..6f57169 100644
--- a/nptl/tst-rwlock14.c
+++ b/nptl/tst-rwlock14.c
@@ -117,15 +117,15 @@  do_test (void)
       result = 1;
     }
 
-  e = pthread_rwlock_timedrdlock (&r, &ts);
+  e = pthread_rwlock_timedwrlock (&r, &ts);
   if (e == 0)
     {
-      puts ("second rwlock_timedrdlock did not fail");
+      puts ("second rwlock_timedwrlock did not fail");
       result = 1;
     }
   else if (e != EINVAL)
     {
-      puts ("second rwlock_timedrdlock did not return EINVAL");
+      puts ("second rwlock_timedwrlock did not return EINVAL");
       result = 1;
     }
 
@@ -145,15 +145,15 @@  do_test (void)
       result = 1;
     }
 
-  e = pthread_rwlock_timedrdlock (&r, &ts);
+  e = pthread_rwlock_timedwrlock (&r, &ts);
   if (e == 0)
     {
-      puts ("third rwlock_timedrdlock did not fail");
+      puts ("third rwlock_timedwrlock did not fail");
       result = 1;
     }
   else if (e != EINVAL)
     {
-      puts ("third rwlock_timedrdlock did not return EINVAL");
+      puts ("third rwlock_timedwrlock did not return EINVAL");
       result = 1;
     }