From patchwork Mon Aug 29 22:49:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pranith Kumar X-Patchwork-Id: 9304585 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8A08B601C0 for ; Mon, 29 Aug 2016 22:50:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CFC82858D for ; Mon, 29 Aug 2016 22:50:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CEF5285F7; Mon, 29 Aug 2016 22:50:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 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 mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1BD242858D for ; Mon, 29 Aug 2016 22:50:05 +0000 (UTC) Received: from localhost ([::1]:46094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beVNU-0005yl-Bj for patchwork-qemu-devel@patchwork.kernel.org; Mon, 29 Aug 2016 18:50:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beVN0-0005tx-0o for qemu-devel@nongnu.org; Mon, 29 Aug 2016 18:49:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1beVMr-0004Tw-Pm for qemu-devel@nongnu.org; Mon, 29 Aug 2016 18:49:32 -0400 Received: from mail-yb0-x242.google.com ([2607:f8b0:4002:c09::242]:33019) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beVMr-0004Ts-Kp for qemu-devel@nongnu.org; Mon, 29 Aug 2016 18:49:25 -0400 Received: by mail-yb0-x242.google.com with SMTP id x93so47156ybh.0 for ; Mon, 29 Aug 2016 15:49:25 -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=igha7WYrbqLcjELTQADfN6UuGh1l+YjZFDehcS+Rx/w=; b=F40+XwqtCkK0m7P73GOIn7fgrklKVklHgoQi5xURNRXpZvZoFW4hPUI5ZaUyo+ataX nB0RuDqrl3Ub9EgCLU8ndDTVlzPGIukSlbOjSB2e8Fl8H5LuMi6wC+9OWD5rn+7ABCpr 5c49d0XUIOob4nmW/G8U7+r5z0tJje9QAzuLFK7NwYMavayrzezbnegp9fYOpdSMj4U/ Bt0yDfIRu8viMGMzCW96cswC8Hs8wO4ch4ewE7MInPJefbgtBtO5ZbxMwFiNvZ6nybeV JLQr9smDnj5frZSJAEw4LbiPKRUffTHyaltgZAAkvSI9Exq8GJ2np6deDGwBE6QbIN1m ielg== 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=igha7WYrbqLcjELTQADfN6UuGh1l+YjZFDehcS+Rx/w=; b=jVJ7nydCtjZOMzRwlBNgBOcqN/7KYRcaZvD/JMjXdbvF+FSf1FDhwCPpBEuTiRJB3Z 8pM9r4ohNfw5GNKBuYP2H+xagoCiYF9OYX48SAqyEUGLLGfLyMIm8wuM70aZXPiuiI4O q+ywuFNPcKkhGa73kB52/KlM6AOl+8cNstpOGoCe+GorJNsvJxg+0ejFzwCgbiBZ6tEh NXzdHVuH6PsQL0OQLlaY7DhKHDKhZrkhbyTWqkuZLeOQuCKG+ooc/2zfnqIhcfl8S+VT t0AwWzI9r/AEjSCdAhHPPpVtMmjTBqsG/hSvsh+Ji6APdcl6QeV842mzZ1nli19XaJE8 D/8Q== X-Gm-Message-State: AE9vXwNzmbZv/h3XyfNQ9a4U6It98pSm4RG9JJiZJVgIMJDEHF96+uU/jx9YcQA9GJ1aWQ== X-Received: by 10.37.115.5 with SMTP id o5mr324529ybc.157.1472510965148; Mon, 29 Aug 2016 15:49:25 -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 p67sm17573402ywe.2.2016.08.29.15.49.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 Aug 2016 15:49:24 -0700 (PDT) From: Pranith Kumar To: qemu-devel@nongnu.org, Veronia Bahaa , Paolo Bonzini Date: Mon, 29 Aug 2016 18:49:18 -0400 Message-Id: <20160829224920.16686-4-bobby.prani@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160829224920.16686-1-bobby.prani@gmail.com> References: <20160829224920.16686-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:c09::242 Subject: [Qemu-devel] [PATCH v2 3/4] tests/tcg: Create and populate misc tests for arch independent tests 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Pranith Kumar --- tests/tcg/misc/Makefile | 75 +++++++++++++++++++++++++++++++++++++++ tests/tcg/{ => misc}/linux-test.c | 3 ++ tests/tcg/{ => misc}/sha1.c | 0 tests/tcg/{ => misc}/test-mmap.c | 0 tests/tcg/{ => misc}/test_path.c | 0 tests/tcg/{ => misc}/testthread.c | 0 6 files changed, 78 insertions(+) create mode 100644 tests/tcg/misc/Makefile rename tests/tcg/{ => misc}/linux-test.c (99%) rename tests/tcg/{ => misc}/sha1.c (100%) rename tests/tcg/{ => misc}/test-mmap.c (100%) rename tests/tcg/{ => misc}/test_path.c (100%) rename tests/tcg/{ => misc}/testthread.c (100%) diff --git a/tests/tcg/misc/Makefile b/tests/tcg/misc/Makefile new file mode 100644 index 0000000..39c316b --- /dev/null +++ b/tests/tcg/misc/Makefile @@ -0,0 +1,75 @@ +BUILD_DIR=../../../build/ +SRC_PATH=../../../ +include $(BUILD_DIR)/config-host.mak +include $(SRC_PATH)/rules.mak + +$(call set-vpath, $(SRC_PATH)/tests/tcg/misc) + +QEMU=$(BUILD_DIR)/$(ARCH)-linux-user/qemu-$(ARCH) + +QEMU_INCLUDES += -I$(BUILD_DIR) +CFLAGS=-Wall -O2 -g -fno-strict-aliasing -I$(SRC_PATH)/include -I$(BUILD_DIR) +#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 + +TESTS=linux-test \ + testthread \ + sha1 \ + test-mmap \ + test_path + # runcom + +all: $(patsubst %,run-%,$(TESTS)) +test: all + +# rules to run tests + +run-%: % + -$(QEMU) ./$* + +run-linux-test: linux-test +run-testthread: testthread +run-sha1: sha1 +run-test_path: test_path + +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-test_path: test_path + +# rules to compile tests + +test_path: test_path.o + $(CC) $^ -o $@ -lglib-2.0 + +test_path.o: test_path.c + $(CC) $^ -c -o $@ $(QEMU_INCLUDES) `pkg-config --cflags --libs glib-2.0` + +testthread: testthread.c + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread + +# generic Linux and CPU test +linux-test: linux-test.c + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm + +test-mmap: test-mmap.c + $(CC) $(CFLAGS) -Wall -O2 $(LDFLAGS) -o $@ $< -static + +# speed test +sha1: sha1.c + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< + +speed: sha1 + time ./sha1 + time $(QEMU) ./sha1 + +clean: + rm -f *~ *.o $(TESTS) diff --git a/tests/tcg/linux-test.c b/tests/tcg/misc/linux-test.c similarity index 99% rename from tests/tcg/linux-test.c rename to tests/tcg/misc/linux-test.c index 5070d31..41ad91c 100644 --- a/tests/tcg/linux-test.c +++ b/tests/tcg/misc/linux-test.c @@ -39,6 +39,9 @@ #include #include #include +#include +#include +#include "qemu/compiler.h" #include "qemu/cutils.h" #define TESTPATH "/tmp/linux-test.tmp" diff --git a/tests/tcg/sha1.c b/tests/tcg/misc/sha1.c similarity index 100% rename from tests/tcg/sha1.c rename to tests/tcg/misc/sha1.c diff --git a/tests/tcg/test-mmap.c b/tests/tcg/misc/test-mmap.c similarity index 100% rename from tests/tcg/test-mmap.c rename to tests/tcg/misc/test-mmap.c diff --git a/tests/tcg/test_path.c b/tests/tcg/misc/test_path.c similarity index 100% rename from tests/tcg/test_path.c rename to tests/tcg/misc/test_path.c diff --git a/tests/tcg/testthread.c b/tests/tcg/misc/testthread.c similarity index 100% rename from tests/tcg/testthread.c rename to tests/tcg/misc/testthread.c