[PATCH 2/2] selftests: lib: prime_numbers: update presence check

From: Sumit Semwal
Date: Mon Jun 19 2017 - 09:44:52 EST


The test for prime numbers doesn't differentiate between missing
prime_numbers.ko and failure in prime_numbers.ko.

Update it to check for presence of the file itself to skip, therefore
correctly exercising the test failure case.

Signed-off-by: Sumit Semwal <sumit.semwal@xxxxxxxxxx>
---
tools/testing/selftests/lib/prime_numbers.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/lib/prime_numbers.sh b/tools/testing/selftests/lib/prime_numbers.sh
index da4cbcd766f5..492f0dcdf088 100755
--- a/tools/testing/selftests/lib/prime_numbers.sh
+++ b/tools/testing/selftests/lib/prime_numbers.sh
@@ -1,8 +1,9 @@
#!/bin/sh
# Checks fast/slow prime_number generation for inconsistencies

-if ! /sbin/modprobe -q -r prime_numbers; then
- echo "prime_numbers: [SKIP]"
+if ! find /lib/modules/$(uname -r) -type f -name prime_numbers.ko | grep -q .;
+then
+ echo "prime_numbers: prime_numbers.ko not found: [SKIP]"
exit 77
fi

--
2.7.4