LSB init script tests
Links, Specification:Diff, Specification:TODO, Tests
Links
Comparison of gLSB 1.3.0 and gLSB-1.9
Colors: Changes since 12 August 2003 are marked in red while before 12 August 2003 are marked in green.
TODO
- install/remove_initd: reaction if there is no or no valid comment header
exit with exit status code 2?
SuSE currently defaults to run level 35 for those scripts which don't
have Default-Start/Stop header (with dependency on nothing).
[No action required]
- Installing/updating packges: When installing the init scripts may or may
not be installed (install_initd), but when updating the current status
shall not be changed, only the order (due to the dependencies) may be
changed. (Bug #799244)
Solution by SuSE: "install_initd /etc/init.d" (actually insserv etc/init.d)
updates the dependencies, X-UnitedLinux-Default-Enabled: yes/no is used
for the initial status.
[Need to track SuSE's macros and understand RPM's update mechanizm.]
- Init script names (see bug 795878)
LSB: [a-z0-9] for script names, LANANA as [a-z0-9.\-]
Possible clashes with domain, provider and init script names.
Note: those with . or - are all marked as
"Reserved for LSB-Compliant Distribution", i.e. this need not to
be resolved.
[No action required]
- pathname seemingly unclear (some assume basename!)
See bug: 804233
[Need to define 'pathname' ?]
- Allow "# Keyword: item item " (multiple spaces instead of a single one)?
[No action required, but this use is very widespread and common]
- argument of install/remove_initd unclear
See bug: 804233
- Explain the usage of install_initd/remove_initd better
Bug #520235, #545387, #764725
SA2003-09-24: George: installation/removal of init.d.
/etc/init.d/example.com-coffeed in the two examples.
Should this be absolute? If so, living in /etc/init.d or elsewhere?
Examples should presumably be footnotes.
George to submit bug for future discussion.
- startup script tests needed (this file, kind of bug #545387)
LSB Runtime Environment Tests
Assertions
Tests
Test items
For the actual tests see the assertions and the actual tests
Note that only *Start* is tested since some distributions determine the stop themselves (runlevel: those where it had not been started, required-stop: those who were there at required-start [does this always makes sense?]). (Distro: e.g. SuSE/UL)
General
- Check for existance of /lib/lsb/init-functions and the existance and executable (x flag) of /usr/lib/lsb/install_initd and /usr/lib/lsb/remove_initd
The scripts are required thus they shall be there.
- Check for existance of /etc/init.d/
Are you sure you don't want to have that? (Warn!) Besides it is needed for the tests so create it if non-existing.
install_initd and remove_initd tests
- System facility names checking by install_initd and then remove_initd an init script which contains Required-Start: $local_fs $network $named $portmap $remote_fs $syslog $time.
The gLSB says: Facility names that begin with a dollar sign [...] MUST be provided by distributions
– but is it required that all needed init scripts are enabled in the runlevels asked by the script (Default-Start)?
- System facility name checking by asking for Required-Start: $local_fsXXX
The gLSB states: Facility names that begin with a dollar sign are [...] defined by the LSB
– do we really want to require this? SuSE/UL has $ALL to insert something at the very end. Maybe a warning is enough.
- Application facility names checking (one): Ask for Required-Start: lsb-lsb-init-test. Expected: install_initd returns the exit status code 1
- Application facility names checking (two): Install a script which provides lsb-lsb-init-test and ask then for Required-Start: lsb-lsb-init-test. Expected: both install_initd calls returns the exit status code 0.
- Application facility names checking (three): Try to remove the script which provides lsb-lsb-init-test. Expected: Fails with exit code 1.
- Remove now the second script. Expected: success.
- Install it again. Expected: success (since the first is still installed).
- Remove both (expected: success) and try again to install the second script (expected: Failure with 1).
- Check whether install/remove_initd chokes on X- headers and whether it acceps Should-Start/Should-Stop when it cannot fulfil the required facility (system/application) and when it can. Expected in all cases: Success.
/lib/lsb/init-functions tests
- Use the POSIX /bin/sh shell from the distribution and see whether there is an error when sourcing the /lib/lsb/init-functions file.
- Use type to check for the required functions: start_daemon, pidofproc, log_success_msg, log_failure_msg and log_warning_msg.
Brain storming
lsb-test-daemon is a PERL daemon which writes its pid
to /var/run/lsb-test-daemon.pid or to pidfile (given by the -p option)
and writes to a log file
start lsb-test-daemon -- should be started
start again -- should not be started (lsb-test-daemon has to check)
start again with -f -- should be startet
start with -p option -- should be startet
shart again -- should not be startet
pidofproc should return all pids (written in the PID file)
killproc lsb-test-daemon -KILL
pidofproc should return no PID (no running process)
killproc lsb-test-daemon -- should kill lsb-test-daemon even if TERM is catched
killproc lsb-term-daemon -TERM -- should not kill lsb-test-daemon (TERM is catched)
LSB Application Tests
To come