Skip to contentSkip to conversation

fix two "2-1.c" tests of POSIX

PATCH In review Mitani 3 participants 4 messages Aug 18, 2010 – Aug 24, 2010

lore
Share & tools
lore

Mitani

author
#0 lore raw

PATCH 1/1 fix two "2-1.c" tests of POSIX

Hi,

I tried to build open_posix_testsuite testcases with latest git:
ltp-dev-e8ad463baada21fb19f4c06f7dcab75c420ae373.tar.gz

Several testcases failed to build.
Two of them is as follows:
------------
[...]
conformance/interfaces/pthread_attr_setstack/2-1 compile FAILED In file included from ../../../conformance/interfaces/pthread_attr_setstack/2-1.c:31:
../../../include/posixtest.h:14:2: error: #error "Contains GNU-isms that need fixing."
[...]
conformance/interfaces/pthread_attr_setstacksize/2-1 compile FAILED In file included from ../../../conformance/interfaces/pthread_attr_setstacksize/2-1.c:31:
../../../include/posixtest.h:14:2: error: #error "Contains GNU-isms that need fixing."
[...]
------------

".../pthread_attr_setstack/2-1.c" and ".../include/posixtest.h" are as follows:
------------(.../pthread_attr_setstack/2-1.c)
[...]
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <pthread.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/param.h>
#include <errno.h>
#include <unistd.h>
#include "posixtest.h"
[...]
------------

------------(posixtest.h)
[...]
#if defined(_GNU_SOURCE)
#error "Contains GNU-isms that need fixing."
#elif defined(_BSD_SOURCE)
#error "Contains BSD-isms that need fixing."
#endif
[...]
------------

In above "2-1.c", "_GNU_SOURCE" is defined. After that, "posixtest.h" is included.
And, in "posixtest.h", if "_GNU_SOURCE" is defined, error occurs.

If "#ifndef _GNU_SOURCE" is arranged after a line of "posixtest.h", error doesn't occur.
I confirmed that build succeeded by this revision and the test became PASS.

Another "2-1.c" is same as above testcase.

============
---
a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstac
k/2-1.c 2010-08-18 07:18:35.000000000 +0900
+++
b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstac
k/2-1.c 2010-08-18 15:43:16.000000000 +0900
@@ -17,9 +17,6 @@
* provided by nptl, which is developed by Ulrich Drepper.
*/

-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
#include <pthread.h>
#include <limits.h>
#include <stdio.h>
@@ -30,6 +27,10 @@
#include <unistd.h>
#include "posixtest.h"

+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
#define TEST "2-1"
#define FUNCTION "pthread_attr_setstack"
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
---
a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstac
ksize/2-1.c 2010-08-18 07:18:35.000000000 +0900
+++
b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstac
ksize/2-1.c 2010-08-18 15:44:56.000000000 +0900
@@ -17,9 +17,6 @@
* provided by nptl, which is developed by Ulrich Drepper.
*/

-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
#include <pthread.h>
#include <limits.h>
#include <stdio.h>
@@ -30,6 +27,10 @@
#include <unistd.h>
#include "posixtest.h"

+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
#define TEST "2-1"
#define FUNCTION "pthread_attr_setstacksize"
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
============

Regards--

-Tomonori Mitani

testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/2-1.c +4 -3
@@ -17,9 +17,6 @@
  *       provided by nptl, which is developed by Ulrich Drepper.
  */
 
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif 
 #include <pthread.h>
 #include <limits.h>
 #include <stdio.h>
@@ -30,6 +27,10 @@
 #include <unistd.h>
 #include "posixtest.h"
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
 #define TEST "2-1"
 #define FUNCTION "pthread_attr_setstack"
 #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/2-1.c +4 -3
@@ -17,9 +17,6 @@
  *       provided by nptl, which is developed by Ulrich Drepper.
  */
 
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif 
 #include <pthread.h>
 #include <limits.h>
 #include <stdio.h>
@@ -30,6 +27,10 @@
 #include <unistd.h>
 #include "posixtest.h"
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
 #define TEST "2-1"
 #define FUNCTION "pthread_attr_setstacksize"
 #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "

------------------------------------------------------------------------------
This SF.net email is sponsored by

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw

2010/8/18 Mitani <[email protected]>:

Quoted 111 lines

Hi,

I tried to build open_posix_testsuite testcases with latest git:
  ltp-dev-e8ad463baada21fb19f4c06f7dcab75c420ae373.tar.gz

Several testcases failed to build.
Two of them is as follows:
------------
[...]
conformance/interfaces/pthread_attr_setstack/2-1 compile FAILED In file included from ../../../conformance/interfaces/pthread_attr_setstack/2-1.c:31:
../../../include/posixtest.h:14:2: error: #error "Contains GNU-isms that need fixing."
[...]
conformance/interfaces/pthread_attr_setstacksize/2-1 compile FAILED In file included from ../../../conformance/interfaces/pthread_attr_setstacksize/2-1.c:31:
../../../include/posixtest.h:14:2: error: #error "Contains GNU-isms that need fixing."
[...]
------------

".../pthread_attr_setstack/2-1.c" and ".../include/posixtest.h" are as follows:
------------(.../pthread_attr_setstack/2-1.c)
[...]
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <pthread.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/param.h>
#include <errno.h>
#include <unistd.h>
#include "posixtest.h"
[...]
------------

------------(posixtest.h)
[...]
#if defined(_GNU_SOURCE)
#error "Contains GNU-isms that need fixing."
#elif defined(_BSD_SOURCE)
#error "Contains BSD-isms that need fixing."
#endif
[...]
------------

In above "2-1.c", "_GNU_SOURCE" is defined. After that, "posixtest.h" is included.
And, in "posixtest.h", if "_GNU_SOURCE" is defined, error occurs.

If "#ifndef _GNU_SOURCE" is arranged after a line of "posixtest.h", error doesn't occur.
I confirmed that build succeeded by this revision and the test became PASS.

Another "2-1.c" is same as above testcase.

============
---
a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstac k/2-1.c 2010-08-18 07:18:35.000000000 +0900
+++
b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstac k/2-1.c 2010-08-18 15:43:16.000000000 +0900

testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/2-1.c +4 -4
@@ -17,9 +17,6 @@
  *       provided by nptl, which is developed by Ulrich Drepper.
  */
 
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
  #include <pthread.h>
  #include <limits.h>
  #include <stdio.h>
@@ -30,6 +27,10 @@
  #include <unistd.h>
  #include "posixtest.h"
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
  #define TEST "2-1"
  #define FUNCTION "pthread_attr_setstack"
  #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
---

a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstac ksize/2-1.c     2010-08-18 07:18:35.000000000 +0900
+++
b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstac ksize/2-1.c     2010-08-18 15:44:56.000000000 +0900

testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/2-1.c +0 -3
@@ -17,9 +17,6 @@
  *       provided by nptl, which is developed by Ulrich Drepper.
  */
 
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
  #include <pthread.h>
  #include <limits.h>
  #include <stdio.h>

testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/2-1.c line 36

Quoted 10 lines
testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/2-1.c +4 -0
@@ -30,6 +27,10 @@
  #include <unistd.h>
  #include "posixtest.h"
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
  #define TEST "2-1"
  #define FUNCTION "pthread_attr_setstacksize"
  #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "

This is intentional :). The tests need to be written to use only POSIX compliant APIs. Otherwise, it isn't truly POSIX compliant.

Thanks,
-Garrett

------------------------------------------------------------------------------
This SF.net email is sponsored by

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#3 lore raw
In reply to Mitani

2010/8/18 Mitani:

Quoted 10 lines

 *       provided by nptl, which is developed by Ulrich Drepper. */

testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/2-1.c +0 -3
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif

 #include <pthread.h>
 #include <limits.h>
 #include <stdio.h>

testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/2-1.c line 32

Quoted 6 lines
testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/2-1.c +3 -0
@@ -30,6 +27,10 @@
  #include <unistd.h>
  #include "posixtest.h"
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif

defining any _XXX_SOURCE after including any C library headers is pointless as they are checked in C library headers -mike

------------------------------------------------------------------------------
This SF.net email is sponsored by

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

author
#2 lore raw
In reply to Garrett Cooper
Quoted 5 lines

The tests need to be written to use only POSIX compliant APIs.

defining any _XXX_SOURCE after including any C library headers is pointless...

My means was not good.

This test-set is just for POSIX.
But, if "_GNU_SOURCE" is defined, unnecessary GNU function irrelevant to POSIX becomes effective.
Anyhow, definition of "_GNU_SOURCE" is not necessary about following two test-sets , I think.
.../pthread_attr_setstack/2-1.c .../pthread_attr_setstacksize/2-1.c

I removed "_GNU_SOURCE" definition from these test-sets, and succeeded to build and run.

============

testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/2-1.c +0 -3
@@ -15,9 +15,6 @@
  */
 
 /* For pthread_getattr_np(3) -- not a POSIX compliant API. */
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
 #include <sys/param.h>
 #include <errno.h>
 #include <limits.h>
testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/2-1.c +0 -3
@@ -15,9 +15,6 @@
  */
 
 /* For pthread_getattr_np(3) -- not a POSIX compliant API */
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
 #include <sys/param.h>
 #include <errno.h>
 #include <limits.h>

============

Thank you--

-Tomonori Mitani

Quoted 147 lines

-----Original Message-----
From: Garrett Cooper [mailto:[email protected]]
Sent: Wednesday, August 18, 2010 4:25 PM
To: Mitani
Cc: [email protected]; 當座 健市
Subject: Re: [LTP] [PATCH] fix two "2-1.c" tests of POSIX

2010/8/18 Mitani <[email protected]>:

Quoted 5 lines

Hi,

I tried to build open_posix_testsuite testcases with latest git:
ltp-dev-e8ad463baada21fb19f4c06f7dcab75c420ae373.tar.gz

Quoted 8 lines

Several testcases failed to build.
Two of them is as follows:
------------
[...] conformance/interfaces/pthread_attr_setstack/2-1 compile FAILED In file included from ../../../conformance/interfaces/pthread_attr_setstack/2-1.c:31:
../../../include/posixtest.h:14:2: error: #error "Contains

GNU-isms that

Quoted 3 lines

need fixing."
[...] conformance/interfaces/pthread_attr_setstacksize/2-1 compile

FAILED

Quoted 2 lines

In file included from ../../../conformance/interfaces/pthread_attr_setstacksize/2-1.c:

31:

Quoted 1 line

../../../include/posixtest.h:14:2: error: #error "Contains

GNU-isms that

Quoted 5 lines

need fixing."
[...]
------------

".../pthread_attr_setstack/2-1.c" and ".../include/posixtest.h"

are

Quoted 28 lines

as follows:
------------(.../pthread_attr_setstack/2-1.c)
[...]
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <pthread.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/param.h>
#include <errno.h>
#include <unistd.h>
#include "posixtest.h"
[...]
------------

------------(posixtest.h)
[...]
#if defined(_GNU_SOURCE)
#error "Contains GNU-isms that need fixing."
#elif defined(_BSD_SOURCE)
#error "Contains BSD-isms that need fixing."
#endif
[...]
------------

Quoted 1 line

In above "2-1.c", "_GNU_SOURCE" is defined. After that,

"posixtest.h"

Quoted 8 lines

is included.
And, in "posixtest.h", if "_GNU_SOURCE" is defined, error occurs.

If "#ifndef _GNU_SOURCE" is arranged after a line of "posixtest.h", error doesn't occur.
I confirmed that build succeeded by this revision and the test became PASS.

Quoted 8 lines

Another "2-1.c" is same as above testcase.

============
---

a/testcases/open_posix_testsuite/conformance/interfaces/pthread_at tr_setstac

Quoted 3 lines

k/2-1.c 2010-08-18 07:18:35.000000000 +0900
+++

b/testcases/open_posix_testsuite/conformance/interfaces/pthread_at tr_setstac

Quoted 14 lines

k/2-1.c 2010-08-18 15:43:16.000000000 +0900

(quoted diff) +0 -3
@@ -17,9 +17,6 @@
 *       provided by nptl, which is developed by Ulrich Drepper.
 */
 
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
 #include <pthread.h>
 #include <limits.h>
 #include <stdio.h>
@@ -30,6 +27,10 @@
 #include <unistd.h>

Review

Quoted 10 lines
(quoted diff) +4 -1
 #include "posixtest.h"
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
 #define TEST "2-1"
 #define FUNCTION "pthread_attr_setstack"
 #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
---

a/testcases/open_posix_testsuite/conformance/interfaces/pthread_at tr_setstac

Quoted 3 lines

ksize/2-1.c 2010-08-18 07:18:35.000000000 +0900
+++

b/testcases/open_posix_testsuite/conformance/interfaces/pthread_at tr_setstac

Quoted 12 lines

ksize/2-1.c 2010-08-18 15:44:56.000000000 +0900

(quoted diff) +0 -3
@@ -17,9 +17,6 @@
 *       provided by nptl, which is developed by Ulrich Drepper.
 */
 
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
 #include <pthread.h>
 #include <limits.h>
 #include <stdio.h>

Review line 36

Quoted 10 lines
(quoted diff) +4 -0
@@ -30,6 +27,10 @@
 #include <unistd.h>
 #include "posixtest.h"
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
 #define TEST "2-1"
 #define FUNCTION "pthread_attr_setstacksize"
 #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "

This is intentional :). The tests need to be written to use only POSIX compliant APIs. Otherwise, it isn't truly POSIX compliant.

Quoted 2 lines

Thanks,
-Garrett

testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/2-1.c +0 -3
@@ -15,9 +15,6 @@
  */
 
 /* For pthread_getattr_np(3) -- not a POSIX compliant API. */
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
 #include <sys/param.h>
 #include <errno.h>
 #include <limits.h>
testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/2-1.c +0 -3
@@ -15,9 +15,6 @@
  */
 
 /* For pthread_getattr_np(3) -- not a POSIX compliant API */
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
 #include <sys/param.h>
 #include <errno.h>
 #include <limits.h>

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list