Skip to contentSkip to conversation

package/unixbench: new package

PATCH New Atharva Lele 2 participants 2 messages Mar 28, 2019 – Mar 31, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/unixbench: new package

UnixBench tries to compile its binaries regargless of them being compiled or not. We patch it to disable this behaviour since we may not always have a compiler onboard.

---
Changes v1 -> v2:
- fixed entry into DEVELOPERS files (suggested by Yann E. Morin)
- added commit log to .patch file (suggested by Yann, Romain)
- removed commented out lines (suggested by Yann, Romain)
- UnixBench now depends on having a MMU and selects Perl for runtime (Suggested by Yann, Romain)
- added hash for LICENSE file (suggested by Yann, Romain)
- now makefile does not copy unnecessary directories onto target (suggested by Romain)

---
 DEVELOPERS                                    |  3 ++
 package/Config.in                             |  1 +
 .../unixbench/0001-remove-make-check.patch    | 37 +++++++++++++++++
 package/unixbench/Config.in                   | 18 ++++++++
 package/unixbench/unixbench                   |  3 ++
 package/unixbench/unixbench.hash              |  3 ++
 package/unixbench/unixbench.mk                | 41 +++++++++++++++++++
 7 files changed, 106 insertions(+)
 create mode 100644 package/unixbench/0001-remove-make-check.patch
 create mode 100644 package/unixbench/Config.in
 create mode 100644 package/unixbench/unixbench
 create mode 100644 package/unixbench/unixbench.hash
 create mode 100644 package/unixbench/unixbench.mk
DEVELOPERS +3 -0
index c0a4814a86..f8b920d019 100644
@@ -236,6 +236,9 @@ F:	package/luasec/
 F:	package/lua-ev/
 F:	package/orbit/
 
+N:	Atharva Lele <[email protected]>
+F:	package/unixbench/
+
 N:	Bartosz Bilas <[email protected]>
 F:	package/qt5/qt5scxml/
 
package/Config.in +1 -0
index b5321aeb49..521308c1d8 100644
@@ -132,6 +132,7 @@ menu "Debugging, profiling and benchmark"
 	source "package/trace-cmd/Config.in"
 	source "package/trinity/Config.in"
 	source "package/uclibc-ng-test/Config.in"
+	source "package/unixbench/Config.in"
 	source "package/valgrind/Config.in"
 	source "package/vmtouch/Config.in"
 	source "package/whetstone/Config.in"
package/unixbench/0001-remove-make-check.patch new file +37 -0
new file mode 100644
index 0000000000..e8f5d683a1
@@ -0,0 +1,37 @@
+From dc6b30c57a35aca7119d18f916dcd0a40c0fc047 Mon Sep 17 00:00:00 2001
+From: Atharva Lele <[email protected]>
+Date: Thu, 28 Mar 2019 22:58:16 +0530
+Subject: [PATCH] remove make check
+
+Our target board/system may not always have an oboard
+compiler. And, we already have the built binaries.
+
+Remove the make command from the Run script
+to avoid erroring out while executing the program.
+
+Signed-off-by: Atharva Lele <[email protected]>
+---
+ Run | 7 -------
+ 1 file changed, 7 deletions(-)
+
+diff --git a/UnixBench/Run b/UnixBench/Run
+index b4abd26..e86a08a 100755
+--- a/UnixBench/Run
++++ b/UnixBench/Run
+@@ -875,13 +875,6 @@ sub preChecks {
+ 
+     # Check that the required files are in the proper places.
+     my $make = $ENV{MAKE} || "make";
+-    system("$make check");
+-    if ($? != 0) {
+-        system("$make all");
+-        if ($? != 0) {
+-            abortRun("\"$make all\" failed");
+-        }
+-    }
+ 
+     # Create a script to kill this run.
+     system("echo \"kill -9 $$\" > \"${TMPDIR}/kill_run\"");
+-- 
+2.21.0
+
package/unixbench/Config.in new file +18 -0
new file mode 100644
index 0000000000..b2ba055bfb
@@ -0,0 +1,18 @@
+config BR2_PACKAGE_UNIXBENCH
+	bool "unixbench"
+	depends on BR2_USE_MMU
+	select BR2_PACKAGE_PERL # runtime
+	help
+	  UnixBench is the original BYTE UNIX benchmark suite,
+	  updated and revised by many people over the years.
+
+	  The purpose of UnixBench is to provide a basic indicator
+	  of the performance of a Unix-like system; hence multiple
+	  tests are used to test various aspects of the system's
+	  performance. These test results are then compared to the
+	  scores from a baseline system to produce an index value,
+	  which is easier to handle than raw scores. The entire set
+	  of index values is then combined to make an overall index
+	  for the system. Multi-CPU systems are supported.
+
+	  https://github.com/kdlucas/byte-unixbench
package/unixbench/unixbench new file +3 -0
new file mode 100644
index 0000000000..18863553a9
@@ -0,0 +1,3 @@
+#!/bin/sh
+cd /usr/lib/unixbench
+exec ./Run "${@}"
package/unixbench/unixbench.hash new file +3 -0
new file mode 100644
index 0000000000..fdc50b2627
@@ -0,0 +1,3 @@
+# sha256 locally computed
+sha256 1677dcdcbed78805848b3c3fd58a6d052b677b6a4ee7add4db74acc4d3364a79 unixbench-070030e09f6effdf0c6721e8fcc3a5c6fb5bed1a.tar.gz
+sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 LICENSE.txt
package/unixbench/unixbench.mk new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.21.0
#1 lore raw

PATCH v2 1/1 package/unixbench: new package

Atharva, All,

On 2019-03-29 00:55 +0530, Atharva Lele spake thusly:

Quoted 3 lines

UnixBench tries to compile its binaries regargless of them being compiled or not. We patch it to disable this behaviour since we may not always have a compiler onboard.

This second iteration is pretty good, now. :-)
Sorry it took me a while to get at it...

You forgot to add (small) explanations for the unixbench wrapper you install in /usr/bin/, for example:

UnixBench installs a collection of many small executables, and a "Run" script that runs them in sequence. To avoid polluting /usr/bin, we install them all in /usr/lib/unixbench/ and add a small wrapper in /usr/bin/, not unlike what ArchLinux does.

Quoted 11 lines

---
Changes v1 -> v2:
- fixed entry into DEVELOPERS files (suggested by Yann E. Morin)
- added commit log to .patch file (suggested by Yann, Romain)
- removed commented out lines (suggested by Yann, Romain)
- UnixBench now depends on having a MMU and selects Perl for runtime (Suggested by Yann, Romain)
- added hash for LICENSE file (suggested by Yann, Romain)
- now makefile does not copy unnecessary directories onto target (suggested by Romain)

Good changelog, thanks.

It is customary that, when you resend a patch, you inform the previous reviewers. Add them as Cc: tags just below your signed-off-by line; git send-email will notice and automatically add those in Cc of the mail:

Cc "Yann E. MORIN" <[email protected]>
Cc Romain Naour <[email protected]>

[--SNIP--]

package/unixbench/0001-remove-make-check.patch

Quoted 5 lines
package/unixbench/0001-remove-make-check.patch new file +0 -0
new file mode 100644
index 0000000000..e8f5d683a1

[--SNIP--]

package/unixbench/0001-remove-make-check.patch line 24

Quoted 8 lines
package/unixbench/0001-remove-make-check.patch new file +8 -0
+diff --git a/UnixBench/Run b/UnixBench/Run
+index b4abd26..e86a08a 100755
+--- a/UnixBench/Run
++++ b/UnixBench/Run
+@@ -875,13 +875,6 @@ sub preChecks {
+ 
+     # Check that the required files are in the proper places.
+     my $make = $ENV{MAKE} || "make";

Ideally, the two lines above could very well have been removed as well, since $make is no longer used.

[--SNIP--]

package/unixbench/Config.in line 3

Quoted 9 lines
package/unixbench/Config.in new file +3 -0
new file mode 100644
index 0000000000..b2ba055bfb
@@ -0,0 +1,18 @@
+config BR2_PACKAGE_UNIXBENCH
+	bool "unixbench"
+	depends on BR2_USE_MMU

This dependency on MMU is because of perl, so we indicate it as:

depends on BR2_USE_MMU # perl

package/unixbench/Config.in line 4

Quoted 1 line
package/unixbench/Config.in new file +1 -0
+	select BR2_PACKAGE_PERL # runtime

Yes.

[--SNIP--]

Quoted 6 lines
package/unixbench/unixbench.mk new file +0 -0
new file mode 100644
index 0000000000..570ef6a75f

package/unixbench/unixbench.mk line 10

Quoted 10 lines
package/unixbench/unixbench.mk new file +10 -0
@@ -0,0 +1,41 @@
+################################################################################
+#
+# unixbench
+#
+################################################################################
+
+# The latest updates to the git tree of UnixBench enable setting compiler flags
+# using make. They also fix various compiler warnings and update the makefile
+# structure. The tree hasn't been updated since early 2018, and the binaries
+# built from the latest commit have been stable.

All this blurb is not really interesting, in fact. What you could just do, is add something in the commit log tthat explains why we use a git sha1:

Upstream has not made any release in the past 4 years or so, so use the latest commit on the master branch.

package/unixbench/unixbench.mk line 18

Quoted 8 lines
package/unixbench/unixbench.mk new file +8 -0
+UNIXBENCH_VERSION = 070030e09f6effdf0c6721e8fcc3a5c6fb5bed1a
+UNIXBENCH_SITE = $(call github,kdlucas,byte-unixbench,$(UNIXBENCH_VERSION))
+UNIXBENCH_LICENSE = GPL-2.0
+UNIXBENCH_LICENSE_FILE = LICENSE.txt
+
+# UnixBench tries to compile its binaries regargless of them being compiled
+# or not. The patch will disable that since we may not always have a compiler
+# onboard.

This comment is now unneeded, as it is explained in the patch itself, and in the commit log.

package/unixbench/unixbench.mk line 23

Quoted 4 lines
package/unixbench/unixbench.mk new file +4 -0
+# Auto detection would set CFLAGS for the host machine, using -march=native
+# and -mtune=native which does not make sense for cross compilation, resulting
+# in a failed compile. Setting UB_GCC_OPTIONS skips the detection process
+# and forces CFLAGS we're interested in.

I'd have prefered that you explain this in the commit log, and that you'd just use a simpler comment here:

# Set CFLAGS in UB_GCC_OPTIONS to avoid faulty auto-detection.

package/unixbench/unixbench.mk line 29

Quoted 6 lines
package/unixbench/unixbench.mk new file +6 -0
+define UNIXBENCH_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \
+	$(MAKE) \
+		-C $(@D)/UnixBench \
+		UB_GCC_OPTIONS="$(TARGET_CFLAGS)" \
+		CC="$(TARGET_CC)"

In my twisted head, I find it would be more logical to specofy CC first, and then its options. But there is no technical consequence, it's just about "human" logic...

package/unixbench/unixbench.mk line 34

Quoted 5 lines
package/unixbench/unixbench.mk new file +5 -0
+endef
+
+# Copy the compiled files into the proper location and install the binary.
+# pgms stores binaries, results stores results, Run is the perl script to
+# run the benchmark.

This is a bit overly verbose. The only intreresting part is:

    # pgms contains the individual test executables.

The rest is obvious by name.

No need to resend the patch for now, I guess.

Quoted 14 lines
package/unixbench/unixbench.mk new file +7 -0
+define UNIXBENCH_INSTALL_TARGET_CMDS
+	mkdir -p $(TARGET_DIR)/usr/lib/unixbench
+	cp -a $(@D)/UnixBench/{pgms,results,Run} $(TARGET_DIR)/usr/lib/unixbench/
+	$(INSTALL) -D -m 0755 $(UNIXBENCH_PKGDIR)/unixbench $(TARGET_DIR)/usr/bin/unixbench
+endef
+
+$(eval $(generic-package))
Signature · 6 lines
2.21.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'