diff mbox

[PATCHv4] tests/tcg: fix build

Message ID 1350416255-6428-1-git-send-email-catalinp@google.com
State New
Headers show

Commit Message

Catalin Patulea Oct. 16, 2012, 7:37 p.m. UTC
Fixes compile line for test-x86_64 target as well.

---
This broke when the tests were moved from tests/ to tests/tcg/.

On x86_64 host/i386-linux-user non-kvm guest, test-i386 and test-mmap are broken, but at least they build.

To build/run the tests:
$ cd $BUILD_PATH/tests/tcg
$ SRC_PATH=path/to/qemu make <target>
---
 tests/tcg/Makefile     |   18 +++++++++++-------
 tests/tcg/linux-test.c |    2 ++
 tests/tcg/test-i386.c  |    3 ++-
 tests/tcg/test_path.c  |   13 +++++++------
 4 files changed, 22 insertions(+), 14 deletions(-)

Comments

Peter Maydell Oct. 16, 2012, 7:54 p.m. UTC | #1
On 16 October 2012 20:37, Catalin Patulea <catalinp@google.com> wrote:
> Fixes compile line for test-x86_64 target as well.
>
> ---
> This broke when the tests were moved from tests/ to tests/tcg/.
>
> On x86_64 host/i386-linux-user non-kvm guest, test-i386 and test-mmap are broken, but at least they build.
>
> To build/run the tests:
> $ cd $BUILD_PATH/tests/tcg
> $ SRC_PATH=path/to/qemu make <target>
> ---

This patch isn't in the right format to apply, I'm afraid.
Major problem:
 * missing signed-off-by line: we can't accept any patch
   without one
Minor problem:
 * the actual commit message is below the first '---' line,
   so 'git am' won't see it. Commit messages go above '---',
   "what I changed in this version' notes below.

'git format-patch' will produce things in the right format
(though you have to put the signed-off-by line in your commit
message yourself.)

thanks
-- PMM
Catalin Patulea Oct. 16, 2012, 7:57 p.m. UTC | #2
On Tue, Oct 16, 2012 at 3:54 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> This patch isn't in the right format to apply, I'm afraid.
> Major problem:
>  * missing signed-off-by line: we can't accept any patch
>    without one
> Minor problem:
>  * the actual commit message is below the first '---' line,
>    so 'git am' won't see it. Commit messages go above '---',
>    "what I changed in this version' notes below.
I saw this format (notes, commit message, diffstat) on another list
and assumed git am could handle this properly.

It just seems strange to write the note somewhere *below* the commit
message - the notes should be the first thing people read, and below
them is the complete proposed patch. Is there any way to achieve that?

Meanwhile, I'll reformat and resend the patch.
Peter Maydell Oct. 16, 2012, 8:09 p.m. UTC | #3
On 16 October 2012 20:57, Catalin Patulea <catalinp@google.com> wrote:
> On Tue, Oct 16, 2012 at 3:54 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
>> This patch isn't in the right format to apply, I'm afraid.
>> Major problem:
>>  * missing signed-off-by line: we can't accept any patch
>>    without one
>> Minor problem:
>>  * the actual commit message is below the first '---' line,
>>    so 'git am' won't see it. Commit messages go above '---',
>>    "what I changed in this version' notes below.
> I saw this format (notes, commit message, diffstat) on another list
> and assumed git am could handle this properly.
>
> It just seems strange to write the note somewhere *below* the commit
> message - the notes should be the first thing people read, and below
> them is the complete proposed patch. Is there any way to achieve that?

I think there may be options that permit that, but the default 'git am'
doesn't. Since people usually just 'git am' patch mails, we've had
the odd case before where the commit message has got mangled because
the email was in the wrong order.

A lot of this is basically community convention, so it differs
from project to project; this is just how qemu-devel does things.

Personally I like the "commit message first" bit -- that's the important
part that will stay around in git and needs to be a self-contained
description. The below the '---' notes are more like footnotes :-)

> Meanwhile, I'll reformat and resend the patch.

Thanks!

-- PMM
diff mbox

Patch

diff --git a/tests/tcg/Makefile b/tests/tcg/Makefile
index 15e36a2..80b1a4b 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,12 +90,12 @@  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 \
            test-i386.h test-i386-shift.h test-i386-muldiv.h
-	$(CC_X86_64) $(CFLAGS) $(LDFLAGS) -o $@ $(<D)/test-i386.c -lm
+	$(CC_X86_64) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ $(<D)/test-i386.c -lm
 
 # generic Linux and CPU test
 linux-test: linux-test.c
diff --git a/tests/tcg/linux-test.c b/tests/tcg/linux-test.c
index 2e4a746..83cb32d 100644
--- a/tests/tcg/linux-test.c
+++ b/tests/tcg/linux-test.c
@@ -16,6 +16,7 @@ 
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
+#define _GNU_SOURCE
 #include <stdarg.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -38,6 +39,7 @@ 
 #include <dirent.h>
 #include <setjmp.h>
 #include <sys/shm.h>
+#include <sched.h>
 
 #define TESTPATH "/tmp/linux-test.tmp"
 #define TESTPORT 7654
diff --git a/tests/tcg/test-i386.c b/tests/tcg/test-i386.c
index 8e64bba..64d929e 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>
@@ -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>