automated: linux: modules: add SKIPLIST

Make it possible to skip problematic modules that is known to fail.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
diff --git a/automated/linux/modules/modules.sh b/automated/linux/modules/modules.sh
index 2c8dbb0..b6e5e81 100755
--- a/automated/linux/modules/modules.sh
+++ b/automated/linux/modules/modules.sh
@@ -11,6 +11,7 @@
 MODULES_LIST=""
 MODULES_SUBDIRS=""
 MODULE_MODPROBE_NUMBER="1"
+SKIPLIST=""
 SHARD_NUMBER=1
 SHARD_INDEX=1
 
@@ -20,17 +21,19 @@
 		[-c <Number of load/unload of a module> ]
 		[-i <sharding bucket to run> ]
 		[-n <number of shard buckets to create> ]
+		[-s <skiplist modules to skip> ]
 		[-h ]" 1>&2
 	exit 0
 }
 
-while getopts "c:d:i:l:n:h" o; do
+while getopts "c:d:i:l:n:s:h" o; do
 	case "$o" in
 		d) MODULES_SUBDIRS="${OPTARG}" ;;
 		l) MODULES_LIST="${OPTARG}" ;;
 		c) MODULE_MODPROBE_NUMBER="${OPTARG}" ;;
 		i) SHARD_INDEX="${OPTARG}" ;;
 		n) SHARD_NUMBER="${OPTARG}" ;;
+		s) SKIPLIST="${OPTARG}" ;;
 		h|*) usage ;;
 	esac
 done
@@ -38,8 +41,10 @@
 get_modules_list() {
 	if [ -z "${MODULES_LIST}" ]; then
 		subdir=$(echo "${MODULES_SUBDIRS}" | tr ' ' '|')
+		skiplist=$(echo "${SKIPLIST}" | tr ' ' '|')
 		grep -E "kernel/(${subdir})" /lib/modules/"$(uname -r)"/modules.order | tee /tmp/find_modules.txt
-		split --verbose --numeric-suffixes=1 -n l/"${SHARD_INDEX}"/"${SHARD_NUMBER}" /tmp/find_modules.txt > /tmp/shardfile
+		grep -E -v "(${skiplist})" /tmp/find_modules.txt | tee /tmp/modules_to_run.txt
+		split --verbose --numeric-suffixes=1 -n l/"${SHARD_INDEX}"/"${SHARD_NUMBER}" /tmp/modules_to_run.txt > /tmp/shardfile
 		echo "============== Tests to run ==============="
 		cat /tmp/shardfile
 		echo "===========End Tests to run ==============="
diff --git a/automated/linux/modules/modules.yaml b/automated/linux/modules/modules.yaml
index 5464926..44f3e00 100644
--- a/automated/linux/modules/modules.yaml
+++ b/automated/linux/modules/modules.yaml
@@ -16,6 +16,10 @@
         - x86
 
 params:
+    # If SKIPLIST is specified with a list of space separated modules then
+    # they will be filtered out and not loaded.
+    SKIPLIST: ""
+
     # If MODULES_LIST is specified with a list of space separated modules then
     # MOUDLES_SUBDIRS wont have any affect.
     MODULES_LIST: ""
@@ -36,5 +40,5 @@
 run:
     steps:
         - cd ./automated/linux/modules/
-        - ./modules.sh -d "${MODULES_SUBDIRS}" -l "${MODULES_LIST}" -c "${MODULE_MODPROBE_NUMBER}" -n "${SHARD_NUMBER}" -i "${SHARD_INDEX}"
+        - ./modules.sh -d "${MODULES_SUBDIRS}" -l "${MODULES_LIST}" -c "${MODULE_MODPROBE_NUMBER}" -n "${SHARD_NUMBER}" -i "${SHARD_INDEX}" -s "${SKIPLIST}"
         - ../../utils/send-to-lava.sh ./output/result.txt