plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | * under the terms of version 2 of the GNU General Public License as |
| 6 | * published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it would be useful, but |
| 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 11 | * |
| 12 | * Further, this software is distributed without any warranty that it is |
| 13 | * free of the rightful claim of any third person regarding infringement |
| 14 | * or the like. Any license provided herein, whether implied or |
| 15 | * otherwise, applies only to this software file. Patent licenses, if |
| 16 | * any, provided herein do not apply to combinations of this program with |
| 17 | * other software, or any other product whatsoever. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License along |
Wanlong Gao | fed9641 | 2012-10-24 10:10:29 +0800 | [diff] [blame] | 20 | * with this program; if not, write the Free Software Foundation, Inc., |
| 21 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 22 | * |
| 23 | * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, |
| 24 | * Mountain View, CA 94043, or: |
| 25 | * |
| 26 | * http://www.sgi.com |
| 27 | * |
| 28 | * For further information regarding this notice, see: |
| 29 | * |
| 30 | * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ |
| 31 | * |
| 32 | */ |
vapier | 6659f41 | 2009-08-28 11:17:39 +0000 | [diff] [blame] | 33 | /* $Id: asyncio02.c,v 1.6 2009/08/28 11:17:39 vapier Exp $ */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 34 | /************************************************************ |
| 35 | * OS Test - Silicon Graphics, Inc. |
| 36 | * Mendota Heights, Minnesota |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 37 | * |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 38 | * TEST IDENTIFIER: aiotcs02: write/close flushes data to the file |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 39 | * |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 40 | * PARENT DOCUMENT: aiotds01: kernel i/o |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 41 | * |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 42 | * AUTHOR: Barrie Kletscher |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 43 | * |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 44 | * CO-PILOT: Dave Baumgartner |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 45 | * |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 46 | * TEST ITEMS: |
| 47 | * for each open flags set used: |
| 48 | * 1. Multiple writes to a file work as specified for |
| 49 | * more than BUFSIZ bytes. |
| 50 | * 2. Multiple writes to a file work as specified for |
| 51 | * BUFSIZ bytes. |
| 52 | * 3. Multiple writes to a file work as specified for |
| 53 | * lower than BUFSIZ bytes. |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 54 | * |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 55 | * INPUT SPECIFICATIONS: |
| 56 | * Standard parse_opts supported options. |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 57 | *$ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 58 | * OUTPUT SPECIFICATIONS |
| 59 | * Standard tst_res output format |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 60 | * |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 61 | * ENVIRONMENTAL NEEDS: |
| 62 | * This program uses the environment variable TMPDIR for the location |
| 63 | * of the temporary directory. |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 64 | * |
| 65 | * |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 66 | * SPECIAL PROCEDURAL REQUIREMENTS: |
| 67 | * The program must be linked with tst_*.o and parse_opts.o. |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 68 | * |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 69 | * INTERCASE DEPENDENCIES: |
| 70 | * NONE. |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 71 | * |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 72 | * DETAILED DESCRIPTION: |
| 73 | * Attempt to get some memory to work with. |
| 74 | * Call testrun writing (BUFSIZ + 1) bytes |
| 75 | * Call testrun writing BUFSIZ bytes |
| 76 | * Repeated call to testrun() with decreasing write sizes |
| 77 | * less than BUFSIZ |
| 78 | * End |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 79 | * |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 80 | * Start testrun() |
| 81 | * Attempt to open a temporary file. |
| 82 | * Write the memory to the file. |
| 83 | * Attempt to close the file which also flushes the buffers. |
| 84 | * Now check to see if the number of bytes written is the |
| 85 | * same as the number of bytes in the file. |
| 86 | * Cleanup |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 87 | * |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 88 | * BUGS: |
| 89 | * NONE. |
subrata_modak | 4bb656a | 2009-02-26 12:02:09 +0000 | [diff] [blame] | 90 | * |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 91 | ************************************************************/ |
| 92 | |
| 93 | #include <fcntl.h> |
| 94 | #include <sys/types.h> |
| 95 | #include <sys/stat.h> |
| 96 | #include <sys/signal.h> |
| 97 | #include <errno.h> |
| 98 | #include <stdlib.h> |
| 99 | #include "test.h" |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 100 | |
| 101 | #define FLAG O_RDWR | O_CREAT | O_TRUNC /* Flags used when opening temp tile */ |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 102 | #define MODE 0777 /* Mode to open file with */ |
| 103 | #define WRITES 10 /* Number of times buffer is written */ |
| 104 | #define DECR 1000 /* Number of bytes decremented between */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 105 | /* Calls to testrun() */ |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 106 | #define OK -1 /* Return value from testrun() */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 107 | |
| 108 | #define FNAME1 "aio02.1" |
| 109 | #define FNAME2 "aio02.2" |
| 110 | #define FNAME3 "aio02.3" |
| 111 | |
| 112 | #define ERR_MSG1 "Bytes in file not equal to bytes written." |
| 113 | #define ERR_MSG2 "Bytes in file (%d) not equal to bytes written (%d)." |
| 114 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 115 | char *dp; /* pointer to area of memory */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 116 | |
| 117 | void setup(); |
| 118 | void cleanup(); |
| 119 | int testrun(int flag, int bytes, int ti); |
| 120 | |
Cyril Hrubis | fdce7d5 | 2013-04-04 18:35:48 +0200 | [diff] [blame] | 121 | char *TCID = "asyncio02"; |
| 122 | int TST_TOTAL = 6; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 123 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 124 | char *filename; /* name of the temporary file */ |
| 125 | |
| 126 | char *Progname; |
| 127 | int Open_flags; |
| 128 | |
| 129 | int Flags[] = { |
| 130 | O_RDWR | O_CREAT | O_TRUNC, |
| 131 | O_RDWR | O_CREAT | O_TRUNC |
| 132 | }; |
| 133 | |
| 134 | int Num_flags; |
| 135 | |
| 136 | /*********************************************************************** |
| 137 | * MAIN |
| 138 | ***********************************************************************/ |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 139 | int main(int ac, char **av) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 140 | { |
| 141 | |
Cyril Hrubis | 89af32a | 2012-10-24 16:39:11 +0200 | [diff] [blame] | 142 | int i; |
| 143 | int ret_val; |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 144 | int eok; /* everything is ok flag */ |
Cyril Hrubis | 89af32a | 2012-10-24 16:39:11 +0200 | [diff] [blame] | 145 | int lc; |
Cyril Hrubis | 0b9589f | 2014-05-27 17:40:33 +0200 | [diff] [blame] | 146 | const char *msg; |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 147 | int flag_cnt; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 148 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 149 | Num_flags = sizeof(Flags) / sizeof(int); |
| 150 | TST_TOTAL = 3 * Num_flags; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 151 | |
Garrett Cooper | a9e49f1 | 2010-12-16 10:54:03 -0800 | [diff] [blame] | 152 | if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 153 | tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 154 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 155 | setup(); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 156 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 157 | for (lc = 0; TEST_LOOPING(lc); lc++) { |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 158 | |
Caspar Zhang | d59a659 | 2013-03-07 14:59:12 +0800 | [diff] [blame] | 159 | tst_count = 0; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 160 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 161 | for (flag_cnt = 0; flag_cnt < Num_flags; flag_cnt++) { |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 162 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 163 | /* |
| 164 | * call testrun writing (BUFSIZ + 1) byte chunks |
| 165 | */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 166 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 167 | filename = FNAME1; |
Cyril Hrubis | e38b961 | 2014-06-02 17:20:57 +0200 | [diff] [blame] | 168 | if (testrun(Flags[flag_cnt], BUFSIZ + 1, 1) != OK) { |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 169 | tst_resm(TFAIL, ERR_MSG1); |
Cyril Hrubis | e38b961 | 2014-06-02 17:20:57 +0200 | [diff] [blame] | 170 | } else { |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 171 | tst_resm(TPASS, |
| 172 | "More than BUFSIZE bytes multiple synchronous writes to a file check out ok"); |
| 173 | } |
| 174 | |
| 175 | /* |
| 176 | * call testrun writing BUFSIZ byte chunks |
| 177 | */ |
| 178 | |
| 179 | filename = FNAME2; |
| 180 | if (testrun(Flags[flag_cnt], BUFSIZ, 2) != OK) { |
| 181 | tst_resm(TFAIL, ERR_MSG1); |
Cyril Hrubis | e38b961 | 2014-06-02 17:20:57 +0200 | [diff] [blame] | 182 | } else { |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 183 | tst_resm(TPASS, |
| 184 | "BUFSIZE bytes multiple synchronous writes to a file checks out ok"); |
| 185 | } |
| 186 | |
| 187 | /* |
| 188 | * while the byte chunks are greater than 0 |
| 189 | * call testrun() with decreasing chunk sizes |
| 190 | */ |
| 191 | |
| 192 | filename = FNAME3; |
| 193 | eok = 1; |
| 194 | for (i = BUFSIZ - 1; i >= 0; i -= DECR) { |
| 195 | if ((ret_val = |
| 196 | testrun(Flags[flag_cnt], i, 3)) != OK) { |
vapier | 6659f41 | 2009-08-28 11:17:39 +0000 | [diff] [blame] | 197 | tst_resm(TFAIL, ERR_MSG2, ret_val, |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 198 | i * WRITES); |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 199 | } |
| 200 | } |
| 201 | |
Cyril Hrubis | e38b961 | 2014-06-02 17:20:57 +0200 | [diff] [blame] | 202 | if (eok) { |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 203 | tst_resm(TPASS, |
| 204 | "Less than BUFSIZE bytes multiple synchronous writes to a file checks out ok"); |
Cyril Hrubis | e38b961 | 2014-06-02 17:20:57 +0200 | [diff] [blame] | 205 | } |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 206 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 207 | } |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 208 | cleanup(); |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 209 | tst_exit(); |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 210 | } /* end main() */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 211 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 212 | int testrun(int flag, int bytes, int ti) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 213 | { |
| 214 | |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 215 | int fildes, i, ret; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 216 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 217 | struct stat buffer; /* buffer of memory required for stat command */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 218 | |
| 219 | /* |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 220 | * Attempt to open a temporary file. |
| 221 | */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 222 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 223 | if ((fildes = open(filename, flag, MODE)) == -1) { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 224 | tst_brkm(TBROK | TERRNO, cleanup, "open(%s) failed", filename); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | /* |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 228 | * Write the memory to the file. |
| 229 | */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 230 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 231 | for (i = 0; i < WRITES; i++) { |
| 232 | TEST(write(fildes, dp, (unsigned)bytes)); |
| 233 | |
| 234 | if (TEST_RETURN == -1) { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 235 | tst_brkm(TBROK | TTERRNO, cleanup, "write() failed"); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 236 | } |
Garrett Cooper | df3eb16 | 2010-11-28 22:44:32 -0800 | [diff] [blame] | 237 | } /* end for () */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 238 | |
| 239 | /* |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 240 | * Attempt to close the file which also flushes the buffers. |
| 241 | */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 242 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 243 | if (close(fildes) == -1) { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 244 | tst_brkm(TBROK | TERRNO, cleanup, "close() failed"); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 245 | } |
| 246 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 247 | ret = OK; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 248 | |
Cyril Hrubis | e38b961 | 2014-06-02 17:20:57 +0200 | [diff] [blame] | 249 | /* |
| 250 | * Now check to see if the number of bytes written is the |
| 251 | * same as the number of bytes in the file. |
| 252 | */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 253 | |
Cyril Hrubis | e38b961 | 2014-06-02 17:20:57 +0200 | [diff] [blame] | 254 | if (stat(filename, &buffer) == -1) { |
| 255 | tst_brkm(TBROK | TERRNO, cleanup, "stat() failed"); |
| 256 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 257 | |
Cyril Hrubis | e38b961 | 2014-06-02 17:20:57 +0200 | [diff] [blame] | 258 | if (buffer.st_size != (off_t) (bytes * WRITES)) { |
| 259 | ret = (int)buffer.st_size; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 260 | } |
| 261 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 262 | if (unlink(filename) == -1) { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 263 | tst_brkm(TBROK | TERRNO, cleanup, "unlink(%s) failed", |
| 264 | filename); |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 265 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 266 | |
| 267 | return ret; |
| 268 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 269 | } /* end testrun() */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 270 | |
| 271 | /*************************************************************** |
| 272 | * setup() - performs all ONE TIME setup for this test. |
| 273 | ***************************************************************/ |
Mike Frysinger | c57fba5 | 2014-04-09 18:56:30 -0400 | [diff] [blame] | 274 | void setup(void) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 275 | { |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 276 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 277 | tst_sig(FORK, DEF_HANDLER, cleanup); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 278 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 279 | TEST_PAUSE; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 280 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 281 | /* create a temporary directory and go to it */ |
| 282 | tst_tmpdir(); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 283 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 284 | /* |
| 285 | * Attempt to get some memory to work with. |
| 286 | */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 287 | |
Cyril Hrubis | d218f34 | 2014-09-23 13:14:56 +0200 | [diff] [blame] | 288 | if ((dp = malloc((unsigned)BUFSIZ + 1)) == NULL) { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 289 | tst_brkm(TBROK | TERRNO, cleanup, "malloc() failed"); |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 290 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 291 | |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 292 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 293 | |
| 294 | /*************************************************************** |
| 295 | * cleanup() - performs all ONE TIME cleanup for this test at |
| 296 | * completion or premature exit. |
| 297 | ***************************************************************/ |
Mike Frysinger | c57fba5 | 2014-04-09 18:56:30 -0400 | [diff] [blame] | 298 | void cleanup(void) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 299 | { |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 300 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 301 | tst_rmdir(); |
Chris Dearman | ec6edca | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 302 | } |