mirror of
https://github.com/iustin/mt-st.git
synced 2025-12-23 05:45:13 +00:00
Previously, stinit returned zero even if it fails to set the options. This patch changes the return value to one if one or more of the options can't be set for a device if the tape numbers are given on command line. If no numbers are given, stinit returns zero (as before this patch). After this change, scripts (udev rules) can more easily detect when stinit fails. Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
52 lines
1.0 KiB
Plaintext
52 lines
1.0 KiB
Plaintext
# Check handling of missing file
|
|
./stinit -p -f no-such-database
|
|
>>>2 /Can't find SCSI tape database/
|
|
>>>= 1
|
|
|
|
# No file passed
|
|
./stinit -p -f
|
|
>>>2 /Usage:/
|
|
>>>= 1
|
|
|
|
# Wrong arguments
|
|
./stinit -x
|
|
>>>2 /Usage:/
|
|
>>>= 1
|
|
|
|
# Illegal ordering of arguments
|
|
./stinit -f stinit.def.examples 1000 -
|
|
>>>2 /Usage:/
|
|
>>>= 1
|
|
|
|
# Check bad mode
|
|
./stinit -v -v -p -f tests/data/illegal-mode.data
|
|
>>> /Errors found!/
|
|
>>>2 /Illegal mode for/
|
|
>>>= 1
|
|
|
|
# No modes defined
|
|
#./stinit -v -v -f tests/data/no-modes.data
|
|
#>>> /Errors found!/
|
|
#>>>2 /Illegal mode for/
|
|
#>>>= 1
|
|
|
|
# Wrong tape device
|
|
./stinit -f stinit.def.examples /dev/no-such-tape
|
|
>>>2 /Can't find tape number for name/
|
|
>>>= 0
|
|
|
|
# Wrong tape number. Well, this is flaky, but let's hope nobody has
|
|
# 1000 tapes.
|
|
./stinit -f stinit.def.examples 1000
|
|
>>>2 /Can't find any device files for tape 1000/
|
|
>>>= 1
|
|
|
|
./stinit -f stinit.def.examples 1000
|
|
>>>2 /Definition for '1000' failed/
|
|
>>>= 1
|
|
|
|
# Wrong tape number (non-numeric).
|
|
./stinit -f stinit.def.examples 1000a
|
|
>>>2 /Invalid tape device index '1000a': don't know how to parse 'a'/
|
|
>>>= 0
|