summaryrefslogtreecommitdiffstats
path: root/src/util/profile/prof_test1
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2010-08-24 21:52:32 +0000
committerGreg Hudson <ghudson@mit.edu>2010-08-24 21:52:32 +0000
commitc187732f09e477d9a611ad18bfa1739befb86074 (patch)
tree297982ef42c8a291f686a5bbe380b3ee2603ab2e /src/util/profile/prof_test1
parent63a020538575070aeb66faf948467b877139384e (diff)
downloadkrb5-c187732f09e477d9a611ad18bfa1739befb86074.tar.gz
krb5-c187732f09e477d9a611ad18bfa1739befb86074.tar.xz
krb5-c187732f09e477d9a611ad18bfa1739befb86074.zip
add profile include support
Add support for "include" and "includedir" directives in profile files. See http://k5wiki.kerberos.org/wiki/Projects/Profile_Includes for more details. ticket: 6761 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24253 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util/profile/prof_test1')
-rw-r--r--src/util/profile/prof_test157
1 files changed, 57 insertions, 0 deletions
diff --git a/src/util/profile/prof_test1 b/src/util/profile/prof_test1
index bd4901272d..dc0867123d 100644
--- a/src/util/profile/prof_test1
+++ b/src/util/profile/prof_test1
@@ -147,8 +147,65 @@ proc test3 {} {
puts "OK: test3: Clearing relation and adding one entry yields correct count."
}
+# Exercise the include and includedir directives.
+proc test4 {} {
+ global wd verbose
+
+ # Test expected error message when including nonexistent file.
+ catch [file delete $wd/testinc.ini]
+ exec echo "include does-not-exist" >$wd/testinc.ini
+ catch { profile_init_path $wd/testinc.ini } err
+ if $verbose { puts "Got error message $err" }
+ if { $err ne "Included profile file could not be read" } {
+ puts stderr "Error: test4: Did not get expected error when including nonexistent file."
+ exit 1
+ }
+
+ # Test expected error message when including nonexistent directory.
+ catch [file delete $wd/testinc.ini]
+ exec echo "includedir does-not-exist" >$wd/testinc.ini
+ catch { profile_init_path $wd/testinc.ini } err
+ if $verbose { puts "Got error message $err" }
+ if { $err ne "Included profile directory could not be read" } {
+ puts stderr "Error: test4: Did not get expected error when including nonexistent directory."
+ exit 1
+ }
+
+ # Test including a file.
+ catch [file delete $wd/testinc.ini]
+ exec echo "include $wd/test2.ini" >$wd/testinc.ini
+ set p [profile_init_path $wd/testinc.ini]
+ set x [profile_get_values $p {{test section 1} bar}]
+ if $verbose { puts "Read $x from included profile" }
+ if { [lindex $x 0] ne "foo" } {
+ puts stderr "Error: test4: Did not get expected result from included profile."
+ exit 1
+ }
+ profile_release $p
+
+ # Test including a directory. (Put two copies of test2.ini inside
+ # it and check that we get two values for one of the variables.)
+ catch [file delete -force $wd/test_include_dir]
+ exec mkdir $wd/test_include_dir
+ exec cp $wd/test2.ini $wd/test_include_dir/a
+ exec cp $wd/test2.ini $wd/test_include_dir/b
+ catch [file delete $wd/testinc.ini]
+ exec echo "includedir $wd/test_include_dir" >$wd/testinc.ini
+ set p [profile_init_path $wd/testinc.ini]
+ set x [profile_get_values $p {{test section 1} bar}]
+ if $verbose { puts "Read $x from included directory" }
+ if { $x ne "foo foo" } {
+ puts stderr, "Error: test4: Did not get expected result from included directory."
+ exit 1
+ }
+ profile_release $p
+
+ puts "OK: test4: include and includedir directives"
+}
+
test1
test2
test3
+test4
exit 0