From patchwork Fri Jun 10 14:26:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9169955 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 C303D604DB for ; Fri, 10 Jun 2016 14:41:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1AE8264F4 for ; Fri, 10 Jun 2016 14:41:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A693B28366; Fri, 10 Jun 2016 14:41:06 +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_SIGNED, 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 3FB1E264F4 for ; Fri, 10 Jun 2016 14:41:06 +0000 (UTC) Received: from localhost ([::1]:41491 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBNcP-0006xa-Dt for patchwork-qemu-devel@patchwork.kernel.org; Fri, 10 Jun 2016 10:41:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46362) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBNOs-0003g0-6o for qemu-devel@nongnu.org; Fri, 10 Jun 2016 10:27:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bBNOq-0005iy-4C for qemu-devel@nongnu.org; Fri, 10 Jun 2016 10:27:05 -0400 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:34855) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBNOp-0005if-R0 for qemu-devel@nongnu.org; Fri, 10 Jun 2016 10:27:04 -0400 Received: by mail-pf0-x241.google.com with SMTP id t190so5238388pfb.2 for ; Fri, 10 Jun 2016 07:27:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=a5Pqz/mwoTGlEXABgMWihpi1iTETLM/zdQOvh6YvluM=; b=LH77QXvBcgZpGZFjpWnTUnqS490fR8cRvQNnNGHjt/A073xbN4UkSRNpr2H31Ln2UD 05pSiP3OLbsDzdNpDrkIet/D7B5BvLbEOz2eYgQWxWnsKP3CROHLIKlnPy/qgAINCVCv 5VQo6RFrSJmLvURDYg7a3cmc7lPUi1b4GeFbH6SNUpL+boCO6Dpl2bz50nbJrdA9S1xP 9+d1iO8k6qly3vKUeAphZrXI0wQrtRDH7W8Zk5qVMUwcNcK13dqdinGiU8KFImgavZ67 rlIDB/c/Pw/RldBbehyscK7qHSfHgOwSh7r2nH99mrHkr76GsiXH/72AvvsiYz/rbG6D J0Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=a5Pqz/mwoTGlEXABgMWihpi1iTETLM/zdQOvh6YvluM=; b=YNn2gcAvgXXnpORcOQzI/qKZml+IGqNgz2BP5epGrCifZV8hZCIDFNM5xNwHx45oVV 3O0yeUd4Y1SnQFaV8ReummMh7EDovGm33+fgxqG0f4iW2PWaPstLPIVaUoilE9fNNWFT BNQDexeyRLwbuxl4VWkaaeUP/BXiQcyDW8atUZiVkHJdh7xDLkDqglBUwj57a9qTkz3C bDpAVeZKJesNswAKP3BMvPYhFjGR2rNH1wSb59yBYiN5h18x0En4NrnljohCmyxafFBb A6tboPg/sjLB+b9+lFb3ELJOdlzMsbFKCT/hrQPnItXh3QSDVNIHZyh8MWwrjfLgTa51 fD3Q== X-Gm-Message-State: ALyK8tJZHSxUOdzWrsqpqlVlXSHPmE3Qd2rIXoDuHK0GoEDuavsUSQrS8F+/0IDvALNP1g== X-Received: by 10.98.94.194 with SMTP id s185mr2607942pfb.32.1465568823182; Fri, 10 Jun 2016 07:27:03 -0700 (PDT) Received: from anchor.twiddle.net (71-37-54-227.tukw.qwest.net. [71.37.54.227]) by smtp.gmail.com with ESMTPSA id vy8sm18227219pab.22.2016.06.10.07.27.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Jun 2016 07:27:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 10 Jun 2016 07:26:51 -0700 Message-Id: <1465568813-19771-14-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465568813-19771-1-git-send-email-rth@twiddle.net> References: <1465568813-19771-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::241 Subject: [Qemu-devel] [PULL 13/15] qht: add test-qht-par to invoke qht-bench from 'check' target 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: peter.maydell@linaro.org, "Emilio G. Cota" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Emilio G. Cota" Signed-off-by: Emilio G. Cota Message-Id: <1465412133-3029-14-git-send-email-cota@braap.org> Signed-off-by: Richard Henderson --- tests/.gitignore | 1 + tests/Makefile.include | 5 ++++- tests/test-qht-par.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 tests/test-qht-par.c diff --git a/tests/.gitignore b/tests/.gitignore index d19023e..840ea39 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -52,6 +52,7 @@ test-qemu-opts test-qdist test-qga test-qht +test-qht-par test-qmp-commands test-qmp-commands.h test-qmp-event diff --git a/tests/Makefile.include b/tests/Makefile.include index 7b00301..7d63d16 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -74,6 +74,8 @@ check-unit-y += tests/test-qdist$(EXESUF) gcov-files-test-qdist-y = util/qdist.c check-unit-y += tests/test-qht$(EXESUF) gcov-files-test-qht-y = util/qht.c +check-unit-y += tests/test-qht-par$(EXESUF) +gcov-files-test-qht-par-y = util/qht.c check-unit-y += tests/test-bitops$(EXESUF) check-unit-$(CONFIG_HAS_GLIB_SUBPROCESS_TESTS) += tests/test-qdev-global-props$(EXESUF) check-unit-y += tests/check-qom-interface$(EXESUF) @@ -400,7 +402,7 @@ test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \ tests/test-opts-visitor.o tests/test-qmp-event.o \ tests/rcutorture.o tests/test-rcu-list.o \ tests/test-qdist.o \ - tests/test-qht.o tests/qht-bench.o + tests/test-qht.o tests/qht-bench.o tests/test-qht-par.o $(test-obj-y): QEMU_INCLUDES += -Itests QEMU_CFLAGS += -I$(SRC_PATH)/tests @@ -441,6 +443,7 @@ tests/rcutorture$(EXESUF): tests/rcutorture.o $(test-util-obj-y) tests/test-rcu-list$(EXESUF): tests/test-rcu-list.o $(test-util-obj-y) tests/test-qdist$(EXESUF): tests/test-qdist.o $(test-util-obj-y) tests/test-qht$(EXESUF): tests/test-qht.o $(test-util-obj-y) +tests/test-qht-par$(EXESUF): tests/test-qht-par.o tests/qht-bench$(EXESUF) $(test-util-obj-y) tests/qht-bench$(EXESUF): tests/qht-bench.o $(test-util-obj-y) tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \ diff --git a/tests/test-qht-par.c b/tests/test-qht-par.c new file mode 100644 index 0000000..f09e004 --- /dev/null +++ b/tests/test-qht-par.c @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2016, Emilio G. Cota + * + * License: GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ +#include "qemu/osdep.h" +#include + +#define TEST_QHT_STRING "tests/qht-bench 1>/dev/null 2>&1 -R -S0.1 -D10000 -N1 " + +static void test_qht(int n_threads, int update_rate, int duration) +{ + char *str; + int rc; + + str = g_strdup_printf(TEST_QHT_STRING "-n %d -u %d -d %d", + n_threads, update_rate, duration); + rc = system(str); + g_free(str); + g_assert_cmpint(rc, ==, 0); +} + +static void test_2th0u1s(void) +{ + test_qht(2, 0, 1); +} + +static void test_2th20u1s(void) +{ + test_qht(2, 20, 1); +} + +static void test_2th0u5s(void) +{ + test_qht(2, 0, 5); +} + +static void test_2th20u5s(void) +{ + test_qht(2, 20, 5); +} + +int main(int argc, char *argv[]) +{ + g_test_init(&argc, &argv, NULL); + + if (g_test_quick()) { + g_test_add_func("/qht/parallel/2threads-0%updates-1s", test_2th0u1s); + g_test_add_func("/qht/parallel/2threads-20%updates-1s", test_2th20u1s); + } else { + g_test_add_func("/qht/parallel/2threads-0%updates-5s", test_2th0u5s); + g_test_add_func("/qht/parallel/2threads-20%updates-5s", test_2th20u5s); + } + return g_test_run(); +}