stress-ng: add

This is a replacement for the old stress utility.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2020-08-12 18:45:55 -07:00
parent bd89bd24f3
commit fba6bb9489
No known key found for this signature in database
GPG Key ID: 36D31CFA845F0E3B
2 changed files with 114 additions and 0 deletions

44
utils/stress-ng/Makefile Normal file
View File

@ -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 <ardeleanalex@gmail.com>
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))

View File

@ -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);