diff mbox series

tests: check for hwsim before loading it

Message ID 1590918032-I45d7efbcd1ef202f5b9ce21cff919eeb6ea96094@changeid
State Accepted
Headers show
Series tests: check for hwsim before loading it | expand

Commit Message

Johannes Berg May 31, 2020, 9:40 a.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

Instead of checking if the kernel allows modules (via the
presence of /proc/modules), check if hwsim is already there
and load it only if not. This gets rid of some ugly prints
from modprobe in case code isn't even a module and cannot
be found, etc.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 tests/hwsim/start.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jouni Malinen June 10, 2020, 6:54 p.m. UTC | #1
On Sun, May 31, 2020 at 11:40:32AM +0200, Johannes Berg wrote:
> Instead of checking if the kernel allows modules (via the
> presence of /proc/modules), check if hwsim is already there
> and load it only if not. This gets rid of some ugly prints
> from modprobe in case code isn't even a module and cannot
> be found, etc.

Thanks, applied.
diff mbox series

Patch

diff --git a/tests/hwsim/start.sh b/tests/hwsim/start.sh
index 7a26d28254ef..ac43d10afad8 100755
--- a/tests/hwsim/start.sh
+++ b/tests/hwsim/start.sh
@@ -110,7 +110,7 @@  else
 	NUM_CH=1
 fi
 
-test -f /proc/modules && sudo modprobe mac80211_hwsim radios=7 channels=$NUM_CH support_p2p_device=0 dyndbg=+p
+test -d /sys/module/mac80211_hwsim || sudo modprobe mac80211_hwsim radios=7 channels=$NUM_CH support_p2p_device=0 dyndbg=+p
 
 sudo ifconfig hwsim0 up
 sudo $WLANTEST -i hwsim0 -n $LOGDIR/hwsim0.pcapng -c -dtN -L $LOGDIR/hwsim0 &