From 5d94695e9ad42343e72918024c046f22fe4941a0 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 21 Aug 2013 00:50:41 -0700 Subject: tests: Create a regression-tests package for distribution As of today regression tests are an in-house breed, by making it a new package and distributing it ensures larger set of people use it and contribute to it. This can also be used by any consumer/user to build their own environment for glusterfs regression testing which is today limited only to 'upstream' 'glusterfs' releases and build.gluster.org Change-Id: I4f7e9fd1c49982dcf0d788ef6a83ffe895a956ac BUG: 764966 Signed-off-by: Harshavardhana Reviewed-on: http://review.gluster.org/5674 Reviewed-by: Niels de Vos Tested-by: Gluster Build System --- .gitignore | 3 ++- Makefile.am | 2 ++ configure.ac | 3 ++- glusterfs.spec.in | 23 ++++++++++++++++++++++- run-tests.sh | 3 --- run-tests.sh.in | 31 +++++++++++++++++++++++++++++++ tests.mk | 8 ++++++++ tests/README | 26 -------------------------- tests/README.md | 27 +++++++++++++++++++++++++++ tests/bugs/bug-853258.t | 2 +- 10 files changed, 95 insertions(+), 33 deletions(-) delete mode 100755 run-tests.sh create mode 100755 run-tests.sh.in create mode 100644 tests.mk delete mode 100644 tests/README create mode 100644 tests/README.md diff --git a/.gitignore b/.gitignore index d3e1a01dd..0e31d20dc 100644 --- a/.gitignore +++ b/.gitignore @@ -41,4 +41,5 @@ glusterfsd/src/glusterfsd libglusterfs/src/spec.lex.c libglusterfs/src/y.tab.c libglusterfs/src/y.tab.h -libgfchangelog.pc \ No newline at end of file +libgfchangelog.pc +run-tests.sh \ No newline at end of file diff --git a/Makefile.am b/Makefile.am index eba8ed12d..2210492db 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/tests.mk + EXTRA_DIST = autogen.sh \ COPYING-GPLV2 COPYING-LGPLV3 \ INSTALL README AUTHORS THANKS NEWS \ diff --git a/configure.ac b/configure.ac index e723dfabc..940dde40c 100644 --- a/configure.ac +++ b/configure.ac @@ -167,7 +167,8 @@ AC_CONFIG_FILES([Makefile geo-replication/Makefile geo-replication/src/Makefile geo-replication/syncdaemon/Makefile - glusterfs.spec]) + glusterfs.spec + run-tests.sh]) AC_CANONICAL_HOST diff --git a/glusterfs.spec.in b/glusterfs.spec.in index d654c085c..39fc23aa6 100644 --- a/glusterfs.spec.in +++ b/glusterfs.spec.in @@ -1,4 +1,3 @@ - %global _hardened_build 1 %global _for_fedora_koji_builds 0 @@ -393,6 +392,19 @@ is in user space and easily manageable. This package provides the api include files. +%package regression-tests +Summary: Development Tools +Group: Development/Tools +Requires: %{name} = %{version}-%{release} +Requires: %{name}-fuse = %{version}-%{release} +Requires: %{name}-server = %{version}-%{release} +Requires: perl(App::Prove) perl(Test::Harness) gcc util-linux-ng lvm2 +Requires: python attr dbench git nfs-utils xfsprogs + +%description regression-tests +The Gluster Test Framework, is a suite of scripts used for +regression testing of Gluster. + %prep %setup -q -n %{name}-%{version}%{?prereltag} %if ( 0%{_for_fedora_koji_builds} ) @@ -776,6 +788,11 @@ fi %{_libdir}/libgfapi.so %{_includedir}/glusterfs/api/* +%files regression-tests +%defattr(-,root,root,-) +%{_datarootdir}/glusterfs/* +%exclude %{_datarootdir}/glusterfs/tests/basic/rpm.t + %post server # Legacy server %_init_enable glusterd @@ -839,6 +856,10 @@ if [ $1 -ge 1 ]; then fi %changelog +* Tue Sep 17 2013 Harshavardhana +- Provide a new package called "glusterfs-regression-tests" for standalone + regression testing. + * Thu Aug 22 2013 Niels de Vos - Correct the day/date for some entries in this changelog (#1000019) diff --git a/run-tests.sh b/run-tests.sh deleted file mode 100755 index d3c9af2ac..000000000 --- a/run-tests.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -prove -rf --timer $(dirname $0)/tests; diff --git a/run-tests.sh.in b/run-tests.sh.in new file mode 100755 index 000000000..a75b68171 --- /dev/null +++ b/run-tests.sh.in @@ -0,0 +1,31 @@ +#!/bin/bash +# Copyright (c) 2013 Red Hat, Inc. +# + +function _init() +{ + prefix="@prefix@"; + exec_prefix="@exec_prefix@"; + regression_testsdir="@datarootdir@/glusterfs"; + if [ ! -f ${regression_testsdir}/tests/include.rc ]; then + echo "Seems like GlusterFS quality tests are corrupted..aborting!!" + exit 1 + fi +} + +function main() +{ + if [ $# -lt 1 ]; then + echo "Running all the regression test cases" + prove -rf --timer ${regression_testsdir}/tests; + else + ## TODO + echo "Running single regression test.." + echo "WARNING: yet to be implemented.. exiting safely" + exit 0 + #export DEBUG=1; + #echo "Automatically setting up DEBUG=1 for this test $1"; + fi +} + +_init "$@" && main "$@" diff --git a/tests.mk b/tests.mk new file mode 100644 index 000000000..4760b76c8 --- /dev/null +++ b/tests.mk @@ -0,0 +1,8 @@ +ALL_TEST_FILES = $(shell find $(top_srcdir)/tests -type f -print) + +regressiontestsdir = $(datarootdir)/glusterfs + +nobase_dist_regressiontests_DATA = $(ALL_TEST_FILES) run-tests.sh + +install-data-hook: + chmod +x $(DESTDIR)$(datarootdir)/glusterfs/run-tests.sh diff --git a/tests/README b/tests/README deleted file mode 100644 index 857230acb..000000000 --- a/tests/README +++ /dev/null @@ -1,26 +0,0 @@ -How to use test script framework. -================================= - -- Build and install the version of glusterfs with your changes. Make - sure the installed version is accessible from $PATH. - -- To mount glusterfs, NEVER use 'mount -t glusterfs', instead use - 'glusterfs -s ' method. This is because with the patch build setup - doesnot install the /sbin/mount.glusterfs necessary, where as the - glusterfs binary will be accessible with $PATH, and will pick the - right version. - -- (optional) Set environment variables to specify location of - export directories and mount points. Unless you have special - requirements, the defaults should just work. The variables - themselves can be found at the top of tests/include.rc. All - of them can be overriden with environment variables. - -- Execute run-tests.sh in the top level directory as root. - -- If some test cases fail, you can execute the failed test case script - directly bypassing run-tests.sh. At this time it might be - useful to set the envrionment variable DEBUG=1 before running - the individual test script directly by hand. - -- BE WARNED THAT THE TEST CASES DELETE /var/lib/glusterd/* !!! diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 000000000..2b5ed8dcd --- /dev/null +++ b/tests/README.md @@ -0,0 +1,27 @@ +Regression tests framework for GlusterFS +======================================== + +## Prereq +- Build and install the version of glusterfs with your changes. Make + sure the installed version is accessible from $PATH. + +## How-To +- To mount glusterfs, NEVER use 'mount -t glusterfs', instead use + 'glusterfs -s ' method. This is because with the patch build setup + doesnot install the /sbin/mount.glusterfs necessary, where as the + glusterfs binary will be accessible with $PATH, and will pick the + right version. +- (optional) Set environment variables to specify location of + export directories and mount points. Unless you have special + requirements, the defaults should just work. The variables + themselves can be found at the top of tests/include.rc. All + of them can be overriden with environment variables. + +## Usage +- Execute `/usr/share/glusterfs/run-tests.sh` as root. + +- If some test cases fail, report to GlusterFS community at + `gluster-devel@nongnu.org`. + +## Reminder +- BE WARNED THAT THE TEST CASES DELETE /var/lib/glusterd/* !!! \ No newline at end of file diff --git a/tests/bugs/bug-853258.t b/tests/bugs/bug-853258.t index 0ca995551..faa9d4465 100755 --- a/tests/bugs/bug-853258.t +++ b/tests/bugs/bug-853258.t @@ -38,7 +38,7 @@ for i in $(seq 0 3); do xattrs="$xattrs $(dht_get_layout $B0/${V0}$i)" done -overlap=$($(dirname $0)/overlap.py $xattrs) +overlap=$(python2 $(dirname $0)/overlap.py $xattrs) # 2863311531 = 0xaaaaaaab = 2/3 overlap TEST [ "$overlap" -ge 2863311531 ] -- cgit