************************ THIS IS WORK IN PROGRESS ************************ lsb-sysinit-ts - A test suit for the LSB Init Scripts 1.9.0 Author: Tobias Burnus Comments on this document should be sent to tobias.burnus@physik.fu-berlin.de or to burnus@net-b.de. This version of this specification is for gLSB 1.9.0 Review Instructions --------------------- This test specification is for the init script aspects of the LSB and can be downloaded from URL ftp://ftp.freestandards.org/pub/lsb/test_suites/ ftp://ftp.xopen.org/pub/lsb/test_suites/ as part of the lsb-fhs testset. See also http://www.linuxbase.org/test/ for pointers to the cvs tree Any comments on this document should take the following format, which allows us to collate comments by section. Subject: BUG in LSB-SYSINIT-TS_SPEC @ section , assertion_reference # Problem: Explain why here. Be sure to add sufficient explanation for someone not familiar with the problem to be able to make a decision. Action: Be specific, that is give precise editorial instructions for change. For example @ /foo, X.13-1 Problem: /foo/dp may not exist if the dp extension is not supported. The LSB spec says clearly that the dp extension is optional. Action: Make this a conditional test, replace the existing text with "If the implementation provides the dp extension then the /foo/dp directory exists and is searchable" Document Change History: ------------------------- # This is $Revision$ # # $Log$ For a copy of the LSB specification, see www.linuxbase.org/spec/ This test suite uses the Test Environment Toolkit to download a copy see http://tetworks.opengroup.org Tests should be written only to use portable features of the shell, i.e. POSIX.2 shell and utilities API. Where a test relies on a function of a utility, the TET setup should first verify the functionality prior to running the test set. If the setup function fails , the testset should be marked deleted. Tests are written to follow the POSIX 2003 methodology (for classifying and developing assertions). Test Suite Structure -------------------- The test suite is divided into areas, denoted with the "A." prefix, to denote different sections of the standard. Testset directories have a "T." prefix. TODO: ADD DIRECTORY TREE OF THE TESTS Test Assertions for the system initialization, gLSB 1.9.0 --------------------------------------------------------- Creation of a set of test assertions is a necessary step to bridge the gap between natural language specification and test suite code. The goal of the test suite code is to produce an executable representation of the requirements of the specification under test. The Open Group adopts an assertion based technique for test specifications. This follows the IEEE Standard for Test Methods (1003.3). An assertion is developed for each definitive statement in the specification under test. Each assertion is designed to determine whether the statement is true or false for the implementation under test. Typically, a definitive statement within a specification contains or implies a shall, should or may. A shall statement is an unconditional requirement. A should or may statement is a conditional requirement, based on support of an option. Some judgement needs to be exercised by the assertion writer to ensure that the assertions generated are based upon the requirements of specification, and not in some cases based on non-normative advice to programmers or such like. Note that some of the features in gLSB are optional. If present then a PASS result will be returned, however if not present or another error occurs, a FIP (further information to be provided) result is returned. This is since the test suite is unable to determine automatically whether the subsystem is supported . The FIP results should be signed off in the vrpt output that would be submitted for certification to state that the implementation is conforming. Section 32.1 System Initialization: Cron Jobs tset/cron (tests for Chapter 32.1 Cron Jobs) ---------------------------------- Tests for compliance (Note: the strategy is to test for the existance of the directories) Reference 32.1-1 (FIXME: A or T) The etc/cron.daily directory exists and is executable and writeable by root Result: PASS/FAIL Reference 32.1-2 (FIXME: A or T) The etc/cron.weekly directory exists and is executable and writeable by root Result: PASS/FAIL Reference 32.1-3 (FIXME: A or T) The etc/cron.monthly directory utable and writeable by root Result: PASS/FAIL Reference 32.1-4 (FIXME: A or T) The etc/cron.d directory exists and is executable and writeable by root Result: PASS/FAIL # There is no easy method to test cron.daily, cron.weekly and cron.monthly # cron.d could be tested by dropping and waiting until it gets executed. # Usually the cron daemon checks such a directory every minute (?) # or should something like /etc/init.d/cron force-reload be called? # Should there be a test in the cron.d directory? # # Maybe also cron.daily is useful to make sure that foo.com-bar # is found -- default Debian does ignore files which contain a '.' Section 32.2 System Initialization: Init Script Actions tset/iniscrptact (tests for Chapter 32.2 Init Script Actions) ---------------------------------- No implementation tests possible Section 32.3 System Initialization: Comment conventions for init scripts tset/initscrcomconv (tests for Chapter 32.3 Comment conventions for init scripts) ---------------------------------- This is tested in the next section 32.4 Section 32.4 System Initialization: Installation and removal of init.d files tset/initsrcinstrm (tests for Chapter 32.4 Installation and removal of init.d files) ---------------------------------- Tests for compliance Reference 32.4-1 (FIXME: A or T) The etc/init.d directory exists and is executable and writeable by root Result: PASS/FAIL Reference 32.4-2 (FIXME: A or T) usr/lib/lsb/install_initd exists and is executable Result: PASS/FAIL Reference 32.4-3 (FIXME: A or T) usr/lib/lsb/remove_initd exists and is executable Result: PASS/FAIL Reference 32.4-4 (FIXME: A or T) Calls usr/lib/lsb/install_initd to install a valid init script (script1) which requires $local_fs $remote_fs (The exit code is checked: 0 = PASS) Result: PASS/FAIL Reference 32.4-5 (FIXME: A or T) Do 32.4-4 actions and then call usr/lib/lsb/remove_initd to remove the installed init script (script1) (The exit code is checked: 0 = PASS) Result: PASS/FAIL Reference 32.4-6 (FIXME: A or T) Install a valid init script (script2) which requires all system facilities using usr/lib/lsb/install_initd (The exit code is checked: 0 = PASS) Result: PASS/FIP Reference 32.4-7 (FIXME: A or T) Does 32.4-6 actions and calls then usr/lib/lsb/remove_initd to remove the installed init script (script2) (The exit code is checked: 0 = PASS) Result: PASS/FAIL Reference 32.4-8 (FIXME: A or T) Calls usr/lib/lsb/remove_initd to remove a previously not installed valid init script (script2) (The exit code is checked: 0 = PASS) Result: PASS/FAIL Reference 32.4-9 (FIXME: A or T) Does actions 32.4-4 to 32.4-8 and then checks for existance of the two init scripts (script1 and script2) (They should both still exist) Result: PASS/FAIL Reference 32.4-10 (FIXME: A or T) Installs a valid init script (script3) which requires a not defined system facility calling usr/lib/lsb/install_initd (The exit code is checked: 1 = PASS) Result: PASS/FIP Reference 32.4-11 (FIXME: A or T) Do 32.4-11 and then call usr/lib/lsb/install_initd to remove the init script (script3) which requires a not defined system facility (The exit code is checked: 0 = PASS) Result: PASSED/FAIL Reference 32.4-12 (FIXME: A or T) Installing a valid init script (script4) which requires a not available facility (script1) calling usr/lib/lsb/install_initd (The exit code is checked: 1 = PASS) Result: PASSED/FAIL Reference 32.4-13 (FIXME: A or T) Do 32.4-12 actions and then call usr/lib/lsb/remove_initd to remove the script (script4) (The exit code is checked: 0 = PASS) Result: PASSED/FAIL Reference 32.4-14 (FIXME: A or T) Does 32.4-4 action and then call usr/lib/lsb/install_initd to install a init script (script4) which requires the facility provided in 32.4-14 (script1) (The exit code is checked: 0 = PASS) Result: PASSED/FAIL Reference 32.4-15 (FIXME: A or T) Does 32.4-14 and then removes the init script (script1) which is requires by another init script (script4) using usr/lib/lsb/remove_initd (The exit code is checked: 1 = PASS) Result: PASSED/FAIL Reference 32.4-16 (FIXME: A or T) Does 32.4-14 and then removes init script (script4) which is not required by other init scripts using usr/lib/lsb/remove_initd (The exit code is checked: 0 = PASS) Result: PASSED/FAIL Reference 32.4-17 (FIXME: A or T) Does 32.4-16 and then removes a the init script (script1) which is no longer required by other init scripts using usr/lib/lsb/remove_initd (The exit code is checked: 0 = PASS) Result: PASSED/FAIL Reference 32.4-18 (FIXME: A or T) Does 32.4-4 and then calls usr/lib/lsb/init_initd to install an init script (script5) where should-start/stop requires a non-provided service and a service provided by 32.4-4 steps. (The exit code is checked: 0 = PASS) Result: PASSED/FAIL Reference 32.4-19 (FIXME: A or T) Does 32.4-18 and then calls usr/lib/lsb/init_initd to remove the init script (script5) where should-start/stop requires a non-provided service using usr/lib/lsb/init_initd (The exit code is checked: 0 = PASS) Result: PASSED/FAIL Reference 32.4-19 (FIXME: A or T) Does 32.4-18 and then calls usr/lib/lsb/init_initd to remove the init script (script1) which provides the Should-Start requested facility (The exit code is checked: 0 = PASS) Result: PASSED/FAIL Section 32.8 System Initialization: Init Script Functions tset/initsrcfunctn (tests for Chapter 32.8 Init Script Functions) ---------------------------------- Tests for compliance Reference 32.4-1 (FIXME: A or T) Source /lib/lsb/init-functions in a /bin/sh script and check for errors Result: PASSED/FAIL Reference 32.4-2 (FIXME: A or T) Source /lib/lsb/init-functions in a /bin/sh script and test for start_daemon using type. Result: PASSED/FAIL Reference 32.4-3 (FIXME: A or T) Source /lib/lsb/init-functions in a /bin/sh script and test for killproc using type. Result: PASSED/FAIL Reference 32.4-4 (FIXME: A or T) Source /lib/lsb/init-functions in a /bin/sh script and test for pidofproc using type. Result: PASSED/FAIL Reference 32.4-5 (FIXME: A or T) Source /lib/lsb/init-functions in a /bin/sh script and test for log_success_msg using type. Result: PASSED/FAIL Reference 32.4-6 (FIXME: A or T) Source /lib/lsb/init-functions in a /bin/sh script and test for log_failure_msg using type. Result: PASSED/FAIL Reference 32.4-7 (FIXME: A or T) Source /lib/lsb/init-functions in a /bin/sh script and test for log_warning_msg using type. Result: PASSED/FAIL Reference 32.4-8 (FIXME: A or T) Use start-stop-daemon test-daemon to start daemon, passed when exit status code is 0 and the daemon is running. Result: PASSED/FAIL Reference 32.4-9 (FIXME: A or T) Does 32.4-8 actions and then uses start-stop-daemon test-daemon to start daemon againr; passed when exit status code is 0 and no further daemon is started. Result: PASSED/FAIL Reference 32.4-10 (FIXME: A or T) Does 32.4-8 actions and then uses start-stop-daemon -f test-daemon to start the daemon again; passed when exit status code is 0 and a new daemon is started. Result: PASSED/FAIL Reference 32.4-11 (FIXME: A or T) Does 32.4-8 actions and then uses start-stop-daemon -p /var/run/test-daemon.pid test-daemon to start daemon again; passed when exit status code is 0 and no further daemon is started. Result: PASSED/FAIL Reference 32.4-12 (FIXME: A or T) Does 32.4-8 actions and uses then start-stop-daemon -f -p /var/run/test-daemon.pid test-daemon to start the daemon again; passed when exit status code is 0 and a new daemon is started. Result: PASSED/FAIL Reference 32.4-13 (FIXME: A or T) Does 32.4-8 actions and uses start-stop-daemon -p /var/run/test-daemon2.pid test-daemon to start the daemon; passed when the exit status code is 0 and a new daemon is started. Result: PASSED/FAIL Reference 32.4-14 (FIXME: A or T) Does 32.4-13 actions and uses then start-stop-daemon -f -p /var/run/test-daemon2.pid test-daemon to start daemon again; passed when exit status code is 0 and a new daemon is started. Result: PASSED/FAIL Reference 32.4-15 (FIXME: A or T) Runs start-stop-daemon -n 19 test-daemon; passed when the exit status code is 0 and a new daemon is started with this nicelevel. Result: PASSED/FAIL Reference 32.4-16 (FIXME: A or T) Does 32.4-8 actions and then kill the daemon using killproc test-daemon; passed when exit status code is 0 and the daemon is stopped. Result: PASSED/FAIL Reference 32.4-17 (FIXME: A or T) kill the daemon using killproc test-daemon using killproc test-daemon; passed when exit status code is 0 Result: PASSED/FAIL Reference 32.4-18 (FIXME: A or T) Start the test-daemon such that it ignored SIGTERM and then kill the daemon using killproc test-daemon; passed when exit status code is 0, the daemon is stopped and the daemon's logfile shows that a SIGTERM had arrived. Result: PASSED/FAIL Reference 32.4-19 (FIXME: A or T) Start the test-daemon such that it ignored SIGTERM and then kill the daemon using killproc test-daemon -TERM; passed when exit status code is 0 and the daemon is not stopped while its log states that a SIGTERM had arrived. Result: PASSED/FAIL Reference 32.4-20 (FIXME: A or T) Kill the not-running daemon using killproc test-daemon -TERM; passed when exit status code is not 0. Result: PASSED/FAIL Reference 32.4-21 (FIXME: A or T) Starts the test-daemon with special PID file, then calls killproc -p $PIDFILE test-daemon; passed when the exit status code is 0 and the daemon is stopped. Reference 32.4-22 (FIXME: A or T) Starts the test-daemon with special PID file multiple times, then calls killproc -p $PIDFILE test-daemon; passed when the exit status code is 0 and all daemons are is stopped. Result: PASSED/FAIL Reference 32.4-23 (FIXME: A or T) Do 32.4-22 actions; passed when the $PIDFILE has been deleted. Result: PASSED/FIP Reference 32.4-24 (FIXME: A or T) Starts the test-daemon (normal pidfile) and then calls killproc -p $PIDFILE test-daemon with non-existing $PIDFILE; passed when the exit status code is 0 and the daemon is still running. Result: PASSED/FAIL Reference 32.4-25 (FIXME: A or T) Starts the daemon once and calls then pidofproc test-daemon; passed when the exit status is 0 and the PID is returned in the first line which ends with \n. Result: PASSED/FAIL Reference 32.4-25 (FIXME: A or T) Starts the daemon several times and calls then pidofproc test-daemon; passed when the exit status is 0 and all PIDs are returned in the first line which ends with \n. Result: PASSED/FAIL Reference 32.4-25 (FIXME: A or T) Starts the daemon with non-default $PIDFILE and calls then pidofproc -p $PIDFILE test-daemon; passed when pidofproc returns the pid and exits with exit status code 0. Result: PASSED/FAIL Reference 32.4-25 (FIXME: A or T) Starts daemon twice using different pidfiles. Calls then pidofproc test-daemon; passed when pidofproc returns only the pid of the daemon which uses /var/run/basename.pid and has the exit status code 0. Result: PASSED/FAIL Reference 32.4-25 (FIXME: A or T) Starts daemon twice using different pidfiles. Calls then pidofproc -p $PIDFILE test-daemon; passed when pidofproc returns only the pid of the daemon which uses $PIDFILE and has the exit status code 0. Result: PASSED/FAIL Reference 32.4-25 (FIXME: A or T) Starts daemon twice using th default pidfile. Calls then pidofproc -p $PIDFILE test-daemon; passed when no pid is returned and the exit status code is not 0. Result: PASSED/FAIL Reference 32.4-25 (FIXME: A or T) Calls pidofproc test-daemon on the non-running daemon; passed when no pid is returned and the exit status code is not 0. Result: PASSED/FAIL # # FURTHER TESTS (write assertions) # - write non running PIDs to $pidfile and call pidofproc # - check for initscripts which start with a number such as 3com-foo # since numbers may confuse the install/remove_initd