public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Asias He <asias.hejun@gmail.com>
To: kvm@vger.kernel.org, Avi Kivity <avi@redhat.com>,
	Naphtali Sprei <nsprei@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>
Subject: [PATCH 2/2] qemu-kvm tests: make sieve test runable on 32-bit host
Date: Mon,  7 Jun 2010 23:11:38 +0800	[thread overview]
Message-ID: <1275923498-8999-2-git-send-email-asias.hejun@gmail.com> (raw)
In-Reply-To: <1275923498-8999-1-git-send-email-asias.hejun@gmail.com>

Signed-off-by: Asias He <asias.hejun@gmail.com>
---
 kvm/test/config-x86-common.mak |    4 +-
 kvm/test/config-x86_64.mak     |    4 +-
 kvm/test/x86/sieve.c           |   48 ++++-----------------------------------
 3 files changed, 9 insertions(+), 47 deletions(-)

diff --git a/kvm/test/config-x86-common.mak b/kvm/test/config-x86-common.mak
index 38dbf5a..c97de52 100644
--- a/kvm/test/config-x86-common.mak
+++ b/kvm/test/config-x86-common.mak
@@ -25,7 +25,7 @@ FLATLIBS = lib/libcflat.a $(libgcc)
 tests-common = $(TEST_DIR)/vmexit.flat $(TEST_DIR)/tsc.flat \
                $(TEST_DIR)/smptest.flat  $(TEST_DIR)/port80.flat \
                $(TEST_DIR)/realmode.flat $(TEST_DIR)/msr.flat \
-               $(TEST_DIR)/hypercall.flat
+               $(TEST_DIR)/hypercall.flat $(TEST_DIR)/sieve.flat
 
 test_cases: $(tests-common) $(tests)
 
@@ -36,7 +36,7 @@ $(TEST_DIR)/access.flat: $(cstart.o) $(TEST_DIR)/access.o $(TEST_DIR)/print.o
 $(TEST_DIR)/hypercall.flat: $(cstart.o) $(TEST_DIR)/hypercall.o
  
 $(TEST_DIR)/sieve.flat: $(cstart.o) $(TEST_DIR)/sieve.o \
-		$(TEST_DIR)/print.o $(TEST_DIR)/vm.o
+		$(TEST_DIR)/vm.o
  
 $(TEST_DIR)/vmexit.flat: $(cstart.o) $(TEST_DIR)/vmexit.o
  
diff --git a/kvm/test/config-x86_64.mak b/kvm/test/config-x86_64.mak
index cc7d7d7..d8fd2b5 100644
--- a/kvm/test/config-x86_64.mak
+++ b/kvm/test/config-x86_64.mak
@@ -4,7 +4,7 @@ bits = 64
 ldarch = elf64-x86-64
 CFLAGS += -D__x86_64__
 
-tests = $(TEST_DIR)/access.flat $(TEST_DIR)/sieve.flat \
-	  $(TEST_DIR)/emulator.flat $(TEST_DIR)/apic.flat
+tests = $(TEST_DIR)/access.flat $(TEST_DIR)/apic.flat \
+	  $(TEST_DIR)/emulator.flat
 
 include config-x86-common.mak
diff --git a/kvm/test/x86/sieve.c b/kvm/test/x86/sieve.c
index a707b92..ef4a5a0 100644
--- a/kvm/test/x86/sieve.c
+++ b/kvm/test/x86/sieve.c
@@ -1,40 +1,5 @@
 #include "vm.h"
-
-void print(const char *text);
-
-void printi(int n)
-{
-    char buf[10], *p = buf;
-    int s = 0, i;
-    
-    if (n < 0) {
-	n = -n;
-	s = 1;
-    }
-
-    while (n) {
-	*p++ = '0' + n % 10;
-	n /= 10;
-    }
-    
-    if (s)
-	*p++ = '-';
-
-    if (p == buf)
-	*p++ = '0';
-    
-    for (i = 0; i < (p - buf) / 2; ++i) {
-	char tmp;
-
-	tmp = buf[i];
-	buf[i] = p[-1-i];
-	p[-1-i] = tmp;
-    }
-
-    *p = 0;
-
-    print(buf);
-}
+#include "libcflat.h"
 
 int sieve(char* data, int size)
 {
@@ -58,11 +23,9 @@ void test_sieve(const char *msg, char *data, int size)
 {
     int r;
 
-    print(msg);
-    print(": ");
+    printf("%s:", msg);
     r = sieve(data, size);
-    printi(r);
-    print("\n");
+    printf("%d out of %d\n", r, size);
 }
 
 #define STATIC_SIZE 1000000
@@ -74,12 +37,11 @@ int main()
     void *v;
     int i;
 
-    print("starting sieve\n");
+    printf("starting sieve\n");
     test_sieve("static", static_data, STATIC_SIZE);
     setup_vm();
-    print("mapped: ");
     test_sieve("mapped", static_data, STATIC_SIZE);
-    for (i = 0; i < 30; ++i) {
+    for (i = 0; i < 3; ++i) {
 	v = vmalloc(VSIZE);
 	test_sieve("virtual", v, VSIZE);
 	vfree(v);
-- 
1.7.1


  reply	other threads:[~2010-06-07 15:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-07 15:11 [PATCH 1/2] qemu-kvm tests: make x86/vm.c support 32-bit host Asias He
2010-06-07 15:11 ` Asias He [this message]
2010-06-08 13:44   ` [PATCH 2/2] qemu-kvm tests: make sieve test runable on " Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1275923498-8999-2-git-send-email-asias.hejun@gmail.com \
    --to=asias.hejun@gmail.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=nsprei@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox