From ce7f9e19cd06b5434962a87b6222d96002f532b7 Mon Sep 17 00:00:00 2001 From: Scott Poore Date: Thu, 12 Jun 2025 11:26:59 -0500 Subject: [PATCH] performance test support glibc preload test The glibc preload tests sets up an ld.so.preload to emulate a loaded system. This directly affects the runtime of the jq performance test. This is a test change to check speed of the system first with pigz and adjust expected jq speed test threshold. It should be noted that to perform the system check before the jq check, we need to test with something that uses threads. This is why pigz was chosen over traditional gzip. Updates to test code by: thalman@redhat.com Resolves: RHEL-93792 (cherry picked from commit b643aa52e03c33479cd29bb62e79b7776088954b) --- tests/performance/jqspeed.sh | 25 ++++++++++++++++++------- tests/performance/main.fmf | 2 ++ tests/tests.yml | 2 ++ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/tests/performance/jqspeed.sh b/tests/performance/jqspeed.sh index 9840c2d..30b68b8 100755 --- a/tests/performance/jqspeed.sh +++ b/tests/performance/jqspeed.sh @@ -2,19 +2,30 @@ export LC_ALL=C -stress_jq() { - `which time` -p -f '%e\n' bash -c 'for i in `seq 1 1000` ; do echo '"'"'{"foo":"bar"}'"'"' | jq '"'"'has("bar")'"'"' > /dev/null ; done' 2>&1 | cut -d. -f1 +measure_env_speed () { + `which time` -p -f '%e\n' bash -c 'for a in `seq 1 1000`; do (for b in `seq 500`; do echo $b; done) | pigz > /dev/null; done' 2>&1 +} + +stress_jq() { + `which time` -p -f '%e\n' bash -c 'for i in `seq 1 1000` ; do echo '"'"'{"foo":"bar"}'"'"' | jq '"'"'has("bar")'"'"' > /dev/null ; done' 2>&1 } -FAIL=0 -TIME=`stress_jq` echo -n "Test jqspeed ... " -if [ $TIME -gt 8 ] ; then +SPEED=`measure_env_speed` +TIMEOUT=`echo 3.0 '*' $SPEED | bc` +TIME=`stress_jq` +FAIL=`echo $TIME '>' $TIMEOUT | bc` + +if [ "$FAIL" = "1" ] ; then echo "failed" - FAIL=1 else echo "ok" fi -echo "Runtime: ${TIME}s " + +echo "Speed: ${SPEED}s" +echo "Runtime: ${TIME}s" +echo "Timeout: ${TIMEOUT}s" + exit $FAIL + diff --git a/tests/performance/main.fmf b/tests/performance/main.fmf index b1a8e27..bbc5023 100644 --- a/tests/performance/main.fmf +++ b/tests/performance/main.fmf @@ -3,4 +3,6 @@ require: - jq - which - time + - pigz + - bc test: ./jqspeed.sh diff --git a/tests/tests.yml b/tests/tests.yml index f2f5ccc..1e88054 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -15,6 +15,8 @@ - jq-devel - valgrind - rubygem-rake + - pigz + - bc tests: - upstream: dir: upstream