From 5e2e3d3f3e41e1a9ae8633870ec043cf73ebee56 Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Wed, 27 Jan 2016 12:44:44 -0800 Subject: [PATCH] utils: Import bonnie++ Import bonnie++ from oldpackages: * update to 1.97 * refresh patches * add license tags * add myself as maintainer Signed-off-by: Florian Fainelli --- utils/bonnie++/Makefile | 53 +++++++++++++++++++ .../patches/001-cross_compile_fix.patch | 38 +++++++++++++ .../002-add-verbose-error-messages.patch | 47 ++++++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 utils/bonnie++/Makefile create mode 100644 utils/bonnie++/patches/001-cross_compile_fix.patch create mode 100644 utils/bonnie++/patches/002-add-verbose-error-messages.patch diff --git a/utils/bonnie++/Makefile b/utils/bonnie++/Makefile new file mode 100644 index 000000000..0008cc23c --- /dev/null +++ b/utils/bonnie++/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2009-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=bonnie++ +PKG_VERSION:=1.97 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://www.coker.com.au/bonnie++/experimental/ +PKG_MD5SUM:=d6cf9703242998b2ddc2d875b028b3c6 +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=copyright.txt +PKG_MAINTAINER:=Florian Fainelli + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION).1 + +include $(INCLUDE_DIR)/package.mk + +define Package/bonniexx + SECTION:=utils + CATEGORY:=Utilities + DEPENDS:=+libstdcpp +libpthread + TITLE:=Bonnie++ - hard drive bottleneck testing program. + URL:=http://www.coker.com.au/bonnie++/ +endef + +define Package/bonniexx/description + Bonnie++ is a benchmark suite that is aimed at performing a number of simple + tests of hard drive and file system performance. +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + TARGET_CXX="$(TARGET_CXX)" \ + TARGET_LINK="$(TARGET_CXX)" \ + MORECFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CXXFLAGS)" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all +endef + +define Package/bonniexx/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_BUILD_DIR)/bonnie++ $(1)/usr/bin/ + $(CP) $(PKG_BUILD_DIR)/bon_csv2html $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,bonniexx)) diff --git a/utils/bonnie++/patches/001-cross_compile_fix.patch b/utils/bonnie++/patches/001-cross_compile_fix.patch new file mode 100644 index 000000000..0379fec0b --- /dev/null +++ b/utils/bonnie++/patches/001-cross_compile_fix.patch @@ -0,0 +1,38 @@ +Index: bonnie++-1.97.1/configure +=================================================================== +--- bonnie++-1.97.1.orig/configure ++++ bonnie++-1.97.1/configure +@@ -3955,9 +3955,7 @@ rm -f core conftest.err conftest.$ac_obj + + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +-as_fn_error $? "cannot run test program while cross compiling +-See \`config.log' for more details" "$LINENO" 5 ; } ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} } + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +Index: bonnie++-1.97.1/Makefile +=================================================================== +--- bonnie++-1.97.1.orig/Makefile ++++ bonnie++-1.97.1/Makefile +@@ -1,5 +1,7 @@ + EXES=bonnie++ zcav getc_putc getc_putc_helper + EXE=bon_csv2html generate_randfile ++TARGET_CXX=g++ ++TARGET_LINK=g++ + + all: $(EXE) $(EXES) + +@@ -10,8 +12,8 @@ eprefix=${prefix} + #MORE_WARNINGS=-Weffc++ + WFLAGS=-Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -Wcast-align -Wsign-compare -Wpointer-arith -Wwrite-strings -Wformat-security -Wswitch-enum -Winit-self $(MORE_WARNINGS) + CFLAGS=-O2 -DNDEBUG $(WFLAGS) $(MORECFLAGS) +-CXX=g++ $(CFLAGS) +-LINK=g++ ++CXX=$(TARGET_CXX) $(CFLAGS) ++LINK=$(TARGET_LINK) + THREAD_LFLAGS=-lpthread + + INSTALL=/usr/bin/install -c diff --git a/utils/bonnie++/patches/002-add-verbose-error-messages.patch b/utils/bonnie++/patches/002-add-verbose-error-messages.patch new file mode 100644 index 000000000..ccec8e8f1 --- /dev/null +++ b/utils/bonnie++/patches/002-add-verbose-error-messages.patch @@ -0,0 +1,47 @@ +--- a/bon_file.cpp ++++ b/bon_file.cpp +@@ -464,25 +464,37 @@ int COpenTest::delete_sequential(BonTime + } + if(m_number_directories != 1) + { +- if(chdir("..") || rmdir(buf)) ++ if(chdir("..")) + { ++ io_error("chdir"); ++ return -1; ++ } ++ if(rmdir(buf)) ++ { ++ fprintf(stderr, "Unable to delete directory '%s'\n", buf); + io_error("rmdir"); + return -1; + } + } + } +- if(chdir("..") || rmdir(m_dirname)) ++ if(count != m_number) + { +- io_error("rmdir"); ++ fprintf(stderr, "Expected %d files but only got %d\n", m_number, count); + return -1; + } +- delete m_dirname; +- m_dirname = NULL; +- if(count != m_number) ++ if(chdir("..")) + { +- fprintf(stderr, "Expected %d files but only got %d\n", m_number, count); ++ io_error("chdir"); ++ return -1; ++ } ++ if(rmdir(m_dirname)) ++ { ++ fprintf(stderr, "Unable to delete directory '%s'\n", m_dirname); ++ io_error("rmdir"); + return -1; + } ++ delete m_dirname; ++ m_dirname = NULL; + sync(); + timer.stop_and_record(DelSeq); + timer.add_latency(DelSeq, dur.getMax());