diff --git a/utils/bonnie++/Makefile b/utils/bonnie++/Makefile new file mode 100644 index 0000000000..0008cc23c9 --- /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 0000000000..0379fec0bd --- /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 0000000000..ccec8e8f10 --- /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());