diff --git a/meta/recipes-support/gnutls/gnutls/run-ptest b/meta/recipes-support/gnutls/gnutls/run-ptest
index 1d6999669a..34cb6cc12c 100644
--- a/meta/recipes-support/gnutls/gnutls/run-ptest
+++ b/meta/recipes-support/gnutls/gnutls/run-ptest
@@ -25,9 +25,16 @@ rjob() {
 }
 
 is_disallowed() {
-    local key=$1
-    $(echo ${test_disallowlist} | grep -w -q ${key})
-    return $?
+    # grep -w treats '-' as a word boundary, so tests whose names also appear in
+    # others e.g. "mini-dtls-hello-verify" in "mini-dtls-hello-verify-48" are
+    # unintentionally skipped as well. Make it more precise by checking if
+    # test_disallowlist is in '<anything> <test_case> <anything>' for each test
+    # case, which should also be faster than running grep or another process
+    # each time.
+    case " ${test_disallowlist} " in
+    *" $1 "*) return 0 ;;
+    esac
+    return 1
 }
 
 # TODO
