Skip to content

Commit

Permalink
Revamp caam_hwrng_test by looping w/ smaller size (#60)
Browse files Browse the repository at this point in the history
Some of the project devices' caam_hwrng have buffer, so previously the
dd size is increased to 10M to exceed the buffer size to make the
interrupt increase. It will make the device without buffer take
a very long time (over 30 mins) to do the dd command.

Therefore, this commit separated the size to 512K and looped it 20 times.
On the device without buffer it could do 512K and detect the increased
interrupt to get the pass result, which is much faster.
On the device with buttfer it could also exceed the buffer by dd 20
times and detect the increased interrupt to get the pass result.
  • Loading branch information
patliuu committed Oct 24, 2023
1 parent 40954bb commit 901eaed
Showing 1 changed file with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,20 @@ command:
fi
echo "CAAM Job ring interrupt before using Hardware RNG: $init_interrupt"
echo "Starting DD of /dev/hwrng ..."
dd if=/dev/hwrng bs=1M count=10 > /dev/null
echo "Finished DD ..."
interrupt=$(awk '/\.jr/ {printf "%s ",$2;next;}' /proc/interrupts|sed 's/ //g')
echo "CAAM Job ring interrupt after using Hardware RNG: $interrupt"
if [ "$interrupt" -gt "$init_interrupt" ];
then
echo "PASS: CAAM job ring interrupts have increased."
exit 0
else
echo "FAIL: CAAM job ring interrupts didn't increase!"
exit 1
fi
for i in {1..20}
do
dd if=/dev/hwrng bs=512K count=1 > /dev/null
echo "Finished $i/20 times DD ..."
interrupt=$(awk '/\.jr/ {printf "%s ",$2;next;}' /proc/interrupts|sed 's/ //g')
echo "Current job ring interrupt: $interrupt"
if [ "$interrupt" -gt "$init_interrupt" ];
then
echo "PASS: CAAM job ring interrupts have increased."
exit 0
fi
done
echo "FAIL: CAAM job ring interrupts didn't increase!"
exit 1

id: ce-oem-crypto/caam/algo_check
_summary: Check CAAM algorithm is in the system /proc/crypto
Expand Down

0 comments on commit 901eaed

Please sign in to comment.