subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 1 | /****************************************************************************** |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 2 | * fallocate02.c |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 3 | * Mon Dec 24 2007 |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 4 | * Copyright (c) International Business Machines Corp., 2007 |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 5 | * Emali : sharyathi@in.ibm.com |
| 6 | ******************************************************************************/ |
| 7 | |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 8 | /*************************************************************************** |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU Library General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 22 | ***************************************************************************/ |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 23 | |
| 24 | /***************************************************************************** |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 25 | * |
| 26 | * OS Test - International Business Machines Corp. 2007. |
| 27 | * |
| 28 | * TEST IDENTIFIER : fallocate02 |
| 29 | * |
| 30 | * EXECUTED BY : anyone |
| 31 | * |
| 32 | * TEST TITLE : Checks for Errors from fallocate() |
| 33 | * |
| 34 | * TEST CASE TOTAL : 7 |
| 35 | * |
| 36 | * CPU ARCHITECTURES : PPC,X86, X86_64 |
| 37 | * |
| 38 | * AUTHOR : Sharyathi Nagesh |
| 39 | * |
| 40 | * CO-PILOT : |
| 41 | * |
| 42 | * DATE STARTED : 24/12/2007 |
| 43 | * |
| 44 | * TEST CASES |
| 45 | * (Tests fallocate() for different test cases as reported in map page) |
| 46 | * |
| 47 | * INPUT SPECIFICATIONS |
| 48 | * No input needs to be specified |
| 49 | * fallocate() in-puts are specified through test_data |
| 50 | * |
| 51 | * OUTPUT SPECIFICATIONS |
| 52 | * fallocate Error message matches with the expected error message. |
| 53 | * |
| 54 | * ENVIRONMENTAL NEEDS |
| 55 | * Test Needs to be executed on file system supporting ext4 |
| 56 | * LTP {TMP} Needs to be set to such a folder |
| 57 | * |
| 58 | * SPECIAL PROCEDURAL REQUIREMENTS |
| 59 | * None |
| 60 | * |
| 61 | * DETAILED DESCRIPTION |
| 62 | * This is a test case for fallocate() system call. |
| 63 | * This test suite tests various error messages from fallocate |
| 64 | * If the error message received matches with the expected |
| 65 | * test is considered passed else test fails |
| 66 | * Provided TEST_DEFAULT to switch b/w modes |
| 67 | * |
| 68 | * Total 7 Test Cases :- |
| 69 | * Various error messages from the man page |
| 70 | * |
| 71 | * Setup: |
| 72 | * Setup files on which fallocate is to be called |
| 73 | * |
| 74 | * Test: |
| 75 | * Loop if the proper options are given. |
| 76 | * Execute system call |
| 77 | * Check return code. |
| 78 | * If error obtained matches with the expected error |
| 79 | * PASS the test, otherwise TEST FAILS |
| 80 | * Provided TEST_DEFAULT to switch b/w modes |
| 81 | * |
| 82 | * Cleanup: |
| 83 | * Cleanup the temporary folder |
| 84 | * |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 85 | *************************************************************************/ |
| 86 | |
| 87 | /* Standard Include Files */ |
| 88 | #include <stdio.h> |
| 89 | #include <stdlib.h> |
Garrett Cooper | 187f251 | 2010-12-19 18:07:59 -0800 | [diff] [blame] | 90 | #include <endian.h> |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 91 | #include <errno.h> |
| 92 | #include <sys/stat.h> |
| 93 | #include <sys/types.h> |
| 94 | #include <fcntl.h> |
vapier | 4a5373f | 2009-08-28 12:40:49 +0000 | [diff] [blame] | 95 | #include <inttypes.h> |
subrata_modak | df18bd0 | 2008-02-19 09:32:47 +0000 | [diff] [blame] | 96 | #include <sys/utsname.h> |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 97 | |
| 98 | /* Harness Specific Include Files. */ |
| 99 | #include "test.h" |
| 100 | #include "usctest.h" |
| 101 | #include "linux_syscall_numbers.h" |
| 102 | |
| 103 | #define BLOCKS_WRITTEN 12 |
| 104 | |
| 105 | #ifdef TEST_DEFAULT |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 106 | #define DEFAULT_TEST_MODE 0 //DEFAULT MODE |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 107 | #else |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 108 | #define DEFAULT_TEST_MODE 1 //FALLOC_FL_KEEP_SIZE MODE |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 109 | #endif |
| 110 | |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 111 | #define OFFSET 12 |
| 112 | |
| 113 | /*Local Functions*/ |
| 114 | static inline long fallocate(); |
| 115 | void populate_file(); |
| 116 | void create_fifo(); |
| 117 | void create_pipe(); |
| 118 | void get_blocksize(int fd); |
| 119 | |
| 120 | /* Extern Global Variables */ |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 121 | /* Global Variables */ |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 122 | char *TCID = "fallocate02"; /* test program identifier */ |
| 123 | char fnamew[255]; /* Files used for testing */ |
| 124 | char fnamer[255]; /* Files used for testing */ |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 125 | int fdw; |
| 126 | int fdr; |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 127 | enum { RFILE, WFILE, PIPE, FIFO }; |
| 128 | struct test_data_t { |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 129 | int file; |
| 130 | int mode; |
| 131 | loff_t offset; |
| 132 | loff_t len; |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 133 | int error; |
| 134 | } test_data[] = { |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 135 | { |
| 136 | RFILE, DEFAULT_TEST_MODE, 0, 1, EBADF}, { |
| 137 | WFILE, DEFAULT_TEST_MODE, -1, 1, EINVAL}, { |
| 138 | WFILE, DEFAULT_TEST_MODE, 1, -1, EINVAL}, { |
| 139 | WFILE, DEFAULT_TEST_MODE, BLOCKS_WRITTEN, 0, EINVAL}, { |
| 140 | WFILE, DEFAULT_TEST_MODE, BLOCKS_WRITTEN, -1, EINVAL}, { |
| 141 | WFILE, DEFAULT_TEST_MODE, -(BLOCKS_WRITTEN + OFFSET), 1, EINVAL}, { |
| 142 | WFILE, DEFAULT_TEST_MODE, BLOCKS_WRITTEN - OFFSET, 1, 0} |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 143 | }; |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 144 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 145 | /* total number of tests in this file */ |
| 146 | int TST_TOTAL = sizeof(test_data) / sizeof(test_data[0]); |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 147 | int block_size; |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 148 | int buf_size; |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 149 | |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 150 | /****************************************************************************** |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 151 | * Performs all one time clean up for this test on successful |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 152 | * completion, premature exit or failure. Closes all temporary |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 153 | * files, removes all temporary directories exits the test with |
| 154 | * appropriate return code by calling tst_exit() function. |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 155 | ******************************************************************************/ |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 156 | extern void cleanup() |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 157 | { |
| 158 | /* Close all open file descriptors. */ |
vapier | 4a5373f | 2009-08-28 12:40:49 +0000 | [diff] [blame] | 159 | if (close(fdw) == -1) |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 160 | tst_resm(TWARN | TERRNO, "close(%s) failed", fnamew); |
subrata_modak | bdbaec5 | 2009-02-26 12:14:51 +0000 | [diff] [blame] | 161 | |
vapier | 4a5373f | 2009-08-28 12:40:49 +0000 | [diff] [blame] | 162 | if (close(fdr) == -1) |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 163 | tst_resm(TWARN | TERRNO, "close(%s) failed", fnamer); |
subrata_modak | bdbaec5 | 2009-02-26 12:14:51 +0000 | [diff] [blame] | 164 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 165 | tst_rmdir(); |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 166 | |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | /***************************************************************************** |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 170 | * Performs all one time setup for this test. This function is |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 171 | * used to create temporary dirs and temporary files |
| 172 | * that may be used in the course of this test |
| 173 | ******************************************************************************/ |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 174 | void setup() |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 175 | { |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 176 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 177 | tst_sig(FORK, DEF_HANDLER, cleanup); |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 178 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 179 | TEST_PAUSE; |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 180 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 181 | tst_tmpdir(); |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 182 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 183 | sprintf(fnamer, "tfile_read_%d", getpid()); |
| 184 | sprintf(fnamew, "tfile_write_%d", getpid()); |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 185 | |
vapier | 4a5373f | 2009-08-28 12:40:49 +0000 | [diff] [blame] | 186 | fdr = open(fnamer, O_RDONLY | O_CREAT, S_IRUSR); |
| 187 | if (fdr == -1) |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 188 | tst_brkm(TBROK | TERRNO, cleanup, |
| 189 | "open(%s, O_RDONLY|O_CREAT, S_IRUSR) failed", fnamer); |
vapier | 4a5373f | 2009-08-28 12:40:49 +0000 | [diff] [blame] | 190 | fdw = open(fnamew, O_RDWR | O_CREAT, S_IRWXU); |
| 191 | if (fdw == -1) |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 192 | tst_brkm(TBROK | TERRNO, cleanup, |
| 193 | "open(%s, O_RDWR|O_CREAT, S_IRWXU) failed", fnamew); |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 194 | get_blocksize(fdr); |
| 195 | populate_file(); |
| 196 | } |
| 197 | |
| 198 | /***************************************************************************** |
| 199 | * Gets the block size for the file system |
| 200 | ******************************************************************************/ |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 201 | void get_blocksize(int fd) |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 202 | { |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 203 | struct stat file_stat; |
subrata_modak | bdbaec5 | 2009-02-26 12:14:51 +0000 | [diff] [blame] | 204 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 205 | if (fstat(fd, &file_stat) < 0) |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 206 | tst_resm(TFAIL | TERRNO, |
vapier | 4a5373f | 2009-08-28 12:40:49 +0000 | [diff] [blame] | 207 | "fstat failed while getting block_size"); |
subrata_modak | bdbaec5 | 2009-02-26 12:14:51 +0000 | [diff] [blame] | 208 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 209 | block_size = (int)file_stat.st_blksize; |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 210 | buf_size = block_size; |
| 211 | } |
subrata_modak | bdbaec5 | 2009-02-26 12:14:51 +0000 | [diff] [blame] | 212 | |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 213 | /***************************************************************************** |
| 214 | * Writes data into the file |
| 215 | ******************************************************************************/ |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 216 | void populate_file() |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 217 | { |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 218 | char buf[buf_size + 1]; |
| 219 | int index; |
| 220 | int blocks; |
| 221 | int data; |
| 222 | for (blocks = 0; blocks < BLOCKS_WRITTEN; blocks++) { |
| 223 | for (index = 0; index < buf_size; index++) |
| 224 | buf[index] = 'A' + (index % 26); |
| 225 | buf[buf_size] = '\0'; |
vapier | 4a5373f | 2009-08-28 12:40:49 +0000 | [diff] [blame] | 226 | if ((data = write(fdw, buf, buf_size)) < 0) |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 227 | tst_brkm(TBROK | TERRNO, cleanup, |
vapier | 4a5373f | 2009-08-28 12:40:49 +0000 | [diff] [blame] | 228 | "Unable to write to %s", fnamew); |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 229 | } |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 230 | } |
| 231 | |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 232 | /***************************************************************************** |
| 233 | * Wraper function to call fallocate system call |
| 234 | ******************************************************************************/ |
| 235 | static inline long fallocate(int fd, int mode, loff_t offset, loff_t len) |
| 236 | { |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 237 | #if __WORDSIZE == 32 |
Jan Stancek | 359980f | 2013-02-15 10:16:05 +0100 | [diff] [blame^] | 238 | return (long)ltp_syscall(__NR_fallocate, fd, mode, |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 239 | __LONG_LONG_PAIR((off_t) (offset >> 32), |
| 240 | (off_t) offset), |
| 241 | __LONG_LONG_PAIR((off_t) (len >> 32), |
| 242 | (off_t) len)); |
Garrett Cooper | 187f251 | 2010-12-19 18:07:59 -0800 | [diff] [blame] | 243 | #else |
Jan Stancek | 359980f | 2013-02-15 10:16:05 +0100 | [diff] [blame^] | 244 | return ltp_syscall(__NR_fallocate, fd, mode, offset, len); |
Garrett Cooper | 187f251 | 2010-12-19 18:07:59 -0800 | [diff] [blame] | 245 | #endif |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 246 | } |
| 247 | |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 248 | /***************************************************************************** |
| 249 | * Main function that calls the system call with the appropriate parameters |
| 250 | ******************************************************************************/ |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 251 | /* ac: number of command line parameters */ |
| 252 | /* av: pointer to the array of the command line parameters */ |
| 253 | int main(int ac, char **av) |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 254 | { |
| 255 | |
| 256 | int test_index = 0; |
| 257 | int lc; |
| 258 | int fd; |
| 259 | char fname[255], *msg; |
subrata_modak | bdbaec5 | 2009-02-26 12:14:51 +0000 | [diff] [blame] | 260 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 261 | /*************************************************************** |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 262 | * parse standard options |
| 263 | ***************************************************************/ |
Garrett Cooper | 45e285d | 2010-11-22 12:19:25 -0800 | [diff] [blame] | 264 | if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) |
Garrett Cooper | 60fa801 | 2010-11-22 13:50:58 -0800 | [diff] [blame] | 265 | tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); |
subrata_modak | bdbaec5 | 2009-02-26 12:14:51 +0000 | [diff] [blame] | 266 | |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 267 | /* perform global test setup, call setup() function. */ |
| 268 | setup(); |
| 269 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 270 | for (lc = 0; TEST_LOOPING(lc); lc++) { |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 271 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 272 | Tst_count = 0; |
| 273 | for (test_index = 0; test_index < TST_TOTAL; test_index++) { |
| 274 | switch (test_data[test_index].file) { |
| 275 | case RFILE: |
| 276 | fd = fdr; |
| 277 | strcpy(fname, fnamer); |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 278 | break; |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 279 | case WFILE: |
| 280 | fd = fdw; |
| 281 | strcpy(fname, fnamew); |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 282 | break; |
vapier | 6f36678 | 2009-11-04 16:34:30 +0000 | [diff] [blame] | 283 | default: |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 284 | tst_brkm(TCONF, cleanup, |
| 285 | "invalid test setting"); |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 286 | tst_exit(); |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 287 | } |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 288 | |
| 289 | TEST(fallocate |
| 290 | (fd, test_data[test_index].mode, |
| 291 | test_data[test_index].offset * block_size, |
| 292 | test_data[test_index].len * block_size)); |
| 293 | /* check return code */ |
| 294 | if (TEST_ERRNO != test_data[test_index].error) { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 295 | if (TEST_ERRNO == EOPNOTSUPP |
| 296 | || TEST_ERRNO == ENOSYS) { |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 297 | tst_brkm(TCONF, cleanup, |
vapier | 4a5373f | 2009-08-28 12:40:49 +0000 | [diff] [blame] | 298 | "fallocate system call is not implemented"); |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 299 | } |
| 300 | TEST_ERROR_LOG(TEST_ERRNO); |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 301 | tst_resm(TFAIL | TTERRNO, |
| 302 | "fallocate(%s:%d, %d, %" PRId64 ", %" |
| 303 | PRId64 ") failed, expected errno:%d", |
| 304 | fname, fd, test_data[test_index].mode, |
| 305 | test_data[test_index].offset * |
| 306 | block_size, |
| 307 | test_data[test_index].len * block_size, |
| 308 | test_data[test_index].error); |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 309 | } else { |
| 310 | /* No Verification test, yet... */ |
| 311 | tst_resm(TPASS, |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 312 | "fallocate(%s:%d, %d, %" PRId64 ", %" |
| 313 | PRId64 ") returned %d", fname, fd, |
| 314 | test_data[test_index].mode, |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 315 | test_data[test_index].offset * |
| 316 | block_size, |
| 317 | test_data[test_index].len * block_size, |
| 318 | TEST_ERRNO); |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 319 | } |
subrata_modak | 122c603 | 2008-01-08 11:01:11 +0000 | [diff] [blame] | 320 | } |
| 321 | } |
| 322 | cleanup(); |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 323 | tst_exit(); |
Garrett Cooper | 187f251 | 2010-12-19 18:07:59 -0800 | [diff] [blame] | 324 | } |