History

ktest: When creating new config, allow the use of ${THIS_DIR}

Typing in a full path when you know that the path exists within the directory your are running is tedious and unnecessary. Allow the user to use ${PWD} if they want a dynamic path name which will be the path that ktest.pl is executed from or use ${THIS_DIR} which is a variable assigned `pwd` and the the variable will exist within the config, allowing the user to change it and affect all other paths using this variable as well

Steven Rostedt committed 14 years ago

Commit 0e7a22d1 parent 600bbf01 file · +17 −2Browse files

Unified · Split

tools/testing/ktest/ktest.pl+17−2
@@ -158,11 +158,15 @@ EOF · 157 unmodified lines
158158 ;
159159 $config_help{"BUILD_DIR"} = << "EOF"
160160 The directory that contains the Linux source code (full path).
161+ You can use \${PWD} that will be the path where ktest.pl is run, or use
162+ \${THIS_DIR} which is assigned \${PWD} but may be changed later.
161163 EOF
162164 ;
163165 $config_help{"OUTPUT_DIR"} = << "EOF"
164166 The directory that the objects will be built (full path).
165167 (can not be same as BUILD_DIR)
168+ You can use \${PWD} that will be the path where ktest.pl is run, or use
169+ \${THIS_DIR} which is assigned \${PWD} but may be changed later.
166170 EOF
167171 ;
168172 $config_help{"BUILD_TARGET"} = << "EOF"
@@ -282,7 +286,7 @@ sub get_ktest_config { · 113 unmodified lines
282286 next;
283287 }
284288 }
285− $entered_configs{$config} = process_variables($ans);
289+ $entered_configs{$config} = ${ans};
286290 last;
287291 }
288292 }
@@ -3012,6 +3016,17 @@ if (! -f $ktest_config) { · 2723 unmodified lines
30123016 print OUT << "EOF"
30133017 # Generated by ktest.pl
30143018 #
3019+
3020+# PWD is a ktest.pl variable that will result in the process working
3021+# directory that ktest.pl is executed in.
3022+
3023+# THIS_DIR is automatically assigned the PWD of the path that generated
3024+# the config file. It is best to use this variable when assigning other
3025+# directory paths within this directory. This allows you to easily
3026+# move the test cases to other locations or to other machines.
3027+#
3028+THIS_DIR := $variable{"PWD"}
3029+
30153030 # Define each test with TEST_START
30163031 # The config options below it will override the defaults
30173032 TEST_START
@@ -3034,7 +3049,7 @@ if ($#new_configs >= 0) { · 16 unmodified lines
30343049 open(OUT, ">>$ktest_config") or die "Can not append to $ktest_config";
30353050 foreach my $config (@new_configs) {
30363051 print OUT "$config = $entered_configs{$config}\n";
3037− $opt{$config} = $entered_configs{$config};
3052+ $opt{$config} = process_variables($entered_configs{$config});
30383053 }
30393054 }
30403055