Skip to contentSkip to conversation

Enable building and running tcg tests on i386

PATCH In review Cleber Rosa 2 participants 12 messages Aug 2, 2017 – Aug 17, 2017

lore
Share & tools
lore
#0 lore raw

cover Enable building and running tcg tests on i386

The primary motivation of this patch series is to get "make -C tests/tcg", on i386, to run. Having all of the individual i386 tcg tests passing is beyond the scope of this patch series, though.

The secondary motivation is to gather feedback on the status of the tcg tests. If you have strong opinions about it, be that they need to be nourished and cared for, that they should be eliminated completely, or anything in between, I'd love to hear about it.

Cleber Rosa(6):
tests/tcg/test_path.c: include utils/bufferiszero.c tests/tcg/linux-test.c: remove unused include of "qemu/cutils.h" tests/tcg/linux-test.c: include definitions for getrusage() tests/tcg/test-i386-fprem: build with $(QEMU_CFLAGS) tests/tcg/test-i386-fprem.c: compilation fix for -Werror=strict-prototype tests/tcg/test-i386-fprem.c: compilation fix for -Werror=unused-const-variable=

 tests/tcg/Makefile          |  2 +-
 tests/tcg/linux-test.c      |  2 +-
 tests/tcg/test-i386-fprem.c | 17 +----------------
 tests/tcg/test_path.c       |  1 +
4 files changed, 4 insertions(+), 18 deletions(-)
#1 lore raw

PATCH 1/6 tests/tcg/test_path.c: include utils/bufferiszero.c

Which contains one specific function used by iov.c.

Without this, "make -C tests/tcg test_path" (and consequently "make -C tests/tcg" or simply "make test") fails quite early.

---
 tests/tcg/test_path.c | 1 +
 1 file changed, 1 insertion(+)
tests/tcg/test_path.c +1 -0
index 1c29bce..74dbdaf 100644
@@ -3,6 +3,7 @@
 #include "util/cutils.c"
 #include "util/hexdump.c"
 #include "util/iov.c"
+#include "util/bufferiszero.c"
 #include "util/path.c"
 #include "util/qemu-timer-common.c"
 #include <stdarg.h>
Signature · 1 line
2.9.4
#2 lore raw

Re: [Qemu-devel] [PATCH 1/6] tests/tcg/test_path.c: include utils/bufferiszero.c

Hi Cleber,

Quoted 15 lines · Cleber Rosa

Which contains one specific function used by iov.c.

Without this, "make -C tests/tcg test_path" (and consequently "make -C tests/tcg" or simply "make test") fails quite early.

---
  tests/tcg/test_path.c | 1 +
  1 file changed, 1 insertion(+)
tests/tcg/test_path.c +0 -0
index 1c29bce..74dbdaf 100644

tests/tcg/test_path.c line 6

Quoted 4 lines
tests/tcg/test_path.c +1 -0
@@ -3,6 +3,7 @@
  #include "util/cutils.c"
  #include "util/hexdump.c"
  #include "util/iov.c"
+#include "util/bufferiszero.c"

This fixes the build, however why not take this opportunity to fix it through the Makefile instead of including .c?

Regards,

Phil.

Quoted 4 lines
tests/tcg/test_path.c +0 -0
  #include "util/path.c"
  #include "util/qemu-timer-common.c"
  #include <stdarg.h>
#3 lore raw

Re: [Qemu-devel] [PATCH 1/6] tests/tcg/test_path.c: include utils/bufferiszero.c

Quoted 13 lines · Philippe Mathieu-Daudé

Hi Cleber,

Quoted 10 lines · Cleber Rosa

Which contains one specific function used by iov.c.

Without this, "make -C tests/tcg test_path" (and consequently "make -C tests/tcg" or simply "make test") fails quite early.

---
  tests/tcg/test_path.c | 1 +
  1 file changed, 1 insertion(+)
Quoted 13 lines

tests/tcg/test_path.c line 6

Quoted 9 lines
tests/tcg/test_path.c +1 -0
index 1c29bce..74dbdaf 100644
@@ -3,6 +3,7 @@
  #include "util/cutils.c"
  #include "util/hexdump.c"
  #include "util/iov.c"
+#include "util/bufferiszero.c"

This fixes the build, however why not take this opportunity to fix it through the Makefile instead of including .c?

Do you mean for all of the .c includes? I just took a baby step, which seemed more consistent with the mission (get it to build), without changing a lot.

Quoted 4 lines

Regards,

Phil.

Thanks for the review!
- Cleber.

Quoted 4 lines
Quoted 4 lines
tests/tcg/test_path.c +0 -0
  #include "util/path.c"
  #include "util/qemu-timer-common.c"
  #include <stdarg.h>
Signature · 4 lines
Cleber Rosa
[ Sr Software Engineer - Virtualization Team - Red Hat ]
[ Avocado Test Framework - avocado-framework.github.io ]
[  7ABB 96EB 8B46 B94D 5E0F  E9BB 657E 8D33 A5F2 09F3  ]
#4 lore raw

Re: [Qemu-devel] [PATCH 1/6] tests/tcg/test_path.c: include utils/bufferiszero.c

Quoted 30 lines · Cleber Rosa
Quoted 13 lines · Philippe Mathieu-Daudé

Hi Cleber,

Quoted 10 lines · Cleber Rosa

Which contains one specific function used by iov.c.

Without this, "make -C tests/tcg test_path" (and consequently "make -C tests/tcg" or simply "make test") fails quite early.

---
  tests/tcg/test_path.c | 1 +
  1 file changed, 1 insertion(+)
Quoted 13 lines

tests/tcg/test_path.c line 6

Quoted 9 lines
tests/tcg/test_path.c +1 -0
index 1c29bce..74dbdaf 100644
@@ -3,6 +3,7 @@
  #include "util/cutils.c"
  #include "util/hexdump.c"
  #include "util/iov.c"
+#include "util/bufferiszero.c"

This fixes the build, however why not take this opportunity to fix it through the Makefile instead of including .c?

Quoted 4 lines

Do you mean for all of the .c includes? I just took a baby step, which seemed more consistent with the mission (get it to build), without changing a lot.

Hi Phil,

Can you clarify what you meant here?

Thanks!

Signature · 4 lines
Cleber Rosa
[ Sr Software Engineer - Virtualization Team - Red Hat ]
[ Avocado Test Framework - avocado-framework.github.io ]
[  7ABB 96EB 8B46 B94D 5E0F  E9BB 657E 8D33 A5F2 09F3  ]
#5 lore raw

PATCH 2/6 tests/tcg/linux-test.c: remove unused include of "qemu/cutils.h"

In reply to Cleber Rosa

Building tests/tcg/linux-test is not currently possible because $(QEMU_INCLUDES) is not being passed to $(CC_I386). But, since it's not really used, instead of adding the $(QEMU_INCLUDES), let's remove the "qemu/ctuils.h" include instead.

---
 tests/tcg/linux-test.c | 1 -
 1 file changed, 1 deletion(-)
tests/tcg/linux-test.c +0 -1
index 5070d31..1c6c013 100644
@@ -39,7 +39,6 @@
 #include <dirent.h>
 #include <setjmp.h>
 #include <sys/shm.h>
-#include "qemu/cutils.h"
 
 #define TESTPATH "/tmp/linux-test.tmp"
 #define TESTPORT 7654
Signature · 1 line
2.9.4
#6 lore raw

PATCH 3/6 tests/tcg/linux-test.c: include definitions for getrusage()

In reply to Cleber Rosa

A include for <sys/resources.h> is missing, and prevents tests/tcg/linux-test from compiling.

---
 tests/tcg/linux-test.c | 1 +
 1 file changed, 1 insertion(+)
tests/tcg/linux-test.c +1 -0
index 1c6c013..15c9d7f 100644
@@ -39,6 +39,7 @@
 #include <dirent.h>
 #include <setjmp.h>
 #include <sys/shm.h>
+#include <sys/resource.h>
 
 #define TESTPATH "/tmp/linux-test.tmp"
 #define TESTPORT 7654
Signature · 1 line
2.9.4
Reviewed-by on v1 3/6
#7 lore raw

Re: [Qemu-devel] [PATCH 3/6] tests/tcg/linux-test.c: include definitions for getrusage()

Hi Cleber,

Quoted 2 lines · Cleber Rosa

A include for <sys/resources.h> is missing, and prevents tests/tcg/linux-test from compiling.

getrusage() I presume, don't know if worth adding in commit message.

Quoted 2 lines
Quoted 17 lines
---
  tests/tcg/linux-test.c | 1 +
  1 file changed, 1 insertion(+)
tests/tcg/linux-test.c +1 -0
index 1c6c013..15c9d7f 100644
@@ -39,6 +39,7 @@
  #include <dirent.h>
  #include <setjmp.h>
  #include <sys/shm.h>
+#include <sys/resource.h>
 
  #define TESTPATH "/tmp/linux-test.tmp"
  #define TESTPORT 7654
#8 lore raw

Re: [Qemu-devel] [PATCH 3/6] tests/tcg/linux-test.c: include definitions for getrusage()

Quoted 9 lines · Philippe Mathieu-Daudé

Hi Cleber,

Quoted 3 lines · Cleber Rosa

A include for <sys/resources.h> is missing, and prevents tests/tcg/linux-test from compiling.

getrusage() I presume, don't know if worth adding in commit message.

Sorry I missed it from the commit subject :/

Quoted 25 lines
Quoted 3 lines
Quoted 16 lines
---
  tests/tcg/linux-test.c | 1 +
  1 file changed, 1 insertion(+)
tests/tcg/linux-test.c +1 -0
index 1c6c013..15c9d7f 100644
@@ -39,6 +39,7 @@
  #include <dirent.h>
  #include <setjmp.h>
  #include <sys/shm.h>
+#include <sys/resource.h>
    #define TESTPATH "/tmp/linux-test.tmp"
  #define TESTPORT 7654
 
#9 lore raw

PATCH 4/6 tests/tcg/test-i386-fprem: build with $(QEMU_CFLAGS)

In reply to Cleber Rosa

So that glib.h can be found.

---
 tests/tcg/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/tcg/Makefile +1 -1
index 89e3342..c946fde 100644
@@ -98,7 +98,7 @@ test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S \
               $(<D)/test-i386.c $(<D)/test-i386-code16.S $(<D)/test-i386-vm86.S -lm
 
 test-i386-fprem: test-i386-fprem.c
-	$(CC_I386) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ $^
+	$(CC_I386) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^
 
 test-x86_64: test-i386.c \
            test-i386.h test-i386-shift.h test-i386-muldiv.h
Signature · 1 line
2.9.4
#10 lore raw

PATCH 5/6 tests/tcg/test-i386-fprem.c: compilation fix for -Werror=strict-prototype

In reply to Cleber Rosa

A trivial fix to make the compiler happy.

---
 tests/tcg/test-i386-fprem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/tcg/test-i386-fprem.c +1 -1
index 1a71623..f70363d 100644
@@ -98,7 +98,7 @@ static const union float80u smallest_positive_norm = {
     .ieee.mantissa = 0,
 };
 
-static void fninit()
+static void fninit(void)
 {
     asm volatile ("fninit\n");
 }
Signature · 1 line
2.9.4
#11 lore raw

PATCH 6/6 tests/tcg/test-i386-fprem.c: compilation fix for -Werror=unused-const-variable=

In reply to Cleber Rosa

A clean up of unused code to make the compiler happy.

---
 tests/tcg/test-i386-fprem.c | 15 ---------------
 1 file changed, 15 deletions(-)
tests/tcg/test-i386-fprem.c +0 -15
index f70363d..1dceda0 100644
@@ -54,14 +54,6 @@ union float80u {
 
 #define IEEE854_LONG_DOUBLE_BIAS 0x3fff
 
-static const union float80u q_nan = {
-    .ieee_nan.negative = 0,  /* X */
-    .ieee_nan.exponent = 0x7fff,
-    .ieee_nan.one = 1,
-    .ieee_nan.quiet_nan = 1,
-    .ieee_nan.mantissa = 0,
-};
-
 static const union float80u s_nan = {
     .ieee_nan.negative = 0,  /* X */
     .ieee_nan.exponent = 0x7fff,
@@ -91,13 +83,6 @@ static const union float80u pos_denorm = {
     .ieee.mantissa = 1,
 };
 
-static const union float80u smallest_positive_norm = {
-    .ieee.negative = 0,
-    .ieee.exponent = 1,
-    .ieee.one = 1,
-    .ieee.mantissa = 0,
-};
-
 static void fninit(void)
 {
     asm volatile ("fninit\n");
Signature · 1 line
2.9.4