Skip to contentSkip to conversation

open_posix_testsuite: Fix compilation issues

PATCH New Zou Wei 2 participants 2 messages Mar 24, 2020 – May 5, 2020

lore
Share & tools
lore

Zou Wei

author
#0 lore raw

PATCH v2 1/1 open_posix_testsuite: Fix compilation issues

Fix compilation issues:
1. Add the '-lpthread -lrt -lm' config into LDFLAGS
2. Add the '-pthread' config into CFLAGS
3. Update makefile and locate-test script

If only add -pthread to LDFLAGS and CFLAGS,
some cases will fail to compile, such as timers/twoevtimers.c, need to add -lrt to compile successfully.

---
 testcases/open_posix_testsuite/CFLAGS              | 2 +-
 testcases/open_posix_testsuite/LDFLAGS             | 1 +
 testcases/open_posix_testsuite/functional/Makefile | 2 +-
 testcases/open_posix_testsuite/scripts/locate-test | 2 +-
 testcases/open_posix_testsuite/stress/Makefile     | 2 +-
 5 files changed, 5 insertions(+), 4 deletions(-)
testcases/open_posix_testsuite/CFLAGS +1 -1
index 297d292..6330fa9 100644
@@ -1 +1 @@
--std=c99 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -W -Wall
+-std=c99 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -W -Wall -pthread
testcases/open_posix_testsuite/LDFLAGS +1 -0
index e69de29..6c112d3 100644
@@ -0,0 +1 @@
+-lpthread -lrt -lm
testcases/open_posix_testsuite/functional/Makefile +1 -1
index 3b22c89..50e03aa 100644
@@ -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
 
testcases/open_posix_testsuite/scripts/locate-test +1 -1
index 27f0bb5..e4ef994 100755
@@ -92,7 +92,7 @@ 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)
testcases/open_posix_testsuite/stress/Makefile +1 -1
index b09527f..d6872a9 100644
@@ -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
 

--
2.6.2

#1 lore raw

PATCH v2 1/1 open_posix_testsuite: Fix compilation issues

Hi!

Quoted 8 lines

Fix compilation issues:
1. Add the '-lpthread -lrt -lm' config into LDFLAGS
2. Add the '-pthread' config into CFLAGS
3. Update makefile and locate-test script

If only add -pthread to LDFLAGS and CFLAGS,
some cases will fail to compile, such as timers/twoevtimers.c, need to add -lrt to compile successfully.

As discussed previously we should add the flags to the testcases that actually needs them instead of adding them to all testcases.

Signature · 2 lines
Cyril Hrubis
[email protected]