Skip to content

Commit

Permalink
Test lmbench: Change shebangs on lmbench scripts
Browse files Browse the repository at this point in the history
Some distros such as ubuntu use dash as the default
shell, and lmbench scripts use constructs incompatible
with it. So, at least for ubuntu, let's change the
shebangs from /bin/sh to /bin/bash.

The patch also re-masters the lmbench3.diff patch to
have all the description of what it does.

Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
  • Loading branch information
lmr committed Apr 8, 2010
1 parent c69fdbb commit b25b04b
Show file tree
Hide file tree
Showing 3 changed files with 252 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
diff -urw lmbench3.old/Makefile lmbench3/Makefile
--- lmbench3.old/Makefile 2005-08-22 17:19:55.000000000 -0700
+++ lmbench3/Makefile 2009-12-02 15:55:29.000000000 -0800
From 05546bfc9968a58e9569f2a8a9764f6e53f20167 Mon Sep 17 00:00:00 2001
From: Lucas Meneghel Rodrigues <[email protected]>
Date: Thu, 8 Apr 2010 10:38:13 -0300
Subject: [PATCH 1/2] Fix build issues with lmbench

* removes Makefile references to bitkeeper
* default mail to no, fix job placement defaults (masouds)
* adds "config" Makefile targets to perform configuration only
* changes scripts/getlist to consider result files that do
* not start with "[lmbench 3.x..." (still requires such a line somewhere
in the first 1000 bytes of the file)
---
Makefile | 4 ++++
scripts/config-run | 13 ++++++++-----
scripts/getlist | 4 ++--
src/Makefile | 44 ++++++--------------------------------------
4 files changed, 20 insertions(+), 45 deletions(-)

diff --git a/Makefile b/Makefile
index d3d00f4..9a568f3 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,7 @@
#
# build (default) go to the source directory and build the benchmark
Expand All @@ -9,7 +28,7 @@ diff -urw lmbench3.old/Makefile lmbench3/Makefile
# rerun run the benchmark again
# see see the results that came with this release
# Go to the results directory and read the Makefile.
@@ -22,6 +23,9 @@
@@ -22,6 +23,9 @@ build:
results: FRC
cd src && $(MAKE) results

Expand All @@ -19,10 +38,11 @@ diff -urw lmbench3.old/Makefile lmbench3/Makefile
rerun:
cd src && $(MAKE) rerun

diff -urw lmbench3.old/scripts/config-run lmbench3/scripts/config-run
--- lmbench3.old/scripts/config-run 2005-08-22 17:19:55.000000000 -0700
+++ lmbench3/scripts/config-run 2009-12-03 15:03:46.000000000 -0800
@@ -115,9 +115,12 @@
diff --git a/scripts/config-run b/scripts/config-run
index b8c17d5..9958a31 100755
--- a/scripts/config-run
+++ b/scripts/config-run
@@ -115,9 +115,12 @@ three attendent child processes sending data down the pipes and
three benchmark processes reading data and doing the measurements.

EOF
Expand All @@ -36,7 +56,7 @@ diff -urw lmbench3.old/scripts/config-run lmbench3/scripts/config-run
case "$LMBENCH_SCHED" in
1) LMBENCH_SCHED=DEFAULT;;
2) LMBENCH_SCHED=BALANCED;;
@@ -657,13 +660,13 @@
@@ -657,13 +660,13 @@ fast box, they may be made available on the lmbench web page, which is

EOF

Expand All @@ -54,10 +74,11 @@ diff -urw lmbench3.old/scripts/config-run lmbench3/scripts/config-run
;;
esac

diff -urw lmbench3.old/scripts/getlist lmbench3/scripts/getlist
--- lmbench3.old/scripts/getlist 2005-08-22 17:19:55.000000000 -0700
+++ lmbench3/scripts/getlist 2009-12-01 17:52:29.000000000 -0800
@@ -22,9 +22,9 @@
diff --git a/scripts/getlist b/scripts/getlist
index 8c35970..f03b679 100755
--- a/scripts/getlist
+++ b/scripts/getlist
@@ -22,9 +22,9 @@ if (-f $LIST) {
foreach $file (@files) {
next if $file =~ /\.INFO$/;
open(FD, $file) || next;
Expand All @@ -69,9 +90,10 @@ diff -urw lmbench3.old/scripts/getlist lmbench3/scripts/getlist
print "$file ";
}
print "\n";
diff -urw lmbench3.old/src/Makefile lmbench3/src/Makefile
--- lmbench3.old/src/Makefile 2005-08-22 17:19:54.000000000 -0700
+++ lmbench3/src/Makefile 2009-12-02 15:55:22.000000000 -0800
diff --git a/src/Makefile b/src/Makefile
index 2555014..cf0b779 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -4,6 +4,7 @@
#
# lmbench [default] builds the benchmark suite for the current os/arch
Expand All @@ -80,7 +102,7 @@ diff -urw lmbench3.old/src/Makefile lmbench3/src/Makefile
# rerun reruns the benchmark using the same parameters as last time
# scaling reruns the benchmark using same parameters as last time,
# except it asks what scaling value to use
@@ -118,8 +119,10 @@
@@ -118,8 +119,10 @@ results: lmbench
@env OS="${OS}" ../scripts/config-run
@env OS="${OS}" ../scripts/results

Expand All @@ -92,7 +114,7 @@ diff -urw lmbench3.old/src/Makefile lmbench3/src/Makefile
@env OS="${OS}" ../scripts/results

scaling: lmbench
@@ -165,41 +168,6 @@
@@ -165,41 +168,6 @@ debug:
assembler:
@env CFLAGS=-O MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="${CC}" OS="${OS}" ../scripts/build asm

Expand Down Expand Up @@ -134,7 +156,7 @@ diff -urw lmbench3.old/src/Makefile lmbench3/src/Makefile
get $(SRCS):
-get -s $(SRCS)

@@ -228,9 +196,9 @@
@@ -228,9 +196,9 @@ testmake: $(SRCS) $(UTILS) # used by scripts/make to test gmake
install install-target dist get edit get-e clean clobber \
share depend testmake

Expand All @@ -146,3 +168,6 @@ diff -urw lmbench3.old/src/Makefile lmbench3/src/Makefile
chmod +x $O/lmbench

$O/lmbench.a: $(LIBOBJS)
--
1.6.6.1

204 changes: 204 additions & 0 deletions lmbench/0002-Changing-shebangs-on-lmbench-scripts.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
From 7fc9ef8ce9ce630b53b20f1d4207c587df9b9763 Mon Sep 17 00:00:00 2001
From: Lucas Meneghel Rodrigues <[email protected]>
Date: Thu, 8 Apr 2010 09:57:10 -0300
Subject: [PATCH 2/2] Changing shebangs on lmbench scripts

Some distros such as ubuntu use dash as the default
shell, and lmbench scripts use constructs incompatible
with it. So, at least for ubuntu, let's change the
shebangs from /bin/sh to /bin/bash.

Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
scripts/build | 2 +-
scripts/compiler | 2 +-
scripts/config | 2 +-
scripts/config-run | 2 +-
scripts/config-scaling | 2 +-
scripts/do_ctx | 2 +-
scripts/info | 2 +-
scripts/lmbench | 2 +-
scripts/make | 2 +-
scripts/mkrelease | 2 +-
scripts/os | 2 +-
scripts/output | 2 +-
scripts/results | 2 +-
scripts/synchronize | 2 +-
scripts/target | 2 +-
scripts/version | 2 +-
scripts/xroff | 2 +-
17 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/scripts/build b/scripts/build
index 16a6600..7f0d41e 100755
--- a/scripts/build
+++ b/scripts/build
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash

CC=${CC-`../scripts/compiler`}
MAKE=${MAKE-`../scripts/make`}
diff --git a/scripts/compiler b/scripts/compiler
index 2fca921..de57298 100755
--- a/scripts/compiler
+++ b/scripts/compiler
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash

if [ "X$CC" != "X" ] && echo "$CC" | grep -q '`'
then
diff --git a/scripts/config b/scripts/config
index b58cb60..2c0276d 100755
--- a/scripts/config
+++ b/scripts/config
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash

UNAME=`uname -n 2>/dev/null`
if [ X$UNAME = X ]
diff --git a/scripts/config-run b/scripts/config-run
index 9958a31..76ead34 100755
--- a/scripts/config-run
+++ b/scripts/config-run
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash

# Configure parameters for lmbench.
# %I% %E% %@%
diff --git a/scripts/config-scaling b/scripts/config-scaling
index 12e0f02..03f3e38 100755
--- a/scripts/config-scaling
+++ b/scripts/config-scaling
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash

# config-scaling - reconfigure just the scaling parameter SYNC_MAX
#
diff --git a/scripts/do_ctx b/scripts/do_ctx
index 002a6c2..2b1db4c 100755
--- a/scripts/do_ctx
+++ b/scripts/do_ctx
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash

# Make sure we can find: ./cmd, df, and netstat
PATH=.:$PATH:/etc:/usr/etc:/sbin:/usr/sbin
diff --git a/scripts/info b/scripts/info
index e6860ed..18a10b2 100755
--- a/scripts/info
+++ b/scripts/info
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash

UNAME=`uname -n 2>/dev/null`
if [ X$UNAME = X ]
diff --git a/scripts/lmbench b/scripts/lmbench
index 53ea511..63e5e07 100755
--- a/scripts/lmbench
+++ b/scripts/lmbench
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash

# lmbench - run the lmbench benchmark suite.
#
diff --git a/scripts/make b/scripts/make
index 59bf238..2886ba6 100755
--- a/scripts/make
+++ b/scripts/make
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash

if [ "X$MAKE" != "X" ] && echo "$MAKE" | grep -q '`'
then
diff --git a/scripts/mkrelease b/scripts/mkrelease
index be50f03..656f9dd 100755
--- a/scripts/mkrelease
+++ b/scripts/mkrelease
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash

# %W%
#
diff --git a/scripts/os b/scripts/os
index ea767c6..c9aed11 100755
--- a/scripts/os
+++ b/scripts/os
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash

if [ "X$OS" != "X" ] && echo "$OS" | grep -q '`'
then
diff --git a/scripts/output b/scripts/output
index 2a204e3..a27571a 100755
--- a/scripts/output
+++ b/scripts/output
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
trap "echo /dev/null" 20
OUTPUT=/dev/null; export OUTPUT
if [ -w /dev/tty ]; then
diff --git a/scripts/results b/scripts/results
index cd07c15..5f817d9 100755
--- a/scripts/results
+++ b/scripts/results
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash

# $Id$

diff --git a/scripts/synchronize b/scripts/synchronize
index 302db00..eb36d5b 100755
--- a/scripts/synchronize
+++ b/scripts/synchronize
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash

# %W% %@% Copyright (c) 1998 Larry McVoy.
#
diff --git a/scripts/target b/scripts/target
index 77eee07..6998da9 100755
--- a/scripts/target
+++ b/scripts/target
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash

# Figure out the OS name if possible.
#
diff --git a/scripts/version b/scripts/version
index 879b700..9e6bf6c 100755
--- a/scripts/version
+++ b/scripts/version
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash

# %W% %@%

diff --git a/scripts/xroff b/scripts/xroff
index d5acf20..02c61d2 100755
--- a/scripts/xroff
+++ b/scripts/xroff
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash

# X previewer like groff/nroff scripts.
groff -P -filename -P "| groff -Z -X -Tps $*" -X -Tps "$@"
--
1.6.6.1

5 changes: 4 additions & 1 deletion lmbench/lmbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ def setup(self, tarball = 'lmbench3.tar.bz2', fsdir=None, file=None):
tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir)
utils.extract_tarball_to_dir(tarball, self.srcdir)
os.chdir(self.srcdir)
utils.system('patch -p1 < ../lmbench3.diff')
p1 = 'patch -p1 < ../0001-Fix-build-issues-with-lmbench.patch'
p2 = 'patch -p1 < ../0002-Changing-shebangs-on-lmbench-scripts.patch'
utils.system(p1)
utils.system(p2)

# build lmbench
utils.system('make')
Expand Down

0 comments on commit b25b04b

Please sign in to comment.