File aiostress.spec of Package aiostress

# spec file for package aiostress (Version 0.21)
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           aiostress
License:        GPLv2
BuildRequires:  libaio libaio-devel
Group:          SUSE internal
Summary:        Benchmark measures AIO performance on file system and raw device
Version:        0.21
Release:        1
Source0:        %{name}-%{version}.tar.bz2
Source1:	    %{name}-ctcs-glue-%{version}.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

Benchmark measures AIO performance on file system and raw device.
aiostress will open or create each file on the command line,
and start a series aio to it. aio is done in a rotating loop. 
first file1 gets 8 requests, then file2, then file3 etc.  As
each file finishes writing, it is switched to reads.
io buffers are aligned in case you want to do raw io.

%package ctcs-glue
Summary:        The let-aiostress-be-run-via-ctcs glue
Group:          SUSE internal
Autoreqprov:    on
Requires:       ctcs2 >= 0.1.6
Requires:       aiostress = %{version}

%description ctcs-glue
This package contains the glue for integrating aiostress into the ctcs
testing framework.

rm -rf %{name}-%{version}
rm -rf %{name}-ctcs-glue-%{version}
bzip2 -dc $RPM_SOURCE_DIR/%{name}-%{version}.tar.bz2 | tar -xvf -
bzip2 -dc $RPM_SOURCE_DIR/%{name}-ctcs-glue-%{version}.tar.bz2 | tar -xvf -

cd $RPM_BUILD_DIR/%{name}-%{version}
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
export CFLAGS
gcc $CFLAGS -Wall -o aio-stress aio-stress.c -laio -lpthread

# install for package aiostress
%{__install} -m 755 -d $RPM_BUILD_ROOT%{_bindir}
%{__install} -m 755 %{name}-%{version}/aio-stress $RPM_BUILD_ROOT%{_bindir}/
%{__strip} -s $RPM_BUILD_ROOT%{_bindir}/aio-stress

# install for package ctcs-glue
%{__install} -m 755 -d $RPM_BUILD_ROOT/usr/lib/ctcs2
%{__install} -m 755 -d $RPM_BUILD_ROOT/usr/lib/ctcs2/tcf
%{__install} -m 755 -d $RPM_BUILD_ROOT/usr/lib/ctcs2/tools
%{__install} -m 755 -d $RPM_BUILD_ROOT/usr/lib/ctcs2/bin
%{__install} -m 755 -d $RPM_BUILD_ROOT/usr/lib/ctcs2/bin/aiostress

%{__install} -m 644 %{name}-ctcs-glue-%{version}/tcf/aiostress.tcf $RPM_BUILD_ROOT/usr/lib/ctcs2/tcf/
%{__install} -m 755 %{name}-ctcs-glue-%{version}/tools/aiostress-run $RPM_BUILD_ROOT/usr/lib/ctcs2/tools/
%{__ln_s} ../../../../../%{_bindir}/aio-stress $RPM_BUILD_ROOT/usr/lib/ctcs2/bin/aiostress/


%defattr(-, root, root)
%attr (0755, root, root) %{_bindir}/aio-stress

%files ctcs-glue
%defattr(-, root, root)
%dir /usr/lib/ctcs2
%dir /usr/lib/ctcs2/tcf
%dir /usr/lib/ctcs2/tools
%dir /usr/lib/ctcs2/bin
%dir /usr/lib/ctcs2/bin/aiostress

%attr (0644, root, root) /usr/lib/ctcs2/tcf/aiostress.tcf
%attr (0755, root, root) /usr/lib/ctcs2/tools/aiostress-run