From patchwork Mon Jun 7 15:11:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asias He X-Patchwork-Id: 104782 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o57FBVUx021484 for ; Mon, 7 Jun 2010 15:11:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751734Ab0FGPL3 (ORCPT ); Mon, 7 Jun 2010 11:11:29 -0400 Received: from mail-pv0-f174.google.com ([74.125.83.174]:33923 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751259Ab0FGPL2 (ORCPT ); Mon, 7 Jun 2010 11:11:28 -0400 Received: by pvg16 with SMTP id 16so1473567pvg.19 for ; Mon, 07 Jun 2010 08:11:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :message-id:x-mailer:in-reply-to:references; bh=ukG/GbQzy6jW3rd7PvHHm4V7h7VV93pRZNwG2B/rB4I=; b=W/XpFr+HLfiPOlg6RKTmpEzZF+G6hoG8Nw/h7m/OZfz0OapMUdQJOWpmx3q3m4/oaO bP4JmFKy2a+wBQzRW1HIfV0wNK+6NgJtFCi0hGaDwiT+M1r4Hf5ItLm3A2NN/lD6K13I NiXJMjnns80pbsqOqDVdZvky2/wUbRkto8FAo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; b=cQhbti2tFExSNMac7cL9kjm4TnsGsG1u9CjxxUVmn4/8Zt42MVWuDNO9gcBkZUzM19 DFiU9G04RBYysvup8OiT6EqBEQAOo8kwAToSRGZAGBX8gmJ5EKle68BdUvGzQHiBXyWD RF52ky+ti1dbAd+mIiPrhPghUNOu1rDeeFeh8= Received: by 10.115.38.6 with SMTP id q6mr11714928waj.207.1275923486702; Mon, 07 Jun 2010 08:11:26 -0700 (PDT) Received: from localhost.localdomain ([219.224.169.130]) by mx.google.com with ESMTPS id n32sm39551527wae.10.2010.06.07.08.11.23 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 07 Jun 2010 08:11:26 -0700 (PDT) From: Asias He To: kvm@vger.kernel.org, Avi Kivity , Naphtali Sprei , Marcelo Tosatti Subject: [PATCH 2/2] qemu-kvm tests: make sieve test runable on 32-bit host Date: Mon, 7 Jun 2010 23:11:38 +0800 Message-Id: <1275923498-8999-2-git-send-email-asias.hejun@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1275923498-8999-1-git-send-email-asias.hejun@gmail.com> References: <1275923498-8999-1-git-send-email-asias.hejun@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 07 Jun 2010 15:11:31 +0000 (UTC) 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);