Skip to content

Commit 68beeb9

Browse files
committed
Add helper functions
Add the helper function to check kernel optional config Signed-off-by: Vamsee Narapareddi <vnarapar@qti.qualcomm.com>
1 parent d37dcc2 commit 68beeb9

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

Runner/utils/functestlib.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,30 @@ check_kernel_config() {
222222
return 0
223223
}
224224

225+
# Check each given kernel config is set to y/m in /proc/config.gz, logs result, returns 0/1.
226+
check_optional_config() {
227+
cfgs=$1
228+
for config_key in $cfgs; do
229+
if command -v zgrep >/dev/null 2>&1; then
230+
if zgrep -qE "^${config_key}=(y|m)" /proc/config.gz 2>/dev/null; then
231+
log_pass "Kernel config $config_key is enabled"
232+
else
233+
log_warn "Kernel config $config_key is missing or not enabled"
234+
return 1
235+
fi
236+
else
237+
# Fallback if zgrep is unavailable
238+
if gzip -dc /proc/config.gz 2>/dev/null | grep -qE "^${config_key}=(y|m)"; then
239+
log_pass "Kernel config $config_key is enabled"
240+
else
241+
log_warn "Kernel config $config_key is missing or not enabled"
242+
return 1
243+
fi
244+
fi
245+
done
246+
return 0
247+
}
248+
225249
check_dt_nodes() {
226250
node_paths="$1"
227251
log_info "$node_paths"

0 commit comments

Comments
 (0)