]> git.ipfire.org Git - thirdparty/util-linux.git/blame - tests/ts/fdisk/oddinput
tests: split stdout and stderr
[thirdparty/util-linux.git] / tests / ts / fdisk / oddinput
CommitLineData
66723dfd
ZB
1#!/bin/bash
2
3#
601d12fb 4# This file is part of util-linux.
66723dfd
ZB
5#
6# This file is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version.
10#
11# This file is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16
e130ce53 17TS_TOPDIR="${0%/*}/../.."
66723dfd
ZB
18TS_DESC="invalid input tests"
19
20. $TS_TOPDIR/functions.sh
21ts_init "$*"
22
2f791546 23ts_check_test_command "$TS_CMD_FDISK"
c3f323cb 24ts_check_test_command "$TS_HELPER_MD5"
2f791546 25
66723dfd
ZB
26#set -x
27
cbf858aa 28ts_log "---Initialize empty image"
66723dfd 29TEST_IMAGE_NAME=$(ts_image_init 10)
cbf858aa 30ts_image_md5sum >> $TS_OUTPUT 2>> $TS_ERRLOG
66723dfd 31
23ce9df7
KZ
32#
33# Note that since 2.23 the DOS-mode has effect only if there is a MBR on the device.
34#
35
cbf858aa 36ts_log "---Empty image listing" # this should report empty partition table
66723dfd 37# TEST_IMAGE_NAME has absolute path, and is by definition different on each computer, we need to sed it away
cbf858aa
KZ
38$TS_CMD_FDISK -c=dos -u=cylinders -l ${TEST_IMAGE_NAME} >> $TS_OUTPUT 2>> $TS_ERRLOG
39sed -i -e "s/${TEST_IMAGE_NAME//\//\\/}/testimage/" $TS_OUTPUT $TS_ERRLOG
66723dfd 40
cbf858aa
KZ
41#
42# Errors
43#
44ts_logerr "---Nonexistent file"
45$TS_CMD_FDISK -c=dos -u=cylinders -l _a_file_that_does_not_exist_ >> $TS_OUTPUT 2>> $TS_ERRLOG
46sed -i -e "s@$($TS_HELPER_STRERROR ENOENT)@ENOENT@" $TS_OUTPUT $TS_ERRLOG
66723dfd 47
cbf858aa 48ts_logerr "---Too small file"
ff680b36 49echo "This file is too small" >> oddinput.toosmall
cbf858aa
KZ
50$TS_CMD_FDISK -c=dos -u=cylinders -l oddinput.toosmall >> $TS_OUTPUT 2>> $TS_ERRLOG
51sed -i -e "s@$($TS_HELPER_STRERROR ENOTTY)@ENOTTY@" $TS_OUTPUT $TS_ERRLOG
ff680b36 52rm oddinput.toosmall
66723dfd 53ts_finalize