Skip to contentSkip to conversation

pthread_cond_init/s-c.c: Add the lose ifndef line

PATCH New Zou Wei 4 participants 10 messages Mar 16, 2020 – Mar 17, 2020

lore
Share & tools
lore

Zou Wei

author
#0 lore raw

PATCH 1/1 pthread_cond_init/s-c.c: Add the lose ifndef line

pthread_cond_init/s-c.c testcase lose a #ifndef line, fix it

---
 testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c | 1 +
 1 file changed, 1 insertion(+)
testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c +1 -1
index 6a5c70a..8d18484 100644
@@ -80,6 +80,7 @@
 /***********************************    Test case   *****************************************/
 /********************************************************************************************/
+#ifndef WITHOUT_XOPEN
 typedef struct _teststruct {
 	pthread_cond_t cnd[10 * SCALABILITY_FACTOR];
 	pthread_condattr_t ca[4];
--

2.6.2

#1 lore raw

PATCH 1/1 pthread_cond_init/s-c.c: Add the lose ifndef line

Hi Zou

It was introduced by commit 310c9eb6e6("Remove explicit #define's for _POSIX_C_SOURCE and _XOPEN_SOURCE").

IMO, we can remove this WITHOUT_XOPEN macro directly because we have setted -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 in ltp/testcases/open_posix_testsuite/CFLAGS.

Best Regards
Yang Xu

Quoted 23 lines

pthread_cond_init/s-c.c testcase lose a #ifndef line, fix it

---
  testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c | 1 +
  1 file changed, 1 insertion(+)
testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c +1 -1
index 6a5c70a..8d18484 100644
@@ -80,6 +80,7 @@
  /***********************************    Test case   *****************************************/
  /********************************************************************************************/
+#ifndef WITHOUT_XOPEN
  typedef struct _teststruct {
  	pthread_cond_t cnd[10 * SCALABILITY_FACTOR];
  	pthread_condattr_t ca[4];
--

2.6.2

#2 lore raw

PATCH 1/1 pthread_cond_init/s-c.c: Add the lose ifndef line

Hi Cyril

On my environment, when I test openposix, this case missed run and complie because locate-test has filter rules called by open_posix_testsuite/scripts/generate-makefiles.sh. filter rules as below:

runnable)
find "$WHERE/conformance" "$WHERE/stress" -type f -name
'*[0-9].c' -o -name '[0-9]*-[0-9]*.sh' | grep -v buildonly | grep -v '^./tools'
find "$WHERE/functional" -type f -name '*.c'

I have a question why we leave it here if they are no meaningful. If it was meaningful, why we filter this case? I see the history, but found no thing.

@Enji, you often change openposix code, can you give me some advise?

Best Regards
Yang Xu

Quoted 46 lines

Hi Zou

It was introduced by commit 310c9eb6e6("Remove explicit #define's for _POSIX_C_SOURCE and _XOPEN_SOURCE").

IMO, we can remove this WITHOUT_XOPEN macro directly because we have setted -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 in ltp/testcases/open_posix_testsuite/CFLAGS.

Best Regards
Yang Xu

Quoted 32 lines

pthread_cond_init/s-c.c testcase lose a #ifndef line, fix it

---

testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c | 1 +
? 1 file changed, 1 insertion(+)

(quoted diff) +0 -0

a/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c

index 6a5c70a..8d18484 100644
---
a/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c
+++
b/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c

(quoted diff) +0 -0
@@ -80,6 +80,7 @@

? /***********************************??? Test case *****************************************/

/********************************************************************************************/

+#ifndef WITHOUT_XOPEN
? typedef struct _teststruct {
????? pthread_cond_t cnd[10 * SCALABILITY_FACTOR]; ????? pthread_condattr_t ca[4];

Signature · 1 line
2.6.2
#3 lore raw

PATCH 1/1 pthread_cond_init/s-c.c: Add the lose ifndef line

Hi Yang,
I?ll have to look back, but this might have been the original set of items which never compiled/built cleanly.
I think it?s time to go back to a more sane gmake-based build framework. My goal in making things work with POSIX make was noble for the time but it seems incredibly unnecessary now and I think it?s overcomplicating things.
Thanks!
-Enji

Quoted 48 lines · Yang Xu

Hi Cyril

On my environment, when I test openposix, this case missed run and complie because locate-test has filter rules called by open_posix_testsuite/scripts/generate-makefiles.sh. filter rules as below:

runnable)
find "$WHERE/conformance" "$WHERE/stress" -type f -name '*[0-9].c' -o -name '[0-9]*-[0-9]*.sh' | grep -v buildonly | grep -v '^./tools' find "$WHERE/functional" -type f -name '*.c'

I have a question why we leave it here if they are no meaningful. If it was meaningful, why we filter this case? I see the history, but found no thing.

@Enji, you often change openposix code, can you give me some advise?

Best Regards
Yang Xu

Quoted 28 lines

Hi Zou
It was introduced by commit 310c9eb6e6("Remove explicit #define's for _POSIX_C_SOURCE and _XOPEN_SOURCE").
IMO, we can remove this WITHOUT_XOPEN macro directly because we have setted -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 in ltp/testcases/open_posix_testsuite/CFLAGS. Best Regards
Yang Xu

Quoted 23 lines

pthread_cond_init/s-c.c testcase lose a #ifndef line, fix it

---
 testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c | 1 +
  1 file changed, 1 insertion(+)
testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c +1 -0
index 6a5c70a..8d18484 100644
@@ -80,6 +80,7 @@
  /***********************************    Test case   *****************************************/
 /********************************************************************************************/ 
+#ifndef WITHOUT_XOPEN
  typedef struct _teststruct {
      pthread_cond_t cnd[10 * SCALABILITY_FACTOR];
      pthread_condattr_t ca[4];
Signature · 1 line
2.6.2
#4 lore raw

PATCH 1/1 pthread_cond_init/s-c.c: Add the lose ifndef line

Hi Enji

Quoted 2 lines

Hi Yang,
I?ll have to look back, but this might have been the original set of items which never compiled/built cleanly.

I guess commit bec80d891a ("Fix oversight with `test tools'") changed this, as below:

--- a/testcases/open_posix_testsuite/scripts/locate-test +++ b/testcases/open_posix_testsuite/scripts/locate-test
...
- find "$WHERE" -type f -name '*.c' -o -name '[0-9]*-[0-9]*.sh' |
grep -v buildonly | grep -v '^./tools' | grep -v testfrmw | grep -v '_scenarii'
+ find "$WHERE" -type f -name '*[0-9].c' -o -name
'[0-9]*-[0-9]*.sh' | grep -v buildonly | grep -v '^./tools'

Quoted 1 line

I think it?s time to go back to a more sane gmake-based build framework. My goal in making things work with POSIX make was noble for the time but it seems incredibly unnecessary now and I think it?s overcomplicating things.

Yes. We should refactor this with using gmake, at lease we should compile them automatically.

Best Regards
Yang Xu

Quoted 54 lines

Thanks!
-Enji

Quoted 48 lines · Yang Xu

Hi Cyril

On my environment, when I test openposix, this case missed run and complie because locate-test has filter rules called by open_posix_testsuite/scripts/generate-makefiles.sh. filter rules as below:

runnable)
find "$WHERE/conformance" "$WHERE/stress" -type f -name '*[0-9].c' -o -name '[0-9]*-[0-9]*.sh' | grep -v buildonly | grep -v '^./tools' find "$WHERE/functional" -type f -name '*.c'

I have a question why we leave it here if they are no meaningful. If it was meaningful, why we filter this case? I see the history, but found no thing.

@Enji, you often change openposix code, can you give me some advise?

Best Regards
Yang Xu

Quoted 28 lines

Hi Zou
It was introduced by commit 310c9eb6e6("Remove explicit #define's for _POSIX_C_SOURCE and _XOPEN_SOURCE").
IMO, we can remove this WITHOUT_XOPEN macro directly because we have setted -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 in ltp/testcases/open_posix_testsuite/CFLAGS. Best Regards
Yang Xu

Quoted 23 lines

pthread_cond_init/s-c.c testcase lose a #ifndef line, fix it

---
  testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c | 1 +
   1 file changed, 1 insertion(+)
testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c +1 -0
index 6a5c70a..8d18484 100644
@@ -80,6 +80,7 @@
   /***********************************    Test case   *****************************************/
  /********************************************************************************************/
+#ifndef WITHOUT_XOPEN
   typedef struct _teststruct {
       pthread_cond_t cnd[10 * SCALABILITY_FACTOR];
       pthread_condattr_t ca[4];
Signature · 1 line
2.6.2
#5 lore raw

PATCH 1/1 pthread_cond_init/s-c.c: Add the lose ifndef line

In reply to Yang Xu

Hi Zou

Even this case does't compile or run on ltp default envrionment, I think it is a framework problem about ltp openposix. This fix is obviously correct and simple.

Someone who merging this patch can add fixes tag.

Fixes 310c9eb6e ("Remove explicit #define's for `_POSIX_C_SOURCE` and

_XOPEN_SOURCE")

Best Regards
Yang Xu

Quoted 46 lines

Hi Zou

It was introduced by commit 310c9eb6e6("Remove explicit #define's for _POSIX_C_SOURCE and _XOPEN_SOURCE").

IMO, we can remove this WITHOUT_XOPEN macro directly because we have setted -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 in ltp/testcases/open_posix_testsuite/CFLAGS.

Best Regards
Yang Xu

Quoted 32 lines

pthread_cond_init/s-c.c testcase lose a #ifndef line, fix it

---

testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c | 1 +
? 1 file changed, 1 insertion(+)

(quoted diff) +0 -0

a/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c

index 6a5c70a..8d18484 100644
---
a/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c
+++
b/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c

(quoted diff) +0 -0
@@ -80,6 +80,7 @@

? /***********************************??? Test case *****************************************/

/********************************************************************************************/

+#ifndef WITHOUT_XOPEN
? typedef struct _teststruct {
????? pthread_cond_t cnd[10 * SCALABILITY_FACTOR]; ????? pthread_condattr_t ca[4];

Signature · 1 line
2.6.2
author Reviewed-by Yang Xu on v1 1/1
#6 lore raw

Hi Xu

Thanks for your answers and reviews.

When I used the open-posix testsuite, I modified multiple files before compiling successfully.

It is hoped that in future LTP release versions, open-posix can be automatically enabled and can be successfully compiled without modification.

BTW, The files I modified are as follows:
ltp/testcases/Makefile
@@ -30,9 +30,9 @@ include $(top_srcdir)/include/mk/env_pre.mk
# run).
FILTER_OUT_DIRS := kdump

-ifneq ($(WITH_OPEN_POSIX_TESTSUITE),yes)
-FILTER_OUT_DIRS += open_posix_testsuite
-endif

ifneq ($(WITH_REALTIME_TESTSUITE),yes)
FILTER_OUT_DIRS += realtime

ltp/testcases/open_posix_testsuite/LDFLAGS
@@ -0,0 +1 @@
+-lpthread -lrt -lm

ltp/testcases/open_posix_testsuite/functional/Makefile @@ -5,7 +5,7 @@
#

all clean install test:
- @for dir in ls -d */Makefile 2>/dev/null | sed -e 's,/Makefile$$,,g'; do \
+ @for dir in find . -name *Makefile | egrep -v '^./Makefile' | sed -e 's,/Makefile$$,,g'; do \
$(MAKE) -C $$dir $@; \
done

ltp/testcases/open_posix_testsuite/scripts/locate-test @@ -92,7 +92,8 @@ runnable)

 	# waltz down the tools directory and try and build t0 (which doesn't
 	# make sense as it's a tool, not a test). Better criterion needs to
 	# be established for this file.
-	find "$WHERE/conformance" "$WHERE/stress" -type f -name '*[0-9].c' -o -name '[0-9]*-[0-9]*.sh' | grep -v buildonly | grep -v '^./tools'
+	find "$WHERE/conformance" "$WHERE/stress" -type f -name '*[0-9a-z].c' -o -name '[0-9]*-[0-9]*.sh' | grep -v buildonly | grep -v '^./tools' | grep -v 'testfrmw.c$'
 	find "$WHERE/functional" -type f -name '*.c'
 	;;
 test-tools)

ltp/testcases/open_posix_testsuite/stress/Makefile @@ -5,7 +5,7 @@
#

all clean install test:
- @for dir in ls -d */Makefile 2>/dev/null | sed -e 's,/Makefile$$,,g'; do \
+ @for dir in find . -name *Makefile | egrep -v '^./Makefile' | sed -e 's,/Makefile$$,,g'; do \
$(MAKE) -C $$dir $@; \
done

Best Regards
Zou Wei
-----????-----
???: Yang Xu [mailto:[email protected]]
????: 2020?3?17? 10:08
???: Zouwei (Samuel) <[email protected]>
??: [email protected]
??: Re: [LTP] [PATCH] pthread_cond_init/s-c.c: Add the lose ifndef line

Hi Zou

Even this case does't compile or run on ltp default envrionment, I think it is a framework problem about ltp openposix. This fix is obviously correct and simple.

Someone who merging this patch can add fixes tag.

Fixes 310c9eb6e ("Remove explicit #define's for `_POSIX_C_SOURCE` and

_XOPEN_SOURCE")

Best Regards
Yang Xu

Quoted 52 lines

Hi Zou

It was introduced by commit 310c9eb6e6("Remove explicit #define's for _POSIX_C_SOURCE and _XOPEN_SOURCE").

IMO, we can remove this WITHOUT_XOPEN macro directly because we have setted -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 in ltp/testcases/open_posix_testsuite/CFLAGS.

Best Regards
Yang Xu

Quoted 38 lines

pthread_cond_init/s-c.c testcase lose a #ifndef line, fix it

---

testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c | 1 +
? 1 file changed, 1 insertion(+)

diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c .c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c .c

index 6a5c70a..8d18484 100644
---
a/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c .c
+++
b/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c .c

(quoted diff) +0 -0
@@ -80,6 +80,7 @@

? /***********************************??? Test case *****************************************/

/******************************************************************** ************************/

+#ifndef WITHOUT_XOPEN
? typedef struct _teststruct {
????? pthread_cond_t cnd[10 * SCALABILITY_FACTOR]; ????? pthread_condattr_t ca[4];
--
2.6.2

#7 lore raw
Quoted 7 lines · Zouwei (Samuel)

Hi Xu

Thanks for your answers and reviews.

When I used the open-posix testsuite, I modified multiple files before compiling successfully.

It is hoped that in future LTP release versions, open-posix can be automatically enabled and can be successfully compiled without modification.

Hi Zou,

You can send some patches to fix them directly.

Thanks,
Xiao Yang

Quoted 127 lines

BTW, The files I modified are as follows:
ltp/testcases/Makefile

(quoted diff) +0 -3
@@ -30,9 +30,9 @@ include $(top_srcdir)/include/mk/env_pre.mk
  #    run).
  FILTER_OUT_DIRS                := kdump
 
-ifneq ($(WITH_OPEN_POSIX_TESTSUITE),yes)
-FILTER_OUT_DIRS                += open_posix_testsuite
-endif
 
  ifneq ($(WITH_REALTIME_TESTSUITE),yes)
  FILTER_OUT_DIRS                += realtime

ltp/testcases/open_posix_testsuite/LDFLAGS

(quoted diff) +1 -0
@@ -0,0 +1 @@
+-lpthread -lrt -lm

ltp/testcases/open_posix_testsuite/functional/Makefile

(quoted diff) +1 -1
@@ -5,7 +5,7 @@
  #
 
  all clean install test:
-	@for dir in `ls -d */Makefile 2>/dev/null | sed -e 's,/Makefile$$,,g'`; do \
+	@for dir in `find . -name *Makefile | egrep -v '^./Makefile' | sed -e 's,/Makefile$$,,g'`; do \
  		$(MAKE) -C $$dir $@;						   \
  	done
 

ltp/testcases/open_posix_testsuite/scripts/locate-test

(quoted diff) +1 -1
@@ -92,7 +92,8 @@ runnable)
  	# waltz down the tools directory and try and build t0 (which doesn't
  	# make sense as it's a tool, not a test). Better criterion needs to
  	# be established for this file.
-	find "$WHERE/conformance" "$WHERE/stress" -type f -name '*[0-9].c' -o -name '[0-9]*-[0-9]*.sh' | grep -v buildonly | grep -v '^./tools'
+	find "$WHERE/conformance" "$WHERE/stress" -type f -name '*[0-9a-z].c' -o -name '[0-9]*-[0-9]*.sh' | grep -v buildonly | grep -v '^./tools' | grep -v 'testfrmw.c$'
  	find "$WHERE/functional" -type f -name '*.c'
  	;;
  test-tools)

ltp/testcases/open_posix_testsuite/stress/Makefile

(quoted diff) +1 -1
@@ -5,7 +5,7 @@
  #
 
  all clean install test:
-	@for dir in `ls -d */Makefile 2>/dev/null | sed -e 's,/Makefile$$,,g'`; do \
+	@for dir in `find . -name *Makefile | egrep -v '^./Makefile' | sed -e 's,/Makefile$$,,g'`; do \
  		$(MAKE) -C $$dir $@;						  \
  	done
 

Best Regards
Zou Wei
-----????-----
???: Yang Xu [mailto:[email protected]]
????: 2020?3?17? 10:08
???: Zouwei (Samuel)<[email protected]>
??: [email protected]
??: Re: [LTP] [PATCH] pthread_cond_init/s-c.c: Add the lose ifndef line

Hi Zou

Even this case does't compile or run on ltp default envrionment, I think it is a framework problem about ltp openposix. This fix is obviously correct and simple.

Someone who merging this patch can add fixes tag.

Fixes 310c9eb6e ("Remove explicit #define's for `_POSIX_C_SOURCE` and

_XOPEN_SOURCE")

Best Regards
Yang Xu

Quoted 52 lines

Hi Zou

It was introduced by commit 310c9eb6e6("Remove explicit #define's for _POSIX_C_SOURCE and _XOPEN_SOURCE").

IMO, we can remove this WITHOUT_XOPEN macro directly because we have setted -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 in ltp/testcases/open_posix_testsuite/CFLAGS.

Best Regards
Yang Xu

Quoted 38 lines

pthread_cond_init/s-c.c testcase lose a #ifndef line, fix it

---

testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c | 1 +

   1 file changed, 1 insertion(+)

diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c .c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c .c

index 6a5c70a..8d18484 100644
---
a/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c .c
+++
b/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c .c

(quoted diff) +1 -0
@@ -80,6 +80,7 @@
   /***********************************    Test case
 *****************************************/
 
 /********************************************************************
 ************************/
 
+#ifndef WITHOUT_XOPEN
   typedef struct _teststruct {
       pthread_cond_t cnd[10 * SCALABILITY_FACTOR];
       pthread_condattr_t ca[4];

--
2.6.2

#8 lore raw

PATCH 1/1 pthread_cond_init/s-c.c: Add the lose ifndef line

In reply to Zou Wei

Hi Zou,

Pushed.

BTW:
1) we also need to update open_posix_testsuite so that it can compile these stress tests by default.
2) Your patch seems to be broken so I recreate and apply it.

Thanks,
Xiao Yang

Quoted 23 lines · Zou Wei

pthread_cond_init/s-c.c testcase lose a #ifndef line, fix it

---
  testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c | 1 +
  1 file changed, 1 insertion(+)
testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c +1 -1
index 6a5c70a..8d18484 100644
@@ -80,6 +80,7 @@
  /***********************************    Test case   *****************************************/
  /********************************************************************************************/
+#ifndef WITHOUT_XOPEN
  typedef struct _teststruct {
  	pthread_cond_t cnd[10 * SCALABILITY_FACTOR];
  	pthread_condattr_t ca[4];
--

2.6.2

#9 lore raw

Hi Xu

Thanks for merge the patch.

I sent another 2 patches, one is to enable the open_posix_testsuite in the makefile, and the other one is to fix the open_posix compilation issue.

Best Regards
Zou Wei
-----????-----
???: Xiao Yang [mailto:[email protected]]
????: 2020?3?17? 15:15
???: Zouwei (Samuel) <[email protected]>
??: [email protected]
??: Re: [LTP] [PATCH] pthread_cond_init/s-c.c: Add the lose ifndef line

Hi Zou,

Pushed.

BTW:
1) we also need to update open_posix_testsuite so that it can compile these stress tests by default.
2) Your patch seems to be broken so I recreate and apply it.

Thanks,
Xiao Yang

Quoted 32 lines · Zou Wei

pthread_cond_init/s-c.c testcase lose a #ifndef line, fix it

---
  testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c | 1 +
  1 file changed, 1 insertion(+)
(quoted diff) +0 -0

a/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c. c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c. c
index 6a5c70a..8d18484 100644
---
a/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c. c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/ +++ s-c.c

testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c +1 -0
@@ -80,6 +80,7 @@
  /***********************************    Test case   *****************************************/
 
 /*********************************************************************
 ***********************/
+#ifndef WITHOUT_XOPEN
  typedef struct _teststruct {
  	pthread_cond_t cnd[10 * SCALABILITY_FACTOR];

pthread_condattr_t ca[4];
--
2.6.2