4 if test "$VERBOSE" = yes; then
12 skip_if_mcstransd_is_running_
14 mkdir -p d/sub/s2 || framework_failure
15 touch f g d/sub/1 d/sub/2 || framework_failure
19 # Set to a specified context.
20 # Use root:object_r:tmp_t:s0. It is special in that
21 # it works even when mcstransd isn't running.
26 ctx=$u1:$r1:$t1:$range
27 chcon $ctx f || fail=1
28 stat --printf='f|%C\n' f > out || fail=1
31 chcon --ref=f g || fail=1
32 stat --printf='g|%C\n' g >> out || fail=1
34 # Change the individual parts of the context, one by one.
38 for i in --user=$u2 --role=$r2 --type=$t2 --range=$range; do
40 stat --printf="f|$i|"'%C\n' f >> out || fail=1
43 # Same, but change back using the short-named options.
44 for i in -u$u1 -r$r1 -t$t1; do
46 stat --printf="f|$i|"'%C\n' f >> out || fail=1
49 cat <<EOF > exp || fail=1
52 f|--user=$u2|$u2:$r1:$t1:$range
53 f|--role=$r2|$u2:$r2:$t1:$range
54 f|--type=$t2|$u2:$r2:$t2:$range
55 f|--range=$range|$u2:$r2:$t2:$range
56 f|-uroot|root:object_r:file_t:$range
57 f|-robject_r|root:object_r:file_t:$range
58 f|-ttmp_t|root:object_r:tmp_t:$range
61 compare out exp || fail=1
63 (exit $fail); exit $fail