]>
Commit | Line | Data |
---|---|---|
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 | 17 | TS_TOPDIR="${0%/*}/../.." |
66723dfd ZB |
18 | TS_DESC="invalid input tests" |
19 | ||
20 | . $TS_TOPDIR/functions.sh | |
21 | ts_init "$*" | |
22 | ||
2f791546 | 23 | ts_check_test_command "$TS_CMD_FDISK" |
c3f323cb | 24 | ts_check_test_command "$TS_HELPER_MD5" |
2f791546 | 25 | |
66723dfd ZB |
26 | #set -x |
27 | ||
cbf858aa | 28 | ts_log "---Initialize empty image" |
66723dfd | 29 | TEST_IMAGE_NAME=$(ts_image_init 10) |
cbf858aa | 30 | ts_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 | 36 | ts_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 |
39 | sed -i -e "s/${TEST_IMAGE_NAME//\//\\/}/testimage/" $TS_OUTPUT $TS_ERRLOG | |
66723dfd | 40 | |
cbf858aa KZ |
41 | # |
42 | # Errors | |
43 | # | |
44 | ts_logerr "---Nonexistent file" | |
45 | $TS_CMD_FDISK -c=dos -u=cylinders -l _a_file_that_does_not_exist_ >> $TS_OUTPUT 2>> $TS_ERRLOG | |
46 | sed -i -e "s@$($TS_HELPER_STRERROR ENOENT)@ENOENT@" $TS_OUTPUT $TS_ERRLOG | |
66723dfd | 47 | |
cbf858aa | 48 | ts_logerr "---Too small file" |
ff680b36 | 49 | echo "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 |
51 | sed -i -e "s@$($TS_HELPER_STRERROR ENOTTY)@ENOTTY@" $TS_OUTPUT $TS_ERRLOG | |
ff680b36 | 52 | rm oddinput.toosmall |
66723dfd | 53 | ts_finalize |