Patchwork [v2] Get tests/tcg building and fix an unused variable warning due to wrong extended asm operands.

login
register
mail settings
Submitter Catalin Patulea
Date July 16, 2012, 8:11 p.m.
Message ID <1342469507-13064-1-git-send-email-catalinp@google.com>
Download mbox | patch
Permalink /patch/171244/
State New
Headers show

Comments

Catalin Patulea - July 16, 2012, 8:11 p.m.
To build/run the tests:
$ cd $BUILD_PATH/tests/tcg
$ SRC_PATH=path/to/qemu make <target>

Signed-off-by: Catalin Patulea <catalinp@google.com>
---
This should also fix the lock nop error. I just peeked at what bytes my gcc
(4.4.3) generates.

 tests/tcg/Makefile    |   16 ++++++++++------
 tests/tcg/test-i386.c |    5 +++--
 tests/tcg/test_path.c |   13 +++++++------
 3 files changed, 20 insertions(+), 14 deletions(-)
Peter Maydell - July 16, 2012, 9:19 p.m.
On 16 July 2012 21:11, Catalin Patulea <catalinp@google.com> wrote:
> To build/run the tests:
> $ cd $BUILD_PATH/tests/tcg
> $ SRC_PATH=path/to/qemu make <target>
>
> Signed-off-by: Catalin Patulea <catalinp@google.com>
> ---
> This should also fix the lock nop error. I just peeked at what bytes my gcc
> (4.4.3) generates.

Yep, this all builds for me now.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

(Your Subject: is kinda long and veering close to violating the
'don't do two things in a patch' rule, but I've been picky enough
with other peoples' patches tonight, so I'll let it pass :-))

-- PMM
Catalin Patulea - July 20, 2012, 11:23 p.m.
On Mon, Jul 16, 2012 at 5:19 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 16 July 2012 21:11, Catalin Patulea <catalinp@google.com> wrote:
>> To build/run the tests:
>> $ cd $BUILD_PATH/tests/tcg
>> $ SRC_PATH=path/to/qemu make <target>
>>
>> Signed-off-by: Catalin Patulea <catalinp@google.com>
>> ---
>> This should also fix the lock nop error. I just peeked at what bytes my gcc
>> (4.4.3) generates.
>
> Yep, this all builds for me now.
This this ever get committed? It may very well be in a branch
somewhere on its way in, I just did a git pull and had expected to see
it.
Peter Maydell - July 21, 2012, 9:05 a.m.
On 21 July 2012 00:23, Catalin Patulea <catalinp@google.com> wrote:
> On Mon, Jul 16, 2012 at 5:19 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
>> On 16 July 2012 21:11, Catalin Patulea <catalinp@google.com> wrote:
>>> To build/run the tests:
>>> $ cd $BUILD_PATH/tests/tcg
>>> $ SRC_PATH=path/to/qemu make <target>
>>>
>>> Signed-off-by: Catalin Patulea <catalinp@google.com>
>>> ---
>>> This should also fix the lock nop error. I just peeked at what bytes my gcc
>>> (4.4.3) generates.
>>
>> Yep, this all builds for me now.
> This this ever get committed? It may very well be in a branch
> somewhere on its way in, I just did a git pull and had expected to see
> it.

You need to wait for somebody with commit access to commit it (probably
Anthony or Blue). Patches can take a couple of weeks to get into git
master. Ping the patch every week or two if it seems to be getting forgotten.

-- PMM

Patch

diff --git a/tests/tcg/Makefile b/tests/tcg/Makefile
index 15e36a2..9ff47b8 100644
--- a/tests/tcg/Makefile
+++ b/tests/tcg/Makefile
@@ -1,13 +1,13 @@ 
--include ../config-host.mak
+-include ../../config-host.mak
 -include $(SRC_PATH)/rules.mak
 
-$(call set-vpath, $(SRC_PATH)/tests)
+$(call set-vpath, $(SRC_PATH)/tests/tcg)
 
-QEMU=../i386-linux-user/qemu-i386
-QEMU_X86_64=../x86_64-linux-user/qemu-x86_64
+QEMU=../../i386-linux-user/qemu-i386
+QEMU_X86_64=../../x86_64-linux-user/qemu-x86_64
 CC_X86_64=$(CC_I386) -m64
 
-QEMU_INCLUDES += -I..
+QEMU_INCLUDES += -I../..
 CFLAGS=-Wall -O2 -g -fno-strict-aliasing
 #CFLAGS+=-msse2
 LDFLAGS=
@@ -36,6 +36,7 @@  TESTS += $(I386_TESTS)
 endif
 
 all: $(patsubst %,run-%,$(TESTS))
+test: all
 
 # rules to run tests
 
@@ -74,7 +75,10 @@  run-test_path: test_path
 # rules to compile tests
 
 test_path: test_path.o
+	$(CC_I386) $(LDFLAGS) -o $@ $^ $(LIBS)
+
 test_path.o: test_path.c
+	$(CC_I386) $(QEMU_INCLUDES) $(GLIB_CFLAGS) $(CFLAGS) -c -o $@ $^
 
 hello-i386: hello-i386.c
 	$(CC_I386) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $<
@@ -86,7 +90,7 @@  testthread: testthread.c
 # i386/x86_64 emulation test (test various opcodes) */
 test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S \
            test-i386.h test-i386-shift.h test-i386-muldiv.h
-	$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ \
+	$(CC_I386) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ \
               $(<D)/test-i386.c $(<D)/test-i386-code16.S $(<D)/test-i386-vm86.S -lm
 
 test-x86_64: test-i386.c \
diff --git a/tests/tcg/test-i386.c b/tests/tcg/test-i386.c
index 8e64bba..40392ac 100644
--- a/tests/tcg/test-i386.c
+++ b/tests/tcg/test-i386.c
@@ -17,6 +17,7 @@ 
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #define _GNU_SOURCE
+#include "compiler.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -784,7 +785,7 @@  void fpu_clear_exceptions(void)
         long double fpregs[8];
     } float_env32;
 
-    asm volatile ("fnstenv %0\n" : : "m" (float_env32));
+    asm volatile ("fnstenv %0\n" : "=m" (float_env32));
     float_env32.fpus &= ~0x7f;
     asm volatile ("fldenv %0\n" : : "m" (float_env32));
 }
@@ -1827,7 +1828,7 @@  void test_exceptions(void)
     printf("lock nop exception:\n");
     if (setjmp(jmp_env) == 0) {
         /* now execute an invalid instruction */
-        asm volatile("lock nop");
+        asm volatile(".byte 0xf0, 0x90"); /* lock nop */
     }
 
     printf("INT exception:\n");
diff --git a/tests/tcg/test_path.c b/tests/tcg/test_path.c
index 7265a94..a064eea 100644
--- a/tests/tcg/test_path.c
+++ b/tests/tcg/test_path.c
@@ -1,11 +1,12 @@ 
 /* Test path override code */
-#include "../config-host.h"
-#include "../qemu-malloc.c"
-#include "../cutils.c"
-#include "../path.c"
-#include "../trace.c"
+#define _GNU_SOURCE
+#include "config-host.h"
+#include "iov.c"
+#include "cutils.c"
+#include "path.c"
+#include "trace.c"
 #ifdef CONFIG_TRACE_SIMPLE
-#include "../simpletrace.c"
+#include "../trace/simple.c"
 #endif
 
 #include <stdarg.h>