From patchwork Wed Mar 18 18:10:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Tulak X-Patchwork-Id: 6042571 Return-Path: X-Original-To: patchwork-fstests@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 773A5BF90F for ; Wed, 18 Mar 2015 18:11:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4798A2046F for ; Wed, 18 Mar 2015 18:11:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5C96B2041F for ; Wed, 18 Mar 2015 18:11:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754670AbbCRSLb (ORCPT ); Wed, 18 Mar 2015 14:11:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57604 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754777AbbCRSLa (ORCPT ); Wed, 18 Mar 2015 14:11:30 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2IIBU6j012360 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 18 Mar 2015 14:11:30 -0400 Received: from jtulak.redhat.com (ovpn-200-19.brq.redhat.com [10.40.200.19]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2IIBNM9018231; Wed, 18 Mar 2015 14:11:29 -0400 From: =?UTF-8?q?Jan=20=C5=A4ul=C3=A1k?= To: fstests@vger.kernel.org Cc: =?UTF-8?q?Jan=20=C5=A4ul=C3=A1k?= Subject: [PATCH 4/6] new: environments - add performance tests (as example of usage) Date: Wed, 18 Mar 2015 19:10:28 +0100 Message-Id: <1426702230-22085-5-git-send-email-jtulak@redhat.com> In-Reply-To: <1426702230-22085-1-git-send-email-jtulak@redhat.com> References: <1426702230-22085-1-git-send-email-jtulak@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds new test category for performance tests, which utilises the new environment architecture. There are two simple tests. Currently, both are configured to be quick, running about 20 seconds, so you can easily try them. - 001 is for benchmarking readdir speed using xfs_io -c "readdir". In this test, an environment is used to generate NUM of empty files in a directory. Runtime is - 002 is a simulation of SQLite, using fio for the testing. It uses no environment to show how the modified skeleton from ./new script works by default. Signed-off-by: Jan ?ulák --- check | 2 +- tests/performance/001 | 111 +++++++++++++++++++++++++++++++++++++++++ tests/performance/002 | 121 +++++++++++++++++++++++++++++++++++++++++++++ tests/performance/Makefile | 21 ++++++++ tests/performance/group | 7 +++ 5 files changed, 261 insertions(+), 1 deletion(-) create mode 100755 tests/performance/001 create mode 100755 tests/performance/002 create mode 100644 tests/performance/Makefile create mode 100644 tests/performance/group diff --git a/check b/check index 39a9d05..bacb66d 100755 --- a/check +++ b/check @@ -59,7 +59,7 @@ then fi SUPPORTED_TESTS="[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]" -SRC_GROUPS="generic shared" +SRC_GROUPS="generic shared performance" export SRC_DIR="tests" export ENV_DIR="environments" diff --git a/tests/performance/001 b/tests/performance/001 new file mode 100755 index 0000000..28c6546 --- /dev/null +++ b/tests/performance/001 @@ -0,0 +1,111 @@ +#! /bin/bash +# FS QA Test No. 001 +# +# Performance test. +# Readdir speed for various amounts of files in a directory. +# +#----------------------------------------------------------------------- +# Copyright (c) 2015 RedHat. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +# List of environments this test can use for preparing files for the testing. +# They are independent of each other (multiple entries = multiple runs). +# If "none" is given, the test can be run without any environment, +# ommiting it signifies that the test won't run without any of them. +# +# Example: supported_environments="none empty_files full_partition" + +supported_environments="empty-files" + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here + +# Modify as appropriate. +_supported_fs generic +_supported_os IRIX Linux +_require_test +_disable_output_check + +run_test(){ + # PUT TEST BELOW + if ! type xfs_io >/dev/null 2>&1; then + _fail "This test requires xfs_io in PATH." + fi + + numbers="1000 5000 10000" + for n in $numbers;do + export ENV_FILES_NUMBER=$n + echo "GUU $TEST_DIR" + _environment_require $TEST_DIR + er=$? + if [ $er -ne 0 ];then + # TODO what to do if an environment fails? Continue, or skip + # the rest of this test? + continue + fi + + + verbose=true + + # check for xfs_io tool + which xfs_io >/dev/null 2>&1 + if [ $? -ne 0 ];then + _fatal "xfs_io tool has to be installed in PATH!" + fi + echo "# MEASURED_DATA" + xfs_io -c "readdir" "$TEST_DIR" |paste -sd ", " - + _environment_clean $TEST_DIR + done + + # PUT TEST ABOVE +} + + +# Filter the supported_environments by user input (-eo/-ex arguments) +# and run the test for all environments in the intersect of +# the supported and user-allowed environments. +for environment in $(_filter_environments "$supported_environments") +do + export ENV_NAME="$environment" + run_test +done + +# optional stuff if your test has verbose output to help resolve problems +#echo +#echo "If failure, check $seqres.full (this) and $seqres.full.ok (reference)" + +# success, all done +status=0 +exit diff --git a/tests/performance/002 b/tests/performance/002 new file mode 100755 index 0000000..9a316ad --- /dev/null +++ b/tests/performance/002 @@ -0,0 +1,121 @@ +#! /bin/bash +# FS QA Test No. 002 +# +# Performance test for simulating SQLite. +# +# Requires FIO. +# +#----------------------------------------------------------------------- +# Copyright (c) 2015 YOUR NAME HERE. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +# List of environments this test can use for preparing files for the testing. +# They are independent of each other (multiple entries = multiple runs). +# If "none" is given, the test can be run without any environment, +# ommiting it signifies that the test won't run without any of them. +# +# Example: supported_environments="none empty_files full_partition" + +supported_environments="none" + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + rm database-sqlite.prerun.txt + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here + +# Modify as appropriate. +_supported_fs generic +_supported_os IRIX Linux +_require_test +_disable_output_check + +FIO_BIN=fio +RUNTIME=20 + +cat < $tmp.sqlite.fio +[global] +rw=randrw +rwmixread=80 +size=1G +directory=$TEST_DIR +fadvise_hint=0 +direct=1 +blocksize=8k +numjobs=\$ncpus*2 +time_based +runtime=$RUNTIME +ioengine=libaio +norandommap=1 +exec_prerun=echo 3 > /proc/sys/vm/drop_caches +group_reporting + +[database-sqlite] +nrfiles=1 +numjobs=1 +ioengine=sync +lockfile=exclusive + +EOF + +run_test(){ + _environment_require $TEST_DIR + # PUT TEST BELOW + + if ! type $FIO_BIN >/dev/null 2>&1; then + _fail "Can't run without $FIO_BIN installed." + fi + + $FIO_BIN --append-terse $tmp.sqlite.fio + + # PUT TEST ABOVE + _environment_clean $TEST_DIR +} + + +# Filter the supported_environments by user input (-eo/-ex arguments) +# and run the test for all environments in the intersect of +# the supported and user-allowed environments. +for environment in $(_filter_environments "$supported_environments") +do + export ENV_NAME="$environment" + run_test +done + +# optional stuff if your test has verbose output to help resolve problems +#echo +#echo "If failure, check $seqres.full (this) and $seqres.full.ok (reference)" + +# success, all done +status=0 +exit diff --git a/tests/performance/Makefile b/tests/performance/Makefile new file mode 100644 index 0000000..5a50b07 --- /dev/null +++ b/tests/performance/Makefile @@ -0,0 +1,21 @@ +# +# Copyright (c) 2003-2005 Silicon Graphics, Inc. All Rights Reserved. +# + +TOPDIR = ../.. +include $(TOPDIR)/include/builddefs + +PERFORMANCE_DIR = performance +TARGET_DIR = $(PKG_LIB_DIR)/$(TESTS_DIR)/$(PERFORMANCE_DIR) + +include $(BUILDRULES) + +install: + $(INSTALL) -m 755 -d $(TARGET_DIR) + $(INSTALL) -m 755 [0-9]?? $(TARGET_DIR) + $(INSTALL) -m 644 group $(TARGET_DIR) + $(INSTALL) -m 644 environment $(TARGET_DIR) + $(INSTALL) -m 644 [0-9]??.* $(TARGET_DIR) + +# Nothing. +install-dev install-lib: diff --git a/tests/performance/group b/tests/performance/group new file mode 100644 index 0000000..1c58e14 --- /dev/null +++ b/tests/performance/group @@ -0,0 +1,7 @@ +# QA groups control file +# Defines test groups and nominal group owners +# - do not start group names with a digit +# - comment line before each group is "new" description +# +001 performance readdir +002 performance fio db-simulation