From patchwork Sat Sep 17 14:03:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pranith Kumar X-Patchwork-Id: 671219 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sbv7K2Y1pz9sCg for ; Sun, 18 Sep 2016 00:05:33 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=Pi/4ltDy; dkim-atps=neutral Received: from localhost ([::1]:46328 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blGFG-0005Jf-Tr for incoming@patchwork.ozlabs.org; Sat, 17 Sep 2016 10:05:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blGDj-00045F-8o for qemu-devel@nongnu.org; Sat, 17 Sep 2016 10:03:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1blGDh-0002d4-At for qemu-devel@nongnu.org; Sat, 17 Sep 2016 10:03:55 -0400 Received: from mail-yw0-x242.google.com ([2607:f8b0:4002:c05::242]:34244) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blGDh-0002cw-64 for qemu-devel@nongnu.org; Sat, 17 Sep 2016 10:03:53 -0400 Received: by mail-yw0-x242.google.com with SMTP id t67so5364515ywg.1 for ; Sat, 17 Sep 2016 07:03:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=R3zMOqUl8DSWh2GYuZSpIaqSEwecZoTqiiNGZtuyIXY=; b=Pi/4ltDyKK+4fIkErwOAY77VSMQbFsnO5zyu4WdNdAoRCyd57EwTYpO/CsJSZSfO+K NKBacHVEQJNVB1V9noNPkjZXNWUJ0lYmScKkHf4ZOdSdvQuT8yOY0i7nSiS4zB5OSc6I 70o/NMnBEJg7OVa2bc10FjGvEVLQr2iwC5z2bqQkBpjq9wg1VKTLXWnjNeO/4jPAaOum VQFPU/nf/yctzWo43EVW70G1+Aqlr4J95wtoKr1jHDBVncZY0KnTLfW+6+Cxjm/KXqyY 6EVDCBMGJWexnC5sMHmdtU5wjFp8mkApf90XLgz7y0YpA73+EJnvBiZ571AA8AdqQEc8 puSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=R3zMOqUl8DSWh2GYuZSpIaqSEwecZoTqiiNGZtuyIXY=; b=MPWjsswmSWeEfLQVnUzxQQA4bTCE01Eh+vPx90sY/5L4aKoBbGmlqIcXF8u7dMfQ+h Pkm03eG431JN6uUapmh5fJMWN6O0I4oLs/B2As/kNxLC6tYwcqni/QnuMmRX12WqwOqY PnD6VjTuuBnAaM1Vu7HNOSSf02yUXeu0ufeIfebO2HPa0eJNeGuKabwvbXJSn+U1QZ3s iBc7fzcWkC+M/w7lDVoMpBBQHl1AWZQZiINc0uyc3LxkhMGBa/B4Lu5Rwbosdexj7m9S GmJrySSDL3G9ohdTuuYBb4wE/25XXM45VJ+ImD+JkHu9kneJ80ieNc70CLDX0VmBNgN+ WAUA== X-Gm-Message-State: AE9vXwOF6xuNbrUJ6VPDNsKYBvCXL9EvNz7LOPeWzAdL2szmuv2jfar8w6EtdMVvz44Okg== X-Received: by 10.129.93.69 with SMTP id r66mr18597000ywb.15.1474121032539; Sat, 17 Sep 2016 07:03:52 -0700 (PDT) Received: from evgadesktop.attlocal.net (108-232-152-155.lightspeed.tukrga.sbcglobal.net. [108.232.152.155]) by smtp.gmail.com with ESMTPSA id k133sm2356094ywe.46.2016.09.17.07.03.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 17 Sep 2016 07:03:51 -0700 (PDT) From: Pranith Kumar To: qemu-devel@nongnu.org Date: Sat, 17 Sep 2016 10:03:43 -0400 Message-Id: <20160917140349.12431-2-bobby.prani@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160917140349.12431-1-bobby.prani@gmail.com> References: <20160917140349.12431-1-bobby.prani@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c05::242 Subject: [Qemu-devel] [PATCH 1/6] tests/tcg: Move i386 tests to arch specific folder X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, rth@twiddle.net Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Pranith Kumar --- tests/tcg/Makefile | 156 -------------------------------- tests/tcg/i386/Makefile | 88 ++++++++++++++++++ tests/tcg/{ => i386}/hello-i386.c | 9 +- tests/tcg/{ => i386}/pi_10.com | Bin tests/tcg/{ => i386}/runcom.c | 0 tests/tcg/{ => i386}/test-i386-code16.S | 0 tests/tcg/{ => i386}/test-i386-fprem.c | 0 tests/tcg/{ => i386}/test-i386-muldiv.h | 0 tests/tcg/{ => i386}/test-i386-shift.h | 0 tests/tcg/{ => i386}/test-i386-ssse3.c | 0 tests/tcg/{ => i386}/test-i386-vm86.S | 0 tests/tcg/{ => i386}/test-i386.c | 0 tests/tcg/{ => i386}/test-i386.h | 0 13 files changed, 93 insertions(+), 160 deletions(-) delete mode 100644 tests/tcg/Makefile create mode 100644 tests/tcg/i386/Makefile rename tests/tcg/{ => i386}/hello-i386.c (71%) rename tests/tcg/{ => i386}/pi_10.com (100%) rename tests/tcg/{ => i386}/runcom.c (100%) rename tests/tcg/{ => i386}/test-i386-code16.S (100%) rename tests/tcg/{ => i386}/test-i386-fprem.c (100%) rename tests/tcg/{ => i386}/test-i386-muldiv.h (100%) rename tests/tcg/{ => i386}/test-i386-shift.h (100%) rename tests/tcg/{ => i386}/test-i386-ssse3.c (100%) rename tests/tcg/{ => i386}/test-i386-vm86.S (100%) rename tests/tcg/{ => i386}/test-i386.c (100%) rename tests/tcg/{ => i386}/test-i386.h (100%) diff --git a/tests/tcg/Makefile b/tests/tcg/Makefile deleted file mode 100644 index 89e3342..0000000 --- a/tests/tcg/Makefile +++ /dev/null @@ -1,156 +0,0 @@ --include ../../config-host.mak --include $(SRC_PATH)/rules.mak - -$(call set-vpath, $(SRC_PATH)/tests/tcg) - -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../.. -CFLAGS=-Wall -O2 -g -fno-strict-aliasing -#CFLAGS+=-msse2 -LDFLAGS= - -# TODO: automatically detect ARM and MIPS compilers, and run those too - -# runcom maps page 0, so it requires root privileges -# also, pi_10.com runs indefinitely - -I386_TESTS=hello-i386 \ - linux-test \ - testthread \ - sha1-i386 \ - test-i386 \ - test-i386-fprem \ - test-mmap \ - # runcom - -# native i386 compilers sometimes are not biarch. assume cross-compilers are -ifneq ($(ARCH),i386) -I386_TESTS+=run-test-x86_64 -endif - -TESTS = test_path -ifneq ($(call find-in-path, $(CC_I386)),) -TESTS += $(I386_TESTS) -endif - -all: $(patsubst %,run-%,$(TESTS)) -test: all - -# rules to run tests - -.PHONY: $(patsubst %,run-%,$(TESTS)) - -run-%: % - -$(QEMU) ./$* - -run-hello-i386: hello-i386 -run-linux-test: linux-test -run-testthread: testthread -run-sha1-i386: sha1-i386 - -run-test-i386: test-i386 - ./test-i386 > test-i386.ref - -$(QEMU) test-i386 > test-i386.out - @if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK"; fi - -run-test-i386-fprem: test-i386-fprem - ./test-i386-fprem > test-i386-fprem.ref - -$(QEMU) test-i386-fprem > test-i386-fprem.out - @if diff -u test-i386-fprem.ref test-i386-fprem.out ; then echo "Auto Test OK"; fi - -run-test-x86_64: test-x86_64 - ./test-x86_64 > test-x86_64.ref - -$(QEMU_X86_64) test-x86_64 > test-x86_64.out - @if diff -u test-x86_64.ref test-x86_64.out ; then echo "Auto Test OK"; fi - -run-test-mmap: test-mmap - -$(QEMU) ./test-mmap - -$(QEMU) -p 8192 ./test-mmap 8192 - -$(QEMU) -p 16384 ./test-mmap 16384 - -$(QEMU) -p 32768 ./test-mmap 32768 - -run-runcom: runcom - -$(QEMU) ./runcom $(SRC_PATH)/tests/pi_10.com - -run-test_path: test_path - ./test_path - -# rules to compile tests - -test_path: test_path.o - -test_path.o: test_path.c - -hello-i386: hello-i386.c - $(CC_I386) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $< - strip $@ - -testthread: testthread.c - $(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread - -# 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) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ \ - $( test-i386.ref + -$(QEMU) test-i386 > test-i386.out + @if cmp -s test-i386.ref test-i386.out ; then echo "Auto Test OK"; fi + +run-test-i386-fprem: test-i386-fprem + ./test-i386-fprem > test-i386-fprem.ref + -$(QEMU_X86_64) test-i386-fprem > test-i386-fprem.out + @if cmp -s test-i386-fprem.ref test-i386-fprem.out ; then echo "Auto Test OK"; fi + +run-test-x86_64: test-x86_64 + ./test-x86_64 > test-x86_64.ref + -$(QEMU_X86_64) test-x86_64 > test-x86_64.out + @if diff -u test-x86_64.ref test-x86_64.out ; then echo "Auto Test OK"; fi + +run-runcom: runcom + -$(QEMU) ./runcom $(SRC_PATH)/tests/pi_10.com + +# rules to compile tests + +hello-i386: hello-i386.c + $(CC_I386) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $< + strip $@ + +# 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) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ \ + $( +#include -static inline void exit(int status) +static inline void _exit(int status) { int __res; __asm__ volatile ("movl %%ecx,%%ebx\n"\ @@ -8,7 +9,7 @@ static inline void exit(int status) : "=a" (__res) : "0" (__NR_exit),"c" ((long)(status))); } -static inline int write(int fd, const char * buf, int len) +static inline size_t _write(int fd, const void * buf, size_t len) { int status; __asm__ volatile ("pushl %%ebx\n"\ @@ -22,6 +23,6 @@ static inline int write(int fd, const char * buf, int len) void _start(void) { - write(1, "Hello World\n", 12); - exit(0); + _write(1, "Hello World\n", 12); + _exit(0); } diff --git a/tests/tcg/pi_10.com b/tests/tcg/i386/pi_10.com similarity index 100% rename from tests/tcg/pi_10.com rename to tests/tcg/i386/pi_10.com diff --git a/tests/tcg/runcom.c b/tests/tcg/i386/runcom.c similarity index 100% rename from tests/tcg/runcom.c rename to tests/tcg/i386/runcom.c diff --git a/tests/tcg/test-i386-code16.S b/tests/tcg/i386/test-i386-code16.S similarity index 100% rename from tests/tcg/test-i386-code16.S rename to tests/tcg/i386/test-i386-code16.S diff --git a/tests/tcg/test-i386-fprem.c b/tests/tcg/i386/test-i386-fprem.c similarity index 100% rename from tests/tcg/test-i386-fprem.c rename to tests/tcg/i386/test-i386-fprem.c diff --git a/tests/tcg/test-i386-muldiv.h b/tests/tcg/i386/test-i386-muldiv.h similarity index 100% rename from tests/tcg/test-i386-muldiv.h rename to tests/tcg/i386/test-i386-muldiv.h diff --git a/tests/tcg/test-i386-shift.h b/tests/tcg/i386/test-i386-shift.h similarity index 100% rename from tests/tcg/test-i386-shift.h rename to tests/tcg/i386/test-i386-shift.h diff --git a/tests/tcg/test-i386-ssse3.c b/tests/tcg/i386/test-i386-ssse3.c similarity index 100% rename from tests/tcg/test-i386-ssse3.c rename to tests/tcg/i386/test-i386-ssse3.c diff --git a/tests/tcg/test-i386-vm86.S b/tests/tcg/i386/test-i386-vm86.S similarity index 100% rename from tests/tcg/test-i386-vm86.S rename to tests/tcg/i386/test-i386-vm86.S diff --git a/tests/tcg/test-i386.c b/tests/tcg/i386/test-i386.c similarity index 100% rename from tests/tcg/test-i386.c rename to tests/tcg/i386/test-i386.c diff --git a/tests/tcg/test-i386.h b/tests/tcg/i386/test-i386.h similarity index 100% rename from tests/tcg/test-i386.h rename to tests/tcg/i386/test-i386.h