from shell_doctest import test test( """\ % {make} --no-print-directory clean all ... % ./seeking File contents (26 bytes): abcdefghijklmnopqrstuvwxyz current_position: 0 Setting position in the middle of the file current_position: 10 Writing 11 symbols current_position: 37 File contents (37 bytes): abcdefghijklmnopqrstuvwxyzhello there current_position: 37 """ )
from shell_doctest import tests, test test("""\ % {make} --no-print-directory clean all ... % ./wait1 normal termination, exit status = 7 abnormal termination, signal number = 6... abnormal termination, signal number = 8... """, exclude=('DragonFly',))
from shell_doctest import test test("""\ % {make} --no-print-directory clean all ... % ./seeking File contents (26 bytes): abcdefghijklmnopqrstuvwxyz current_position: 0 Setting position in the middle of the file current_position: 10 Writing 11 symbols current_position: 37 File contents (37 bytes): abcdefghijklmnopqrstuvwxyzhello there current_position: 37 """)
from shell_doctest import test test( """\ % {make} --no-print-directory clean all ... % ./filetype ../* ../4.3: regular ../4.7: regular ... ../broken: stat error: No such file or directory ../dir3: directory ../ex01-filetype: directory ../ex04-umask: directory ../ex06-holes: directory ../ex09: directory ../ex11-ftw: directory ../ex16-deep-tree: directory ... ../readdir: directory ../root: directory """, debug=False, )
from shell_doctest import tests, test # Rebuild. test("""\ % {make} --no-print-directory clean all ... """) ## # Setuid under root should set all three uids. test("""\ % sudo ./check_setuid 1 Real user ID: 0 (root) Effective user ID: 0 (root) Saved user ID: 0 (root) Calling setuid(1) Real user ID: 1 (daemon) Effective user ID: 1 (daemon) Saved user ID: 1 (daemon) """) ## # Setuid on sunos and linux tests([ # Make file setuid daemon """\
from shell_doctest import tests, test # Rebuild. test("""\ % {make} --no-print-directory clean all ... """) ## # Setuid under root should set all three uids. test("""\ % sudo ./check_setuid 1 Real user ID: 0 (root) Effective user ID: 0 (root) Saved user ID: 0 (root) Calling setuid(1) Real user ID: 1 (daemon) Effective user ID: 1 (daemon) Saved user ID: 1 (daemon) """) ## # Setuid on sunos and linux tests( [ # Make file setuid daemon """\ % sudo chown daemon check_setuid % sudo chmod u+s check_setuid
from shell_doctest import tests, test test( """\ % {make} --no-print-directory clean all ... % ./zombie child pid: ... Child status (first letter should be `Z'): Z... """, # `ps' seems to be broken on DragonFly, ps -p doesn't select zombie processes. # On FreeBSD it semi-broken -- it selects zombie processes if you pass `-a' # flag. exclude=('DragonFly', ))
from shell_doctest import tests, test test("""\ % {make} --no-print-directory clean all ... % ./opendir-close-on-exec opendir("/"): FD_CLOEXEC is set open("/"): FD_CLOEXEC is not set """)
from shell_doctest import tests, test test("""\ % {make} --no-print-directory clean all ... % ./fd-passing Parent: got fd: ..., seek: 0 Parent: seek after child changed it: 10 (should be 10) Parent: seek after child changed it second time: 20 (should be 20) """)
% ./check-holes file.nohole """, # make-file-with-holes should create file with correct number & size of holes. """\ % ./make-file-with-holes file.hole % ./check-holes file.hole Hole from 0 to 131072 Hole from 262144 to 393216 """, # Check that ./copy-holes preserve holes. """\ % ./copy-holes file.hole file.hole.copy % ./check-holes file.hole.copy Hole from 0 to 131072 Hole from 262144 to 393216 % rm file.hole.copy """ ], exclude=('DragonFly', ) # At least when using HAMMER fs. ) test( # Check that cp doesn't preserve holes. """\ % cp file.hole file.hole.cp_copy % ./check-holes file.hole.cp_copy % rm file.hole.cp_copy """, exclude=('Linux', 'DragonFly') # cp on linux actually does. )
from shell_doctest import test test("""\ % {make} --no-print-directory clean all ... % ./putenv_r HELLO=world """)
from shell_doctest import test test( """\ % rm -f foo bar % {make} --no-print-directory clean all ... % ./mydup2 mydup2.c | sed 's/\x1b\[[0-9;]*m//g' # sed is for stripping colors. >> Checking fd#3 current_position: 1651 FD_CLOEXEC: 0 File status: O_RDONLY ... >> Checking fd#42 current_position: 1651 FD_CLOEXEC: 0 File status: O_RDONLY ... """, debug=False, )
from shell_doctest import test test( """\ % rm -f foo bar % {make} --no-print-directory clean all ... % ./test-umask % ls -l foo bar -rw------- 1 tn ... bar -rw-rw-rw- 1 tn ... foo """, debug=False, )
from shell_doctest import test test("""\ % {make} --no-print-directory clean all ... % ./pr02-17 open_max: ... """)
% {make} --no-print-directory clean all ... % ./check-holes file.nohole """, # make-file-with-holes should create file with correct number & size of holes. """\ % ./make-file-with-holes file.hole % ./check-holes file.hole Hole from 0 to 131072 Hole from 262144 to 393216 """, # Check that ./copy-holes preserve holes. """\ % ./copy-holes file.hole file.hole.copy % ./check-holes file.hole.copy Hole from 0 to 131072 Hole from 262144 to 393216 % rm file.hole.copy """ ], exclude=('DragonFly',) # At least when using HAMMER fs. ) test( # Check that cp doesn't preserve holes. """\ % cp file.hole file.hole.cp_copy % ./check-holes file.hole.cp_copy % rm file.hole.cp_copy """, exclude=('Linux', 'DragonFly') # cp on linux actually does. )
from shell_doctest import test test( """\ % {make} --no-print-directory clean all ... % ./putenv_r HELLO=world """ )
from shell_doctest import tests, test test( """\ % {make} --no-print-directory clean all ... % rm -f output.ftw output.apue-ftw % touch output.ftw output.apue-ftw % sudo ./ftw /usr >| output.ftw % sudo ./apue-ftw /usr >| output.apue-ftw % # Sometimes outputs differ the first time the test run. % diff output.ftw output.apue-ftw % rm output.ftw output.apue-ftw """ )
from shell_doctest import test test( """\ % {make} --no-print-directory clean all ... % ./pr02-17 open_max: ... """ )
from shell_doctest import tests, test test("""\ % {make} --no-print-directory clean all ... % ./zombie child pid: ... Child status (first letter should be `Z'): Z... """, # `ps' seems to be broken on DragonFly, ps -p doesn't select zombie processes. # On FreeBSD it semi-broken -- it selects zombie processes if you pass `-a' # flag. exclude=('DragonFly',))
from shell_doctest import tests, test test( """\ % {make} --no-print-directory clean all ... % ./fd-passing Parent: got fd: ..., seek: 0 Parent: seek after child changed it: 10 (should be 10) Parent: seek after child changed it second time: 20 (should be 20) """ )
from shell_doctest import test test("""\ % {make} --no-print-directory clean all ... % sudo ./print_enc_pass root $... ... tn $... ... password entries read """)
from shell_doctest import test test( """\ % {make} --no-print-directory clean all ... % sudo ./print_enc_pass root $... ... tn $... ... password entries read """ )