mirror of
https://github.com/iustin/mt-st.git
synced 2026-01-03 10:55:15 +00:00
Expand command line and error handling
This commit is contained in:
7
tests/data/illegal-mode.data
Normal file
7
tests/data/illegal-mode.data
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# A non-compressing DAT (DDS-1)
|
||||||
|
# The manufacturer, model, and revision strings can be obtained,
|
||||||
|
# from the file /proc/scsi/scsi (cat /proc/scsi/scsi).
|
||||||
|
manufacturer=XYZ model = "UVW1" {
|
||||||
|
scsi2logical=1 can-bsr can-partitions auto-lock
|
||||||
|
mode1 blocksize=0
|
||||||
|
modeABC blocksize=1024 }
|
||||||
34
tests/mt-cli.test
Normal file
34
tests/mt-cli.test
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# Wrong argument
|
||||||
|
./mt -x
|
||||||
|
>>>2 /usage: /
|
||||||
|
>>>= 1
|
||||||
|
|
||||||
|
# Missing tape argument
|
||||||
|
./mt -f
|
||||||
|
>>>2 /usage: /
|
||||||
|
>>>= 1
|
||||||
|
|
||||||
|
# Unknown command
|
||||||
|
./mt to-the-moon
|
||||||
|
>>>2 /mt: unknown command "to-the-moon"/
|
||||||
|
>>>= 1
|
||||||
|
|
||||||
|
# Too many arguments
|
||||||
|
./mt rewind 1
|
||||||
|
>>>2 /mt: too many arguments for the command 'rewind'\./
|
||||||
|
>>>= 1
|
||||||
|
|
||||||
|
# Ambigous command
|
||||||
|
./mt l
|
||||||
|
>>>2 /mt: ambiguous command "l"/
|
||||||
|
>>>= 1
|
||||||
|
|
||||||
|
# Shortened but not ambiguous command.
|
||||||
|
./mt rewi 1
|
||||||
|
>>>2 /mt: too many arguments for the command 'rewind'\./
|
||||||
|
>>>= 1
|
||||||
|
|
||||||
|
# Densities command - the only one not requiring a tape.
|
||||||
|
./mt densities
|
||||||
|
>>> /LTO-6/
|
||||||
|
>>>= 0
|
||||||
4
tests/mt-errors.test
Normal file
4
tests/mt-errors.test
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Wrong tape argument
|
||||||
|
./mt -f /dev/no-such-tape rewind
|
||||||
|
>>>2 /no-such-tape: No such file or directory/
|
||||||
|
>>>= 1
|
||||||
51
tests/stinit-errors.test
Normal file
51
tests/stinit-errors.test
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# 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/
|
||||||
|
>>>= 0
|
||||||
|
|
||||||
|
./stinit -f stinit.def.examples 1000
|
||||||
|
>>>2 /Definition for '1000' failed/
|
||||||
|
>>>= 0
|
||||||
|
|
||||||
|
# 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
|
||||||
@@ -2,6 +2,11 @@
|
|||||||
./stinit -p -f stinit.def.examples
|
./stinit -p -f stinit.def.examples
|
||||||
>>>= 0
|
>>>= 0
|
||||||
|
|
||||||
|
# Extra arguments ignored while file parsing
|
||||||
|
./stinit -p -f stinit.def.examples abc
|
||||||
|
>>>2 /Extra arguments .* ignored/
|
||||||
|
>>>= 0
|
||||||
|
|
||||||
# Checking complete stinit parsing
|
# Checking complete stinit parsing
|
||||||
./stinit -v -v -p -f stinit.def.examples
|
./stinit -v -v -p -f stinit.def.examples
|
||||||
>>> /No errors found./
|
>>> /No errors found./
|
||||||
|
|||||||
Reference in New Issue
Block a user