From patchwork Sat Sep 17 14:03:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pranith Kumar X-Patchwork-Id: 9337103 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 EFD3B6077F for ; Sat, 17 Sep 2016 14:04:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1C0328CAC for ; Sat, 17 Sep 2016 14:04:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D662828CB9; Sat, 17 Sep 2016 14:04:39 +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 65A0528CAC for ; Sat, 17 Sep 2016 14:04:39 +0000 (UTC) Received: from localhost ([::1]:46319 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blGEQ-00049o-Hl for patchwork-qemu-devel@patchwork.kernel.org; Sat, 17 Sep 2016 10:04:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blGDm-00045a-8U for qemu-devel@nongnu.org; Sat, 17 Sep 2016 10:03:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1blGDk-0002eo-Pl for qemu-devel@nongnu.org; Sat, 17 Sep 2016 10:03:58 -0400 Received: from mail-yb0-x242.google.com ([2607:f8b0:4002:c09::242]:35498) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blGDk-0002ec-L4 for qemu-devel@nongnu.org; Sat, 17 Sep 2016 10:03:56 -0400 Received: by mail-yb0-x242.google.com with SMTP id r203so2357952yba.2 for ; Sat, 17 Sep 2016 07:03:56 -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=Gvo3AzolzU+xhLnfIbJLhckmtbWlTh743P3kKkhLaEI=; b=zurA/Fgw9q8ZuEkqyuLNrxDfCQsBUlmGMw+tESftNhfL2TefyIN/pLNNw0cZQfIGRL pfzk/KjHpHMoGSbHSY4+1V/jaTOavcGfhWA19D9YrJSjQ261u00+NHREpMrOLtfRYy2z CgEGB36SZqlN5VpXNtJ0iU1Z5ExeQ1GwsIbwuN7jCqmxgSKx5W1DNU+kTnFjXyb1W+zA vIn5UAPgmkU3gUv/oXYTavCsffkQQZZE+B5BqpWcEdAYXEGeGzRy9y9lDYU5r43YcCs3 k/SULg4XMgbhcwOm1v1cwh7tpvBFyFX3LuU325HxU7HgOf5g8a/JmHGRaKX/JdfW1C4U IH/A== 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=Gvo3AzolzU+xhLnfIbJLhckmtbWlTh743P3kKkhLaEI=; b=URPrIhIz0m6iga5Jh3zX+Ku7A0lo8OluWbjdmjVxX2FEU/PtKq0I8upyHMtoSdi1ku n9wqdLjf/U4za/otBsi3otOTHHIrcmYmeX9KAvo/HkXxQpaH1IiMBYwA1LZDt8PdRlEu Oq6lz8FsYrjbtgBZIiUpcGRvL1jA2pNV1GZIljFMHIYyILkAbx6KTgdYfpqo/E1EbA+7 o2l4apfD206ZSsP1sOjeZrN8vcXRh53VWxUUvcWALCKR5wOGA1t0yFSPz4A2Ycnk8/q9 PPwKIg7OC9lJSButEF6H3k9rYlHt+xXddljYv3VEgkaCDgztKMsUu9YJZGg1yTJvYh9Z dcQA== X-Gm-Message-State: AE9vXwNFmUTefgFojWFNwgG5HdmdwOYXxKW03QVMR+7SSkHsnAzq85C4mK2lnzV2eau0xQ== X-Received: by 10.37.51.133 with SMTP id z127mr18029659ybz.38.1474121036044; Sat, 17 Sep 2016 07:03:56 -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.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 17 Sep 2016 07:03:55 -0700 (PDT) From: Pranith Kumar To: qemu-devel@nongnu.org, Veronia Bahaa , Paolo Bonzini Date: Sat, 17 Sep 2016 10:03:46 -0400 Message-Id: <20160917140349.12431-5-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:c09::242 Subject: [Qemu-devel] [PATCH 4/6] 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 | 81 +++++++++++++++++++++++++++++++++++++++ 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, 84 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..0aa6f2e --- /dev/null +++ b/tests/tcg/misc/Makefile @@ -0,0 +1,81 @@ +# -*- Mode: makefile -*- +# +# Generic linux-user TCG tests +# +# These tests all use standard non-architecture specific APIs so can +# be built for all TCG targets. The Make is expected to be called in +# the ${BUILD_DIR}/$(TARGET_NAME_ARCH)-linux-user/tests directory +# +# To build for other architectures call make with CROSS_CC set +# + +BUILD_DIR=../.. +include $(BUILD_DIR)/config-host.mak # brings in SRC_PATH +include ../config-target.mak # TARGET_NAME +include $(SRC_PATH)/rules.mak + +$(call set-vpath, $(SRC_PATH)/tests/tcg/misc) + +QEMU=$(BUILD_DIR)/$(TARGET_NAME)-linux-user/qemu-$(TARGET_NAME) + +# Compiler set-up, default to system compiler if not set +CROSS_CC?=$(CC) + +CFLAGS=-Wall -O2 -g -fno-strict-aliasing -static +LDFLAGS= + +TESTS=linux-test \ + testthread \ + sha1 \ + test-mmap + +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 + +# These two need to be re-written as relying on glib (rather than just glibc) +# test_path: test_path.o +# $(CROSS_CC) $^ -o $@ -lglib-2.0 + +# test_path.o: test_path.c +# $(CROSS_CC) $^ -c -o $@ $(QEMU_INCLUDES) `pkg-config --cflags --libs glib-2.0` + +testthread: testthread.c + $(CROSS_CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread + +# generic Linux and CPU test +linux-test: linux-test.c + $(CROSS_CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm + +test-mmap: test-mmap.c + $(CROSS_CC) $(CFLAGS) -Wall -O2 $(LDFLAGS) -o $@ $< -static + +# speed test +sha1: sha1.c + $(CROSS_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