git.iko.soy/typeable/nixpkgs
on master help sign in
bonnie++: upgrade to 1.97

Also a patch with some OS X specific changes (stolen from Homebrew).

commit17b19977cf8b0ac643b126c8b6e20f36fd94c54a authorKirill Elagin <kirelagin@gmail.com> dateThu 16 Jun 2016, 19:49 (10 years ago) parent7a6ec0a
2 files changed+165−4
pkgs/tools/filesystems/bonnie/bonnie-homebrew.patch+157 pkgs/tools/filesystems/bonnie/default.nix+8−4
pkgs/tools/filesystems/bonnie/bonnie-homebrew.patchnew file+157
@@ -0,0 +1,157 @@
1+Copyright 2009-2016 Homebrew contributors.
2+
3+Redistribution and use in source and binary forms, with or without
4+modification, are permitted provided that the following conditions
5+are met:
6+
7+ 1. Redistributions of source code must retain the above copyright
8+ notice, this list of conditions and the following disclaimer.
9+ 2. Redistributions in binary form must reproduce the above copyright
10+ notice, this list of conditions and the following disclaimer in the
11+ documentation and/or other materials provided with the distribution.
12+
13+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23+
24+
25+# Changes included in this patchset:
26+# 1) Explicitly use clang/clang++ in Makefile
27+# 2) __min() and __max() macros break bon_csv2html.cpp: "redefinition of 'min' as different kind of symbol"
28+# Remove the construct in favor of macro targets min()/max() provided by the library
29+# Files affected: port.h.in port.h duration.cpp bonnie++.cpp
30+# 3) Remove the #ifdef _LARGEFILE64_SOURCE macros which not only prohibits the intended functionality of
31+# splitting into 2 GB files for such filesystems but also incorrectly tests for it in the first place.
32+# The ideal fix would be to replace the AC_TRY_RUN() in configure.in if the fail code actually worked.
33+# Files affected: bonnie++.cp
34+
35+diff --git i/Makefile w/Makefile
36+index 4bb5103..8f7ed41 100644
37+--- i/Makefile
38++++ w/Makefile
39+@@ -10,8 +10,8 @@ eprefix=${prefix}
40+ #MORE_WARNINGS=-Weffc++
41+ 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)
42+ CFLAGS=-O2 -DNDEBUG $(WFLAGS) $(MORECFLAGS)
43+-CXX=g++ $(CFLAGS)
44+-LINK=g++
45++CXX=clang++ $(CFLAGS)
46++LINK=clang++
47+ THREAD_LFLAGS=-lpthread
48+
49+ INSTALL=/usr/bin/install -c
50+diff --git i/bonnie++.cpp w/bonnie++.cpp
51+index 8c5a43a..8a4b3dc 100644
52+--- i/bonnie++.cpp
53++++ w/bonnie++.cpp
54+@@ -73,7 +73,7 @@ public:
55+ void set_io_chunk_size(int size)
56+ { delete m_buf; pa_new(size, m_buf, m_buf_pa); m_io_chunk_size = size; }
57+ void set_file_chunk_size(int size)
58+- { delete m_buf; m_buf = new char[__max(size, m_io_chunk_size)]; m_file_chunk_size = size; }
59++ { delete m_buf; m_buf = new char[max(size, m_io_chunk_size)]; m_file_chunk_size = size; }
60+
61+ // Return the page-aligned version of the local buffer
62+ char *buf() { return m_buf_pa; }
63+@@ -138,7 +138,7 @@ CGlobalItems::CGlobalItems(bool *exitFlag)
64+ , m_buf(NULL)
65+ , m_buf_pa(NULL)
66+ {
67+- pa_new(__max(m_io_chunk_size, m_file_chunk_size), m_buf, m_buf_pa);
68++ pa_new(max(m_io_chunk_size, m_file_chunk_size), m_buf, m_buf_pa);
69+ SetName(".");
70+ }
71+
72+@@ -294,11 +294,7 @@ int main(int argc, char *argv[])
73+ {
74+ char *sbuf = _strdup(optarg);
75+ char *size = strtok(sbuf, ":");
76+-#ifdef _LARGEFILE64_SOURCE
77+ file_size = size_from_str(size, "gt");
78+-#else
79+- file_size = size_from_str(size, "g");
80+-#endif
81+ size = strtok(NULL, "");
82+ if(size)
83+ {
84+@@ -384,17 +380,8 @@ int main(int argc, char *argv[])
85+ if(file_size % 1024 > 512)
86+ file_size = file_size + 1024 - (file_size % 1024);
87+ }
88+-#ifndef _LARGEFILE64_SOURCE
89+- if(file_size == 2048)
90+- file_size = 2047;
91+- if(file_size > 2048)
92+- {
93+- fprintf(stderr, "Large File Support not present, can't do %dM.\n", file_size);
94+- usage();
95+- }
96+-#endif
97+- globals.byte_io_size = __min(file_size, globals.byte_io_size);
98+- globals.byte_io_size = __max(0, globals.byte_io_size);
99++ globals.byte_io_size = min(file_size, globals.byte_io_size);
100++ globals.byte_io_size = max(0, globals.byte_io_size);
101+
102+ if(machine == NULL)
103+ {
104+@@ -465,14 +452,6 @@ int main(int argc, char *argv[])
105+ && (directory_max_size < directory_min_size || directory_max_size < 0
106+ || directory_min_size < 0) )
107+ usage();
108+-#ifndef _LARGEFILE64_SOURCE
109+- if(file_size > (1 << (31 - 20 + globals.io_chunk_bits)) )
110+- {
111+- fprintf(stderr
112+- , "The small chunk size and large IO size make this test impossible in 32bit.\n");
113+- usage();
114+- }
115+-#endif
116+ if(file_size && globals.ram && (file_size * concurrency) < (globals.ram * 2) )
117+ {
118+ fprintf(stderr
119+diff --git i/duration.cpp w/duration.cpp
120+index efa3fd3..f943155 100644
121+--- i/duration.cpp
122++++ w/duration.cpp
123+@@ -38,7 +38,7 @@ double Duration_Base::stop()
124+ getTime(&tv);
125+ double ret;
126+ ret = tv - m_start;
127+- m_max = __max(m_max, ret);
128++ m_max = max(m_max, ret);
129+ return ret;
130+ }
131+
132+diff --git i/port.h w/port.h
133+index 8d53622..2e1f112 100644
134+--- i/port.h
135++++ w/port.h
136+@@ -49,8 +49,6 @@ typedef struct timeval TIMEVAL_TYPE;
137+ #endif
138+
139+ typedef int FILE_TYPE;
140+-#define __min min
141+-#define __max max
142+ typedef unsigned int UINT;
143+ typedef unsigned long ULONG;
144+ typedef const char * PCCHAR;
145+diff --git i/port.h.in w/port.h.in
146+index 69c8f24..8359d72 100644
147+--- i/port.h.in
148++++ w/port.h.in
149+@@ -49,8 +49,6 @@ typedef struct timeval TIMEVAL_TYPE;
150+ #endif
151+
152+ typedef int FILE_TYPE;
153+-#define __min min
154+-#define __max max
155+ typedef unsigned int UINT;
156+ typedef unsigned long ULONG;
157+ typedef const char * PCCHAR;
pkgs/tools/filesystems/bonnie/default.nix+8−4
@@ -1,16 +1,20 @@
11{ stdenv, fetchurl }:
22
33stdenv.mkDerivation {
4− name = "bonnie++-1.03e";
4+ name = "bonnie++-1.97";
55 src = fetchurl {
6− url = http://www.coker.com.au/bonnie++/bonnie++-1.03e.tgz;
7− sha256 = "1jz2l8dz08c7vxvchigisv5a293yz95bw1k81dv6bgrlcq8ncf6b";
6+ url = http://www.coker.com.au/bonnie++/experimental/bonnie++-1.97.tgz;
7+ sha256 = "10jrqgvacvblyqv38pg5jb9jspyisxaladcrp8k6b2k46xcs1xa4";
88 };
9+
10+ patches = stdenv.lib.optional stdenv.isDarwin ./bonnie-homebrew.patch;
11+
912 enableParallelBuilding = true;
13+
1014 meta = {
1115 homepage = "http://www.coker.com.au/bonnie++/";
1216 description = "Hard drive and file system benchmark suite";
1317 license = stdenv.lib.licenses.gpl2;
14− platforms = stdenv.lib.platforms.linux;
18+ platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
1519 };
1620}