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
This commit is contained in:
Scott Poore 2025-06-12 11:26:59 -05:00
parent 0c1f0a9717
commit b643aa52e0
3 changed files with 22 additions and 7 deletions

View File

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

View File

@ -3,4 +3,6 @@ require:
- jq
- which
- time
- pigz
- bc
test: ./jqspeed.sh

View File

@ -15,6 +15,8 @@
- jq-devel
- valgrind
- rubygem-rake
- pigz
- bc
tests:
- upstream:
dir: upstream