From fba6bb94895e443830cfa28a1937cb7caf8dab8d Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 12 Aug 2020 18:45:55 -0700 Subject: [PATCH] stress-ng: add This is a replacement for the old stress utility. Signed-off-by: Rosen Penev --- utils/stress-ng/Makefile | 44 ++++++++++++ utils/stress-ng/patches/010-soft-float.patch | 70 ++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 utils/stress-ng/Makefile create mode 100644 utils/stress-ng/patches/010-soft-float.patch diff --git a/utils/stress-ng/Makefile b/utils/stress-ng/Makefile new file mode 100644 index 000000000..593ebd848 --- /dev/null +++ b/utils/stress-ng/Makefile @@ -0,0 +1,44 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=stress-ng +PKG_VERSION:=0.11.18 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=https://kernel.ubuntu.com/~cking/tarballs/stress-ng +PKG_HASH:=07c82a5c89538b5b696a79192faa70d0232352004c9e532946f7f3613d0adf23 + +PKG_MAINTAINER:=Alexandru Ardelean +PKG_LICENSE:=GPL-2.0-only +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/stress-ng + SECTION:=utils + CATEGORY:=Utilities + TITLE:=stress-ng is a stress test utility + URL:=https://kernel.ubuntu.com/~cking/stress-ng/ + DEPENDS:=+zlib +endef + +define Package/stress-ng/description +stress-ng will stress test a computer system in various selectable ways. It +was designed to exercise various physical subsystems of a computer as well as +the various operating system kernel interfaces. +endef + +define Package/stress-ng/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/stress-ng $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,stress-ng)) diff --git a/utils/stress-ng/patches/010-soft-float.patch b/utils/stress-ng/patches/010-soft-float.patch new file mode 100644 index 000000000..ef8a95aad --- /dev/null +++ b/utils/stress-ng/patches/010-soft-float.patch @@ -0,0 +1,70 @@ +--- a/stress-fp-error.c ++++ b/stress-fp-error.c +@@ -109,42 +109,43 @@ static int stress_fp_error(const stress_args_t *args) + do { + volatile double d1, d2; + +-#if defined(EDOM) ++#if defined(EDOM) && defined(FE_INVALID) + stress_fp_clear_error(); + stress_fp_check(args, "log(-1.0)", log(-1.0), NAN, + true, false, EDOM, FE_INVALID); + #endif + +-#if defined(ERANGE) ++#if defined(ERANGE) && defined(FE_DIVBYZERO) + stress_fp_clear_error(); + stress_fp_check(args, "log(0.0)", log(0.0), -HUGE_VAL, + false, false, ERANGE, FE_DIVBYZERO); + #endif + +-#if defined(EDOM) ++#if defined(EDOM) && defined(FE_INVALID) + stress_fp_clear_error(); + stress_fp_check(args, "log2(-1.0)", log2(-1.0), NAN, + true, false, EDOM, FE_INVALID); + #endif + +-#if defined(ERANGE) ++#if defined(ERANGE) && defined(FE_DIVBYZERO) + stress_fp_clear_error(); + stress_fp_check(args, "log2(0.0)", log2(0.0), -HUGE_VAL, + false, false, ERANGE, FE_DIVBYZERO); + #endif + +-#if defined(EDOM) ++#if defined(EDOM) && defined(FE_INVALID) + stress_fp_clear_error(); + stress_fp_check(args, "sqrt(-1.0)", sqrt(-1.0), NAN, + true, false, EDOM, FE_INVALID); + #endif + +-#if defined(EDOM) ++#if defined(EDOM) && defined(FE_INVALID) + stress_fp_clear_error(); + stress_fp_check(args, "sqrt(-1.0)", sqrt(-1.0), NAN, + true, false, EDOM, FE_INVALID); + #endif + ++#if defined(FE_INEXACT) + /* + * Use volatiles to force compiler to generate code + * to perform run time computation of 1.0 / M_PI +@@ -165,14 +166,15 @@ static int stress_fp_error(const stress_args_t *args) + stress_fp_check(args, "DBL_MAX + DBL_MAX / 2.0", + DBL_MAX + DBL_MAX / 2.0, INFINITY, + false, true, 0, FE_OVERFLOW | FE_INEXACT); ++#endif + +-#if defined(ERANGE) ++#if defined(ERANGE) && defined(FE_UNDERFLOW) + stress_fp_clear_error(); + stress_fp_check(args, "exp(-1000000.0)", exp(-1000000.0), 0.0, + false, false, ERANGE, FE_UNDERFLOW); + #endif + +-#if defined(ERANGE) ++#if defined(ERANGE) && defined(FE_OVERFLOW) + stress_fp_clear_error(); + stress_fp_check(args, "exp(DBL_MAX)", exp(DBL_MAX), HUGE_VAL, + false, false, ERANGE, FE_OVERFLOW);