diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 1737c59e4ff67..ac59999ed3ded 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -802,7 +802,14 @@ sub process_variables { my $end = $3; # append beginning of value to retval $retval = "$retval$begin"; - if (defined($variable{$var})) { + if ($var =~ s/^shell\s+//) { + $retval = `$var`; + if ($?) { + doprint "WARNING: $var returned an error\n"; + } else { + chomp $retval; + } + } elsif (defined($variable{$var})) { $retval = "$retval$variable{$var}"; } elsif (defined($remove_undef) && $remove_undef) { # for if statements, any variable that is not defined, diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf index 5e7d1d7297529..2d0fe15a096dd 100644 --- a/tools/testing/ktest/sample.conf +++ b/tools/testing/ktest/sample.conf @@ -259,6 +259,14 @@ # If PATH is not a config variable, then the ${PATH} in # the MAKE_CMD option will be evaluated by the shell when # the MAKE_CMD option is passed into shell processing. +# +# Shell commands can also be inserted with the ${shell } +# expression. Note, this is case sensitive, thus ${SHELL } +# will not work. +# +# HOSTNAME := ${shell hostname} +# DEFAULTS IF "${HOSTNAME}" == "frodo" +# #### Using options in other options #### #