Skip to contentSkip to conversation

First part of autoconfy series: cleanup tests/

PATCH Applied Paolo Bonzini 3 participants 13 messages Oct 21, 2010 – Oct 23, 2010

lore
Share & tools
lore
#0 lore raw

cover First part of autoconfy series: cleanup tests/

This is a small start from the autoconfy configure series. Actually, this part is almost completely new. It cleans up the tests Makefile so that the i386-linux-user testsuite's Makefile targets are more easily extensible and can work wherever a compiler for i386 is installed. In the future this could be extended to ARM and MIPS targets.

Paolo Bonzini (6):
unbreak "make" from tests directory
unbreak "make" from vpath-built tests directory
disable test_enter on i386, it is broken
make runcom compile on recent distributions
fix test_path
rewrite i386 tests Makefile

 configure         |    5 ++
 rules.mak         |    9 ++++
 tests/Makefile    |  123 ++++++++++++++++++++++++++++++++++------------------
 tests/runcom.c    |   11 ++---
 tests/test-i386.c |    5 ++
 tests/test_path.c |   13 +++++-
 6 files changed, 114 insertions(+), 52 deletions(-)
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH 1/6 unbreak "make" from tests directory

---
 configure |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
configure +1 -0
index d303061..d076447 100755
@@ -2333,6 +2333,7 @@ printf "# Configured with:" >> $config_host_mak
 printf " '%s'" "$0" "$@" >> $config_host_mak
 echo >> $config_host_mak
 
+echo all: >> $config_host_mak
 echo "prefix=$prefix" >> $config_host_mak
 echo "bindir=$bindir" >> $config_host_mak
 echo "mandir=$mandir" >> $config_host_mak
Signature · 1 line
1.7.2.3
#2 lore raw

PATCH 2/6 unbreak "make" from vpath-built tests directory

In reply to Paolo Bonzini
---
 tests/Makefile |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tests/Makefile +1 -0
index ff7f787..e26b2d7 100644
@@ -1,4 +1,5 @@
 -include ../config-host.mak
+-include $(SRC_PATH)/rules.mak
 
 $(call set-vpath, $(SRC_PATH)/tests)
 
Signature · 1 line
1.7.2.3
#3 lore raw

PATCH 3/6 disable test_enter on i386, it is broken

In reply to Paolo Bonzini

Many other tests fail, but this has an infinite loop with both qemu-i386 and native execution (albeit on x86_64), so there is something more going on. I'm not going to debug it now, so just disable the test.

---
 tests/test-i386.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
tests/test-i386.c +5 -0
index b28b257..fea4062 100644
@@ -2047,6 +2047,10 @@ long enter_stack[4096];
 #define RBP "%%ebp"
 #endif
 
+#if !defined(__x86_64__)
+/* causes an infinite loop, disable it for now.  */
+#define TEST_ENTER(size, stack_type, level) 
+#else
 #define TEST_ENTER(size, stack_type, level)\
 {\
     long esp_save, esp_val, ebp_val, ebp_save, i;\
@@ -2078,6 +2082,7 @@ long enter_stack[4096];
     for(ptr = (stack_type *)esp_val; ptr < stack_end; ptr++)\
         printf(FMTLX "\n", (long)ptr[0]);\
 }
+#endif
 
 static void test_enter(void)
 {
Signature · 1 line
1.7.2.3
#4 lore raw

PATCH 4/6 make runcom compile on recent distributions

In reply to Paolo Bonzini
---
 tests/runcom.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
tests/runcom.c +4 -7
index 6380566..d60342b 100644
@@ -13,15 +13,12 @@
 #include <linux/unistd.h>
 #include <asm/vm86.h>
 
-//#define SIGTEST
+extern int vm86 (unsigned long int subfunction,
+		 struct vm86plus_struct *info);
 
-#undef __syscall_return
-#define __syscall_return(type, res) \
-do { \
-	return (type) (res); \
-} while (0)
+#define VIF_MASK                0x00080000
 
-_syscall2(int, vm86, int, func, struct vm86plus_struct *, v86)
+//#define SIGTEST
 
 #define COM_BASE_ADDR    0x10100
 
Signature · 1 line
1.7.2.3
#5 lore raw

PATCH 5/6 fix test_path

In reply to Paolo Bonzini

path.c grew quite a few new dependencies (mostly via cutils.c), include them.

---
 tests/Makefile    |    2 +-
 tests/test_path.c |   13 +++++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)
tests/Makefile +1 -1
index e26b2d7..ef575a4 100644
@@ -3,7 +3,7 @@
 
 $(call set-vpath, $(SRC_PATH)/tests)
 
-CFLAGS=-Wall -O2 -g -fno-strict-aliasing
+CFLAGS=-Wall -O2 -g -fno-strict-aliasing -I..
 #CFLAGS+=-msse2
 LDFLAGS=
 
tests/test_path.c +11 -2
index def7441..234ed97 100644
@@ -1,12 +1,21 @@
 /* Test path override code */
-#define _GNU_SOURCE
+#include "../config-host.h"
+#include "../qemu-malloc.c"
+#include "../cutils.c"
 #include "../path.c"
+#include "../trace.c"
+#ifdef CONFIG_SIMPLE_TRACE
+#include "../simpletrace.c"
+#endif
+
 #include <stdarg.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 
+void qemu_log(const char *fmt, ...);
+
 /* Any log message kills the test. */
-void gemu_log(const char *fmt, ...)
+void qemu_log(const char *fmt, ...)
 {
     va_list ap;
 
Signature · 1 line
1.7.2.3
#6 lore raw

PATCH 6/6 rewrite i386 tests Makefile

In reply to Paolo Bonzini

1) compute path to i386 compiler from configure. If it is found, run the i386 tests. I use macros so that this approach could be applied for other arches as well.

2) provide an easily extensible way to add tests

Most tests fail, but at least "make test" does something meaningful.

---
Note: I have no interesting in analyzing/fixing the failures.

 configure      |    4 ++
 rules.mak      |    9 ++++
 tests/Makefile |  120 ++++++++++++++++++++++++++++++++++++-------------------
 3 files changed, 91 insertions(+), 42 deletions(-)
configure +4 -0
index d076447..8c8d4d3 100755
@@ -92,6 +92,7 @@ libs_softmmu=""
 libs_tools=""
 audio_pt_int=""
 audio_win_int=""
+cc_i386=i386-pc-linux-gnu-gcc
 
 # parse CC options first
 for opt do
@@ -789,12 +790,14 @@ case "$cpu" in
     i386)
            QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
            LDFLAGS="-m32 $LDFLAGS"
+           cc_i386='$(CC) -m32'
            helper_cflags="-fomit-frame-pointer"
            host_guest_base="yes"
            ;;
     x86_64)
            QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
            LDFLAGS="-m64 $LDFLAGS"
+           cc_i386='$(CC) -m32'
            host_guest_base="yes"
            ;;
     arm*)
@@ -2622,6 +2625,7 @@ echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
 echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
 echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
 echo "CC=$cc" >> $config_host_mak
+echo "CC_I386=$cc_i386" >> $config_host_mak
 echo "HOST_CC=$host_cc" >> $config_host_mak
 if test "$sparse" = "yes" ; then
   echo "CC      := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
rules.mak +9 -0
index c843a13..6dac777 100644
@@ -42,6 +42,15 @@ cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \
 VPATH_SUFFIXES = %.c %.h %.S %.m %.mak %.texi
 set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1)))
 
+# find-in-path
+# Usage: $(call find-in-path, prog)
+# Looks in the PATH if the argument contains no slash, else only considers one
+# specific directory.  Returns an # empty string if the program doesn't exist
+# there.
+find-in-path = $(if $(find-string /, $1), \
+        $(wildcard $1), \
+        $(wildcard $(patsubst %, %/$1, $(subst :, ,$(PATH)))))
+
 # Generate timestamp files for .h include files
 
 %.h: %.h-timestamp
tests/Makefile +78 -42

160 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#7 lore raw
In reply to Paolo Bonzini
Quoted 6 lines · On Thu, 21 Oct 2010 10:18:34 +0200 Paolo Bonzini <[email protected]> wrote:

This is a small start from the autoconfy configure series. Actually, this part is almost completely new. It cleans up the tests Makefile so that the i386-linux-user testsuite's Makefile targets are more easily extensible and can work wherever a compiler for i386 is installed. In the future this could be extended to ARM and MIPS targets.

This is unrelated to this series, but something that would be very good to have would be to move all check- programs to tests/ (or check/) and make them part of 'make test' or introduce a new 'make check'.

Quoted 17 lines

Paolo Bonzini (6):
unbreak "make" from tests directory
unbreak "make" from vpath-built tests directory
disable test_enter on i386, it is broken
make runcom compile on recent distributions
fix test_path
rewrite i386 tests Makefile

 configure         |    5 ++
 rules.mak         |    9 ++++
 tests/Makefile    |  123 ++++++++++++++++++++++++++++++++++------------------
 tests/runcom.c    |   11 ++---
 tests/test-i386.c |    5 ++
 tests/test_path.c |   13 +++++-
 6 files changed, 114 insertions(+), 52 deletions(-)
#8 lore raw
Quoted 10 lines · Luiz Capitulino
Quoted 6 lines · On Thu, 21 Oct 2010 10:18:34 +0200 Paolo Bonzini<[email protected]> wrote:

This is a small start from the autoconfy configure series. Actually, this part is almost completely new. It cleans up the tests Makefile so that the i386-linux-user testsuite's Makefile targets are more easily extensible and can work wherever a compiler for i386 is installed. In the future this could be extended to ARM and MIPS targets.

Quoted 3 lines

This is unrelated to this series, but something that would be very good to have would be to move all check- programs to tests/ (or check/) and make them part of 'make test' or introduce a new 'make check'.

Right, I thought about that too. The main hurdle is that: 1) right now almost every test in "make test" is failing; 2) the testsuite run by "make test" is very noisy, does not create logs, etc. If we could use autotest... :)

We could also have check-i386, check-qmp, etc. and check would simply call all of them.

Paolo

#9 lore raw
Quoted 11 lines · On Fri, 22 Oct 2010 15:38:34 +0200 Paolo Bonzini <[email protected]> wrote:
Quoted 10 lines · Luiz Capitulino
Quoted 6 lines · On Thu, 21 Oct 2010 10:18:34 +0200 Paolo Bonzini<[email protected]> wrote:

This is a small start from the autoconfy configure series. Actually, this part is almost completely new. It cleans up the tests Makefile so that the i386-linux-user testsuite's Makefile targets are more easily extensible and can work wherever a compiler for i386 is installed. In the future this could be extended to ARM and MIPS targets.

Quoted 6 lines
Quoted 3 lines

This is unrelated to this series, but something that would be very good to have would be to move all check- programs to tests/ (or check/) and make them part of 'make test' or introduce a new 'make check'.

Right, I thought about that too. The main hurdle is that: 1) right now almost every test in "make test" is failing;

Yeah, just saw that.

Quoted 6 lines

2) the testsuite run by
"make test" is very noisy, does not create logs, etc. If we could use autotest... :)

We could also have check-i386, check-qmp, etc. and check would simply call all of them.

That would be perfect, I think. I mean, if we could stick only to check to do all our unit-testing, then it would be easier to setup autotest around it.

But we'll have to port current tests to it, of course.

#10 lore raw
Quoted 5 lines · Luiz Capitulino
Quoted 2 lines

We could also have check-i386, check-qmp, etc. and check would simply call all of them.

That would be perfect, I think. I mean, if we could stick only to check to do all our unit-testing

Well, the current "make test" is more integration testing than unit testing, so I'm not sure check can work for that. But autotest can, which is why I mentioned it.

Paolo

#11 lore raw
Quoted 10 lines · On Fri, 22 Oct 2010 15:53:39 +0200 Paolo Bonzini <[email protected]> wrote:
Quoted 5 lines · Luiz Capitulino
Quoted 2 lines

We could also have check-i386, check-qmp, etc. and check would simply call all of them.

That would be perfect, I think. I mean, if we could stick only to check to do all our unit-testing

Well, the current "make test" is more integration testing than unit testing, so I'm not sure check can work for that. But autotest can, which is why I mentioned it.

Ah, got it.

Applied
#12 lore raw
In reply to Paolo Bonzini

Thanks, applied all.

Quoted 28 lines · Paolo Bonzini

This is a small start from the autoconfy configure series.  Actually, this part is almost completely new.  It cleans up the tests Makefile so that the i386-linux-user testsuite's Makefile targets are more easily extensible and can work wherever a compiler for i386 is installed.  In the future this could be extended to ARM and MIPS targets.

Paolo Bonzini (6):
 unbreak "make" from tests directory
 unbreak "make" from vpath-built tests directory
 disable test_enter on i386, it is broken
 make runcom compile on recent distributions
 fix test_path
 rewrite i386 tests Makefile

 configure         |    5 ++
 rules.mak         |    9 ++++
 tests/Makefile    |  123 ++++++++++++++++++++++++++++++++++------------------ tests/runcom.c    |   11 ++---
 tests/test-i386.c |    5 ++
 tests/test_path.c |   13 +++++-

 6 files changed, 114 insertions(+), 52 deletions(-)

--
1.7.2.3