All of lore.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH 0/2] api/x86: build improvements
@ 2017-05-19 16:48 Radim Krčmář
  2017-05-19 16:48 ` [kvm-unit-tests PATCH 1/2] configure: improve api/ detection Radim Krčmář
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Radim Krčmář @ 2017-05-19 16:48 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini

api/ is mostly forgotten.  I think that getting some api/ tests into
./run_tests would be best for exposure, but this series starts small:
by building api/ tests by default.


Radim Krčmář (2):
  configure: improve api/ detection
  api/x86: sanitize Makefile

 configure           | 32 ++++++++++++++++----------------
 x86/Makefile.common | 17 ++++++-----------
 2 files changed, 22 insertions(+), 27 deletions(-)

-- 
2.13.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [kvm-unit-tests PATCH 1/2] configure: improve api/ detection
  2017-05-19 16:48 [kvm-unit-tests PATCH 0/2] api/x86: build improvements Radim Krčmář
@ 2017-05-19 16:48 ` Radim Krčmář
  2017-05-19 16:48 ` [kvm-unit-tests PATCH 2/2] api/x86: sanitize Makefile Radim Krčmář
  2017-05-19 16:51 ` [kvm-unit-tests PATCH 0/2] api/x86: build improvements Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Radim Krčmář @ 2017-05-19 16:48 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini

API was never selected by default, because <stdc++> should have been
<bits/stdc++> and in any case needs g++.  Boost dependency has recently
been lifted, but we added gnu++11 dependency.
Only x86 currently uses compiles api, so make the room for errors a bit
smaller by checking for it.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
 configure | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/configure b/configure
index 2586131b6eff..64722c9b263b 100755
--- a/configure
+++ b/configure
@@ -3,6 +3,7 @@
 srcdir=$(cd "$(dirname "$0")"; pwd)
 prefix=/usr/local
 cc=gcc
+cxx=g++
 ld=ld
 objcopy=objcopy
 objdump=objdump
@@ -24,6 +25,7 @@ usage() {
 	    --processor=PROCESSOR  processor to compile for ($arch)
 	    --cross-prefix=PREFIX  cross compiler prefix
 	    --cc=CC		   c compiler to use ($cc)
+	    --cxx=CXX		   c++ compiler to use ($cxx)
 	    --ld=LD		   ld linker to use ($ld)
 	    --prefix=PREFIX        where to install things ($prefix)
 	    --endian=ENDIAN        endianness to compile for (little or big, ppc64 only)
@@ -59,6 +61,9 @@ while [[ "$1" = -* ]]; do
 	--cc)
 	    cc="$arg"
 	    ;;
+	--cxx)
+	    cxx="$arg"
+	    ;;
 	--ld)
 	    ld="$arg"
 	    ;;
@@ -118,22 +123,16 @@ EOF
 u32_long=$($cross_prefix$cc -E lib-test.c | grep -v '^#' | grep -q long && echo yes)
 rm -f lib-test.c
 
-# check for dependent 32 bit libraries
-if [ "$arch" != "arm" ]; then
-cat << EOF > lib_test.c
-#include <stdc++.h>
-#include <boost_thread-mt.h>
-#include <pthread.h>
-
-int main ()
-{}
-EOF
-$cc -m32 -o /dev/null lib_test.c &> /dev/null
-exit=$?
-if [ $exit -eq 0 ]; then
-    api=true
-fi
-rm -f lib_test.c
+# api/: check for dependent 32 bit libraries and gnu++11 support
+if [ "$testdir" = "x86" ]; then
+    echo 'int main () {}' > lib-test.c
+    $cc -m32 -o /dev/null -lstdc++ -lpthread -lrt lib-test.c &> /dev/null
+    exit=$?
+    $cxx -m32 -o /dev/null -std=gnu++11 lib-test.c &> /dev/null
+    if [ $? -eq 0 -a $exit -eq 0 ]; then
+        api=true
+    fi
+    rm -f lib-test.c
 fi
 
 # Are we in a separate build tree? If so, link the Makefile
@@ -173,6 +172,7 @@ ARCH=$arch
 ARCH_NAME=$arch_name
 PROCESSOR=$processor
 CC=$cross_prefix$cc
+CXX=$cross_prefix$cxx
 LD=$cross_prefix$ld
 OBJCOPY=$cross_prefix$objcopy
 OBJDUMP=$cross_prefix$objdump
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [kvm-unit-tests PATCH 2/2] api/x86: sanitize Makefile
  2017-05-19 16:48 [kvm-unit-tests PATCH 0/2] api/x86: build improvements Radim Krčmář
  2017-05-19 16:48 ` [kvm-unit-tests PATCH 1/2] configure: improve api/ detection Radim Krčmář
@ 2017-05-19 16:48 ` Radim Krčmář
  2017-05-19 16:51 ` [kvm-unit-tests PATCH 0/2] api/x86: build improvements Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Radim Krčmář @ 2017-05-19 16:48 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini

We weren't cleaning api/, rules were needlessly repetitive, and c++
specific flags weren't in CXXFLAGS.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
 x86/Makefile.common | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/x86/Makefile.common b/x86/Makefile.common
index 57e8e45388cd..7bb6b50c3975 100644
--- a/x86/Makefile.common
+++ b/x86/Makefile.common
@@ -51,14 +51,12 @@ tests-common = $(TEST_DIR)/vmexit.flat $(TEST_DIR)/tsc.flat \
                $(TEST_DIR)/hyperv_synic.flat $(TEST_DIR)/hyperv_stimer.flat \
 
 ifdef API
-tests-common += api/api-sample
-tests-common += api/dirty-log
-tests-common += api/dirty-log-perf
+tests-api = api/api-sample api/dirty-log api/dirty-log-perf
 
 OBJDIRS += api
 endif
 
-test_cases: $(tests-common) $(tests)
+test_cases: $(tests-common) $(tests) $(tests-api)
 
 $(TEST_DIR)/%.o: CFLAGS += -std=gnu99 -ffreestanding -I $(SRCDIR)/lib -I $(SRCDIR)/lib/x86 -I lib
 
@@ -75,9 +73,10 @@ $(TEST_DIR)/hyperv_stimer.elf: $(TEST_DIR)/hyperv.o
 
 arch_clean:
 	$(RM) $(TEST_DIR)/*.o $(TEST_DIR)/*.flat $(TEST_DIR)/*.elf \
-	$(TEST_DIR)/.*.d lib/x86/.*.d
+	$(TEST_DIR)/.*.d lib/x86/.*.d \
+	$(tests-api) api/*.o api/*.a api/.*.d
 
-api/%.o: CFLAGS += -m32 -std=gnu++11
+api/%.o: CXXFLAGS += -m32 -std=gnu++11
 
 api/%: LDLIBS += -lstdc++ -lpthread -lrt
 api/%: LDFLAGS += -m32
@@ -85,8 +84,4 @@ api/%: LDFLAGS += -m32
 api/libapi.a: api/kvmxx.o api/identity.o api/exception.o api/memmap.o
 	$(AR) rcs $@ $^
 
-api/api-sample: api/api-sample.o api/libapi.a
-
-api/dirty-log: api/dirty-log.o api/libapi.a
-
-api/dirty-log-perf: api/dirty-log-perf.o api/libapi.a
+$(tests-api) : % : %.o api/libapi.a
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [kvm-unit-tests PATCH 0/2] api/x86: build improvements
  2017-05-19 16:48 [kvm-unit-tests PATCH 0/2] api/x86: build improvements Radim Krčmář
  2017-05-19 16:48 ` [kvm-unit-tests PATCH 1/2] configure: improve api/ detection Radim Krčmář
  2017-05-19 16:48 ` [kvm-unit-tests PATCH 2/2] api/x86: sanitize Makefile Radim Krčmář
@ 2017-05-19 16:51 ` Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2017-05-19 16:51 UTC (permalink / raw)
  To: Radim Krčmář, kvm



On 19/05/2017 18:48, Radim Krčmář wrote:
> api/ is mostly forgotten.  I think that getting some api/ tests into
> ./run_tests would be best for exposure, but this series starts small:
> by building api/ tests by default.
> 
> 
> Radim Krčmář (2):
>   configure: improve api/ detection
>   api/x86: sanitize Makefile
> 
>  configure           | 32 ++++++++++++++++----------------
>  x86/Makefile.common | 17 ++++++-----------
>  2 files changed, 22 insertions(+), 27 deletions(-)
> 

Thanks, looks good!  Please commit it yourself.

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-05-19 16:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-19 16:48 [kvm-unit-tests PATCH 0/2] api/x86: build improvements Radim Krčmář
2017-05-19 16:48 ` [kvm-unit-tests PATCH 1/2] configure: improve api/ detection Radim Krčmář
2017-05-19 16:48 ` [kvm-unit-tests PATCH 2/2] api/x86: sanitize Makefile Radim Krčmář
2017-05-19 16:51 ` [kvm-unit-tests PATCH 0/2] api/x86: build improvements Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.