From ba46d5445831486d359a73bd5f48c7d45209f91c Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Tue, 7 Jan 2025 21:52:50 +0100 Subject: [PATCH] Add a few more test for error paths Since there's no virtual tape device, we can only test error paths, sadly. --- tests/data/not-a-char-device | 0 tests/mt-errors.test | 15 +++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 tests/data/not-a-char-device diff --git a/tests/data/not-a-char-device b/tests/data/not-a-char-device new file mode 100644 index 0000000..e69de29 diff --git a/tests/mt-errors.test b/tests/mt-errors.test index bef9437..77158a5 100644 --- a/tests/mt-errors.test +++ b/tests/mt-errors.test @@ -2,3 +2,18 @@ ./mt -f /dev/no-such-tape rewind >>>2 /no-such-tape: No such file or directory/ >>>= 1 + +# Wrong file in show options +./mt -f tests/data/not-a-char-device stshowoptions +>>>2 /mt: not a character device/ +>>>= 1 + +# /dev/null is not a tape device. Error message is ugly, though. +./mt -f /dev/null stshowoptions +>>>2 /Can't read the sysfs file '\/sys\/class\/scsi_tape/ +>>>= 2 + +# /dev/null is not a tape device, so status fails. +./mt -f /dev/null status +>>>2 /Inappropriate ioctl for device/ +>>>= 2