Fix some uncleanness with testsmbc.c
[Samba/gebeck_regimport.git] / testsuite / smbd / sec_ctx.exp
blob0831400e702710881f62e784342b82e00dd7a006
2 # @(#) Test the push_sec_ctx() and pop_sec_ctx() functions
6 # Unix SMB/Netbios implementation.
7 # Copyright (C) Tim Potter 2000
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 load_lib "compile.exp"
25 load_lib "util-defs.exp"
27 # Non-root test
29 set test_desc "change sec_ctx as non-root"
30 set test_prog "sec_ctx_nonroot"
31 simple_make "sec_ctx" $test_prog
32 set output [util_start "$srcdir/$subdir/$test_prog"]
34 if { [regexp "child killed" $output] } {
35 pass $test_desc
36 file delete "$srcdir/$subdir/$test_prog" "$srcdir/$subdir/$test_prog.o"
37 } else {
38 fail $test_desc
41 # Run tests from C files as root
43 set sec_ctx_tests [list \
44 { "security contexts are stackable" "sec_ctx_stack" } \
45 { "over/underflow tests" "sec_ctx_flow" } \
46 { "torture test" "sec_ctx_torture" } \
47 { "current_user global" "sec_ctx_current_user" } \
48 { "group membership" "sec_ctx_groups" } \
49 { "become root" "sec_ctx_root" } \
52 foreach { test } $sec_ctx_tests {
53 set test_desc [lindex $test 0]
54 set test_file [lindex $test 1]
56 simple_make "sec_ctx" $test_file
57 set output [util_start "sudo $srcdir/$subdir/$test_file" ]
59 if { [regexp "PASS" $output] } {
60 pass $test_desc
61 file delete "$srcdir/$subdir/$test_file" "$srcdir/$subdir/$test_file.o"
62 } else {
63 fail $test_desc
64 puts $output