automated: linux: modules: fix get_modules_list fallback logic

Fix get_modules_list to properly handle the case where both
MODULES_LIST and MODULES_SUBDIRS are empty.

Previously, an empty MODULES_SUBDIRS resulted in an invalid grep
expression, causing no modules to be selected. With this change,
the script defaults to using all modules listed in modules.order
if no specific list or subdirectory is provided.

Also ensure the skiplist is optional and handled safely.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
diff --git a/automated/linux/modules/modules.sh b/automated/linux/modules/modules.sh
index 2e407fd..1587338 100755
--- a/automated/linux/modules/modules.sh
+++ b/automated/linux/modules/modules.sh
@@ -40,10 +40,21 @@
 
 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
-		grep -E -v "(${skiplist})" /tmp/find_modules.txt | tee /tmp/modules_to_run.txt
+		if [ -n "${MODULES_SUBDIRS}" ]; then
+			subdir=$(echo "${MODULES_SUBDIRS}" | tr ' ' '|')
+			grep -E "kernel/(${subdir})" /lib/modules/"$(uname -r)"/modules.order > /tmp/find_modules.txt
+		else
+			# No subdir given, default to all modules
+			cat /lib/modules/"$(uname -r)"/modules.order > /tmp/find_modules.txt
+		fi
+
+		if [ -n "${SKIPLIST}" ]; then
+			skiplist=$(echo "${SKIPLIST}" | tr ' ' '|')
+			grep -E -v "(${skiplist})" /tmp/find_modules.txt > /tmp/modules_to_run.txt
+		else
+			cp /tmp/find_modules.txt /tmp/modules_to_run.txt
+		fi
+
 		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