xref: /OK3568_Linux_fs/kernel/tools/testing/selftests/locking/ww_mutex.sh (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun#!/bin/sh
2*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun# Kselftest framework requirement - SKIP code is 4.
5*4882a593Smuzhiyunksft_skip=4
6*4882a593Smuzhiyun
7*4882a593Smuzhiyun# Runs API tests for struct ww_mutex (Wait/Wound mutexes)
8*4882a593Smuzhiyunif ! /sbin/modprobe -q -n test-ww_mutex; then
9*4882a593Smuzhiyun	echo "ww_mutex: module test-ww_mutex is not found [SKIP]"
10*4882a593Smuzhiyun	exit $ksft_skip
11*4882a593Smuzhiyunfi
12*4882a593Smuzhiyun
13*4882a593Smuzhiyunif /sbin/modprobe -q test-ww_mutex; then
14*4882a593Smuzhiyun       /sbin/modprobe -q -r test-ww_mutex
15*4882a593Smuzhiyun       echo "locking/ww_mutex: ok"
16*4882a593Smuzhiyunelse
17*4882a593Smuzhiyun       echo "locking/ww_mutex: [FAIL]"
18*4882a593Smuzhiyun       exit 1
19*4882a593Smuzhiyunfi
20