diff mbox

[10/11] test: eliminate libcheck tests and have make check use gtester

Message ID 1326124572-8312-10-git-send-email-aliguori@us.ibm.com
State New
Headers show

Commit Message

Anthony Liguori Jan. 9, 2012, 3:56 p.m. UTC
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 configure      |   33 +--------------------------------
 tests/Makefile |   11 ++++++-----
 2 files changed, 7 insertions(+), 37 deletions(-)

Comments

Andreas Färber Jan. 9, 2012, 7:35 p.m. UTC | #1
Am 09.01.2012 16:56, schrieb Anthony Liguori:
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> ---
>  configure      |   33 +--------------------------------
>  tests/Makefile |   11 ++++++-----
>  2 files changed, 7 insertions(+), 37 deletions(-)

> diff --git a/tests/Makefile b/tests/Makefile
> index cff9ff3..cba482f 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -1,3 +1,7 @@
> +CHECKS=check-qdict check-qfloat check-qint check-qstring check-qlist
> +CHECKS+=check-qjson test-coroutine test-qmp-output-visitor
> +CHECKS+=test-qmp-input-visitor

I think we're using
VAR = value1 value2
VAR += value3 value4
elsewhere (e.g., Makefile.objs), which resembles our Coding Style.

Might it make sense to put coroutine on its own line (so that one can
comment it out) and semantically group the QMP visitors into one line
instead?

Otherwise very nice. Looking forward to using gtester with qtest.

Andreas
Gerd Hoffmann Jan. 10, 2012, 9:17 a.m. UTC | #2
Hi,

While being at it: The check should not be killed.  It should be
replaced by one which checks whenever glib is new enough.  Right now
qemu doesn't build on RHEL-5 because the glib shipped with it is too old
to run the tests.

cheers,
  Gerd

----------------- [ cut here ] -------------------
  CC    test-coroutine.o
cc1: warnings being treated as errors
test-coroutine.c: In function 'test_nesting':
test-coroutine.c:92: warning: implicit declaration of function
'g_assert_cmpint'
test-coroutine.c:92: warning: nested extern declaration of 'g_assert_cmpint'
test-coroutine.c:92: error: expected expression before '==' token
test-coroutine.c:93: error: expected expression before '==' token
test-coroutine.c: In function 'test_yield':
test-coroutine.c:122: error: expected expression before '==' token
test-coroutine.c: In function 'perf_lifecycle':
test-coroutine.c:170: warning: implicit declaration of function
'g_test_timer_start'
test-coroutine.c:170: warning: nested extern declaration of
'g_test_timer_start'
test-coroutine.c:175: warning: implicit declaration of function
'g_test_timer_elapsed'
test-coroutine.c:175: warning: nested extern declaration of
'g_test_timer_elapsed'
test-coroutine.c:177: warning: implicit declaration of function
'g_test_message'
test-coroutine.c:177: warning: nested extern declaration of 'g_test_message'
test-coroutine.c: In function 'main':
test-coroutine.c:182: warning: implicit declaration of function
'g_test_init'
test-coroutine.c:182: warning: nested extern declaration of 'g_test_init'
test-coroutine.c:183: warning: implicit declaration of function
'g_test_add_func'
test-coroutine.c:183: warning: nested extern declaration of
'g_test_add_func'
test-coroutine.c:188: warning: implicit declaration of function
'g_test_perf'
test-coroutine.c:188: warning: nested extern declaration of 'g_test_perf'
test-coroutine.c:191: warning: implicit declaration of function 'g_test_run'
test-coroutine.c:191: warning: nested extern declaration of 'g_test_run'
make: *** [test-coroutine.o] Error 1
Anthony Liguori Jan. 10, 2012, 1:10 p.m. UTC | #3
On 01/10/2012 03:17 AM, Gerd Hoffmann wrote:
>    Hi,
>
> While being at it: The check should not be killed.  It should be
> replaced by one which checks whenever glib is new enough.  Right now
> qemu doesn't build on RHEL-5 because the glib shipped with it is too old
> to run the tests.

Good point.

Regards,

Anthony Liguori

>
> cheers,
>    Gerd
>
> ----------------- [ cut here ] -------------------
>    CC    test-coroutine.o
> cc1: warnings being treated as errors
> test-coroutine.c: In function 'test_nesting':
> test-coroutine.c:92: warning: implicit declaration of function
> 'g_assert_cmpint'
> test-coroutine.c:92: warning: nested extern declaration of 'g_assert_cmpint'
> test-coroutine.c:92: error: expected expression before '==' token
> test-coroutine.c:93: error: expected expression before '==' token
> test-coroutine.c: In function 'test_yield':
> test-coroutine.c:122: error: expected expression before '==' token
> test-coroutine.c: In function 'perf_lifecycle':
> test-coroutine.c:170: warning: implicit declaration of function
> 'g_test_timer_start'
> test-coroutine.c:170: warning: nested extern declaration of
> 'g_test_timer_start'
> test-coroutine.c:175: warning: implicit declaration of function
> 'g_test_timer_elapsed'
> test-coroutine.c:175: warning: nested extern declaration of
> 'g_test_timer_elapsed'
> test-coroutine.c:177: warning: implicit declaration of function
> 'g_test_message'
> test-coroutine.c:177: warning: nested extern declaration of 'g_test_message'
> test-coroutine.c: In function 'main':
> test-coroutine.c:182: warning: implicit declaration of function
> 'g_test_init'
> test-coroutine.c:182: warning: nested extern declaration of 'g_test_init'
> test-coroutine.c:183: warning: implicit declaration of function
> 'g_test_add_func'
> test-coroutine.c:183: warning: nested extern declaration of
> 'g_test_add_func'
> test-coroutine.c:188: warning: implicit declaration of function
> 'g_test_perf'
> test-coroutine.c:188: warning: nested extern declaration of 'g_test_perf'
> test-coroutine.c:191: warning: implicit declaration of function 'g_test_run'
> test-coroutine.c:191: warning: nested extern declaration of 'g_test_run'
> make: *** [test-coroutine.o] Error 1
>
diff mbox

Patch

diff --git a/configure b/configure
index b2e622c..90ad82c 100755
--- a/configure
+++ b/configure
@@ -176,7 +176,6 @@  mixemu="no"
 aix="no"
 blobs="yes"
 pkgversion=""
-check_utests=""
 pie=""
 zero_malloc=""
 trace_backend="nop"
@@ -733,10 +732,6 @@  for opt do
   ;;
   --enable-fdt) fdt="yes"
   ;;
-  --disable-check-utests) check_utests="no"
-  ;;
-  --enable-check-utests) check_utests="yes"
-  ;;
   --disable-nptl) nptl="no"
   ;;
   --enable-nptl) nptl="yes"
@@ -1014,8 +1009,6 @@  echo "  --disable-curl           disable curl connectivity"
 echo "  --enable-curl            enable curl connectivity"
 echo "  --disable-fdt            disable fdt device tree"
 echo "  --enable-fdt             enable fdt device tree"
-echo "  --disable-check-utests   disable check unit-tests"
-echo "  --enable-check-utests    enable check unit-tests"
 echo "  --disable-bluez          disable bluez stack connectivity"
 echo "  --enable-bluez           enable bluez stack connectivity"
 echo "  --disable-slirp          disable SLIRP userspace network connectivity"
@@ -1923,26 +1916,6 @@  EOF
 fi # test "$curl"
 
 ##########################################
-# check framework probe
-
-if test "$check_utests" != "no" ; then
-  cat > $TMPC << EOF
-#include <check.h>
-int main(void) { suite_create("qemu test"); return 0; }
-EOF
-  check_libs=`$pkg_config --libs check 2>/dev/null`
-  if compile_prog "" $check_libs ; then
-    check_utests=yes
-    libs_tools="$check_libs $libs_tools"
-  else
-    if test "$check_utests" = "yes" ; then
-      feature_not_found "check"
-    fi
-    check_utests=no
-  fi
-fi # test "$check_utests"
-
-##########################################
 # bluez support probe
 if test "$bluez" != "no" ; then
   cat > $TMPC << EOF
@@ -2799,10 +2772,7 @@  if test "$softmmu" = yes ; then
     if [ "$guest_agent" = "yes" ]; then
       tools="qemu-ga\$(EXESUF) $tools"
     fi
-    if [ "$check_utests" = "yes" ]; then
-      checks="$checks"
-    fi
-    test_progs="$checks check-qdict check-qfloat check-qint check-qstring check-qlist check-qjson test-coroutine test-qmp-output-visitor test-qmp-input-visitor"
+    test_progs="check-qdict check-qfloat check-qint check-qstring check-qlist check-qjson test-coroutine test-qmp-output-visitor test-qmp-input-visitor"
   fi
 fi
 
@@ -3274,7 +3244,6 @@  if test "$trace_default" = "yes"; then
 fi
 
 echo "TOOLS=$tools" >> $config_host_mak
-echo "CHECKS=$test_progs" >> $config_host_mak
 echo "ROMS=$roms" >> $config_host_mak
 echo "MAKE=$make" >> $config_host_mak
 echo "INSTALL=$install" >> $config_host_mak
diff --git a/tests/Makefile b/tests/Makefile
index cff9ff3..cba482f 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,3 +1,7 @@ 
+CHECKS=check-qdict check-qfloat check-qint check-qstring check-qlist
+CHECKS+=check-qjson test-coroutine test-qmp-output-visitor
+CHECKS+=test-qmp-input-visitor
+
 check-qint.o check-qstring.o check-qdict.o check-qlist.o check-qfloat.o check-qjson.o test-coroutine.o: $(GENERATED_HEADERS)
 
 check-qint: check-qint.o qint.o $(tools-obj-y)
@@ -30,8 +34,5 @@  test-qmp-commands.o: $(addprefix $(qapi-dir)/, test-qapi-types.c test-qapi-types
 test-qmp-commands: test-qmp-commands.o $(qobject-obj-y) $(qapi-obj-y) $(tools-obj-y) $(qapi-dir)/test-qapi-visit.o $(qapi-dir)/test-qapi-types.o $(qapi-dir)/test-qmp-marshal.o module.o
 
 .PHONY: check
-check: $(patsubst %,run-check-%,$(CHECKS))
-
-run-check-%: %
-	./$<
-
+check: $(CHECKS)
+	gtester $(CHECKS)