diff mbox

[2/2] qemu-kvm tests: make sieve test runable on 32-bit host

Message ID 1275923498-8999-2-git-send-email-asias.hejun@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Asias He June 7, 2010, 3:11 p.m. UTC
None
diff mbox

Patch

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);