| Line | Branch | Exec | Source | 
|---|---|---|---|
| 1 | /* | ||
| 2 | ** EPITECH PROJECT, 2024 | ||
| 3 | ** 42sh | ||
| 4 | ** File description: | ||
| 5 | ** The test_mysh_old.c | ||
| 6 | */ | ||
| 7 | |||
| 8 | #include "criterion/criterion.h" | ||
| 9 | #include "criterion/redirect.h" | ||
| 10 | #include "../include/myshell.h" | ||
| 11 | |||
| 12 | 4 | Test(test1, full_gcorv) | |
| 13 | { | ||
| 14 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/usr/bin", " ;"); | |
| 15 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 16 | |||
| 17 | 2 | fprintf(file, "pwd\n"); | |
| 18 | 2 | fclose(file); | |
| 19 | 2 | freopen("test_input.txt", "r", stdin); | |
| 20 | 2 | shell(env); | |
| 21 | ✗ | } | |
| 22 | |||
| 23 | 4 | Test(test2, full_gcorv) | |
| 24 | { | ||
| 25 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin", " ;"); | |
| 26 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 27 | |||
| 28 | 2 | fprintf(file, "pwd\n"); | |
| 29 | 2 | fclose(file); | |
| 30 | 2 | freopen("test_input.txt", "r", stdin); | |
| 31 | 2 | shell(env); | |
| 32 | ✗ | } | |
| 33 | |||
| 34 | 4 | Test(test3, full_gcorv) | |
| 35 | { | ||
| 36 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 37 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 38 | |||
| 39 | 2 | fprintf(file, "cat /etc/resolv.conf\n"); | |
| 40 | 2 | fprintf(file, "ls -l /bin\n"); | |
| 41 | 2 | fprintf(file, "pwd\n"); | |
| 42 | 2 | fprintf(file, "exit\n"); | |
| 43 | 2 | fclose(file); | |
| 44 | 2 | freopen("test_input.txt", "r", stdin); | |
| 45 | 2 | shell(env); | |
| 46 | ✗ | } | |
| 47 | |||
| 48 | 4 | Test(test5, full_gcorv) | |
| 49 | { | ||
| 50 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 51 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 52 | |||
| 53 | 2 | fprintf(file, "cd ..\n"); | |
| 54 | 2 | fprintf(file, "ls -l\n"); | |
| 55 | 2 | fprintf(file, "cd /usr\n"); | |
| 56 | 2 | fprintf(file, "ls -l\n"); | |
| 57 | 2 | fprintf(file, "exit\n"); | |
| 58 | 2 | fclose(file); | |
| 59 | 2 | freopen("test_input.txt", "r", stdin); | |
| 60 | 2 | shell(env); | |
| 61 | ✗ | } | |
| 62 | |||
| 63 | 4 | Test(test6, full_gcorv) | |
| 64 | { | ||
| 65 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 66 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 67 | |||
| 68 | 2 | fprintf(file, "exit\n"); | |
| 69 | 2 | fclose(file); | |
| 70 | 2 | freopen("test_input.txt", "r", stdin); | |
| 71 | 2 | shell(env); | |
| 72 | ✗ | } | |
| 73 | |||
| 74 | 4 | Test(test7, full_gcorv) | |
| 75 | { | ||
| 76 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 77 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 78 | |||
| 79 | 2 | fprintf(file, "exit\n"); | |
| 80 | 2 | fclose(file); | |
| 81 | 2 | freopen("test_input.txt", "r", stdin); | |
| 82 | 2 | shell(env); | |
| 83 | ✗ | } | |
| 84 | |||
| 85 | 4 | Test(test8, full_gcorv) | |
| 86 | { | ||
| 87 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 88 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 89 | |||
| 90 | 2 | fprintf(file, "exit\n"); | |
| 91 | 2 | fclose(file); | |
| 92 | 2 | freopen("test_input.txt", "r", stdin); | |
| 93 | 2 | shell(env); | |
| 94 | ✗ | } | |
| 95 | |||
| 96 | 4 | Test(test9, full_gcorv) | |
| 97 | { | ||
| 98 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 99 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 100 | |||
| 101 | 2 | fprintf(file, "exit\n"); | |
| 102 | 2 | fclose(file); | |
| 103 | 2 | freopen("test_input.txt", "r", stdin); | |
| 104 | 2 | shell(env); | |
| 105 | ✗ | } | |
| 106 | |||
| 107 | 4 | Test(test10, full_gcorv) | |
| 108 | { | ||
| 109 | 2 | char **env = my_str_to_word_array_select("VAR1=VALEUR1 ; OLDPATH=$PATH ; PATH=/random", " ;"); | |
| 110 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 111 | |||
| 112 | 2 | fprintf(file, "setenv | /bin/grep VAR1\n"); | |
| 113 | 2 | fprintf(file, "/bin/ls | cd /usr\n"); | |
| 114 | 2 | fprintf(file, "ls -l\n"); | |
| 115 | 2 | fprintf(file, "exit 45|cat /etc/resolv.conf\n"); | |
| 116 | 2 | fprintf(file, "exit\n"); | |
| 117 | 2 | fclose(file); | |
| 118 | 2 | freopen("test_input.txt", "r", stdin); | |
| 119 | 2 | shell(env); | |
| 120 | ✗ | } | |
| 121 | |||
| 122 | 4 | Test(test11, full_gcorv) | |
| 123 | { | ||
| 124 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 125 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 126 | |||
| 127 | 2 | fprintf(file, "ls | cat | grep mysh\n"); | |
| 128 | 2 | fprintf(file, "fsdfsdf | ls\n"); | |
| 129 | 2 | fprintf(file, "exit\n"); | |
| 130 | 2 | fclose(file); | |
| 131 | 2 | freopen("test_input.txt", "r", stdin); | |
| 132 | 2 | shell(env); | |
| 133 | ✗ | } | |
| 134 | |||
| 135 | 4 | Test(test12, full_gcorv) | |
| 136 | { | ||
| 137 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 138 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 139 | |||
| 140 | 2 | fprintf(file, "ls | cat | grep dfsdfsdfsdfsdf\n"); | |
| 141 | 2 | fprintf(file, "exit\n"); | |
| 142 | 2 | fclose(file); | |
| 143 | 2 | freopen("test_input.txt", "r", stdin); | |
| 144 | 2 | shell(env); | |
| 145 | ✗ | } | |
| 146 | |||
| 147 | 4 | Test(test13, full_gcorv) | |
| 148 | { | ||
| 149 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 150 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 151 | |||
| 152 | 2 | fprintf(file, "ls > .testlolmdr\n"); | |
| 153 | 2 | fprintf(file, "echo bite\n"); | |
| 154 | 2 | fprintf(file, "/bin/grep mysh .testlolmdr >> .testlolmdr\n"); | |
| 155 | 2 | fprintf(file, "/bin/grep sh .testlolmdr >> .testlolmdr\n"); | |
| 156 | 2 | fprintf(file, "cat .testlolmdr\n"); | |
| 157 | 2 | fprintf(file, "rm .testlolmdr\n"); | |
| 158 | 2 | fprintf(file, "exit\n"); | |
| 159 | 2 | fclose(file); | |
| 160 | 2 | freopen("test_input.txt", "r", stdin); | |
| 161 | 2 | shell(env); | |
| 162 | ✗ | } | |
| 163 | |||
| 164 | 4 | Test(test14, full_gcorv) | |
| 165 | { | ||
| 166 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 167 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 168 | |||
| 169 | 2 | fprintf(file, "cat salut\n"); | |
| 170 | 2 | fprintf(file, "< salut wc -l\n"); | |
| 171 | 2 | fprintf(file, "wc <salut -l\n"); | |
| 172 | 2 | fprintf(file, "grep -i LO < salut\n"); | |
| 173 | 2 | fprintf(file, "grep -i LO < salut | wc -l\n"); | |
| 174 | 2 | fprintf(file, "exit\n"); | |
| 175 | 2 | fclose(file); | |
| 176 | 2 | freopen("test_input.txt", "r", stdin); | |
| 177 | 2 | shell(env); | |
| 178 | ✗ | } | |
| 179 | |||
| 180 | 4 | Test(test15, full_gcorv) | |
| 181 | { | ||
| 182 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 183 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 184 | |||
| 185 | 2 | fprintf(file, "cat < Makefile\n"); | |
| 186 | 2 | fprintf(file, "exit\n"); | |
| 187 | 2 | fclose(file); | |
| 188 | 2 | freopen("test_input.txt", "r", stdin); | |
| 189 | 2 | shell(env); | |
| 190 | ✗ | } | |
| 191 | |||
| 192 | 4 | Test(test16, full_gcorv) | |
| 193 | { | ||
| 194 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 195 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 196 | |||
| 197 | 2 | fprintf(file, "< Makefile cat|>.lol wc -l\n"); | |
| 198 | 2 | fprintf(file, "cat .lol\n"); | |
| 199 | 2 | fprintf(file, "rm .lol\n"); | |
| 200 | 2 | fprintf(file, "exit\n"); | |
| 201 | 2 | fclose(file); | |
| 202 | 2 | freopen("test_input.txt", "r", stdin); | |
| 203 | 2 | shell(env); | |
| 204 | ✗ | } | |
| 205 | |||
| 206 | 4 | Test(test17, full_gcorv) | |
| 207 | { | ||
| 208 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 209 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 210 | |||
| 211 | 2 | fprintf(file, "cat << a\n"); | |
| 212 | 2 | fprintf(file, "exit\n"); | |
| 213 | 2 | fclose(file); | |
| 214 | 2 | freopen("test_input.txt", "r", stdin); | |
| 215 | 2 | shell(env); | |
| 216 | ✗ | } | |
| 217 | |||
| 218 | 4 | Test(test18, full_gcorv) | |
| 219 | { | ||
| 220 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 221 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 222 | |||
| 223 | 2 | fprintf(file, "cat < Makefile > .lol\n"); | |
| 224 | 2 | fprintf(file, "cat .lol\n"); | |
| 225 | 2 | fprintf(file, "rm .lol\n"); | |
| 226 | 2 | fprintf(file, "exit\n"); | |
| 227 | 2 | fclose(file); | |
| 228 | 2 | freopen("test_input.txt", "r", stdin); | |
| 229 | 2 | shell(env); | |
| 230 | ✗ | } | |
| 231 | |||
| 232 | 4 | Test(test23, full_gcorv) | |
| 233 | { | ||
| 234 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 235 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 236 | |||
| 237 | 2 | fprintf(file, "ls | cat < Makefile > .lol\n"); | |
| 238 | 2 | fprintf(file, "exit\n"); | |
| 239 | 2 | fclose(file); | |
| 240 | 2 | freopen("test_input.txt", "r", stdin); | |
| 241 | 2 | shell(env); | |
| 242 | ✗ | } | |
| 243 | |||
| 244 | 4 | Test(test24, full_gcorv) | |
| 245 | { | ||
| 246 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 247 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 248 | |||
| 249 | 2 | fprintf(file, "ls | cat -e > .lol\n"); | |
| 250 | 2 | fprintf(file, "cat .lol\n"); | |
| 251 | 2 | fprintf(file, "rm .lol\n"); | |
| 252 | 2 | fprintf(file, "exit\n"); | |
| 253 | 2 | fclose(file); | |
| 254 | 2 | freopen("test_input.txt", "r", stdin); | |
| 255 | 2 | shell(env); | |
| 256 | ✗ | } | |
| 257 | |||
| 258 | 4 | Test(test27, full_gcorv) | |
| 259 | { | ||
| 260 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 261 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 262 | |||
| 263 | 2 | fprintf(file, "\n"); | |
| 264 | 2 | fprintf(file, "exit\n"); | |
| 265 | 2 | fclose(file); | |
| 266 | 2 | freopen("test_input.txt", "r", stdin); | |
| 267 | 2 | shell(env); | |
| 268 | ✗ | } | |
| 269 | |||
| 270 | 4 | Test(test28, full_gcorv) | |
| 271 | { | ||
| 272 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 273 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 274 | |||
| 275 | 2 | fprintf(file, "\"\"\n"); | |
| 276 | 2 | fprintf(file, "exit\n"); | |
| 277 | 2 | fclose(file); | |
| 278 | 2 | freopen("test_input.txt", "r", stdin); | |
| 279 | 2 | shell(env); | |
| 280 | ✗ | } | |
| 281 | |||
| 282 | 4 | Test(test29, full_gcorv) | |
| 283 | { | ||
| 284 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 285 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 286 | |||
| 287 | 2 | fprintf(file, "lol\n"); | |
| 288 | 2 | fprintf(file, "exit\n"); | |
| 289 | 2 | fclose(file); | |
| 290 | 2 | freopen("test_input.txt", "r", stdin); | |
| 291 | 2 | shell(env); | |
| 292 | ✗ | } | |
| 293 | |||
| 294 | 4 | Test(test30, full_gcorv) | |
| 295 | { | ||
| 296 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 297 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 298 | |||
| 299 | 2 | fprintf(file, "ls |\n"); | |
| 300 | 2 | fprintf(file, "exit\n"); | |
| 301 | 2 | fclose(file); | |
| 302 | 2 | freopen("test_input.txt", "r", stdin); | |
| 303 | 2 | shell(env); | |
| 304 | ✗ | } | |
| 305 | |||
| 306 | 4 | Test(test31, full_gcorv) | |
| 307 | { | ||
| 308 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 309 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 310 | |||
| 311 | 2 | fprintf(file, "| ;\n"); | |
| 312 | 2 | fprintf(file, "exit\n"); | |
| 313 | 2 | fclose(file); | |
| 314 | 2 | freopen("test_input.txt", "r", stdin); | |
| 315 | 2 | shell(env); | |
| 316 | ✗ | } | |
| 317 | |||
| 318 | 4 | Test(test32, full_gcorv) | |
| 319 | { | ||
| 320 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 321 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 322 | |||
| 323 | 2 | fprintf(file, "ls ||||| cat\n"); | |
| 324 | 2 | fprintf(file, "exit\n"); | |
| 325 | 2 | fclose(file); | |
| 326 | 2 | freopen("test_input.txt", "r", stdin); | |
| 327 | 2 | shell(env); | |
| 328 | ✗ | } | |
| 329 | |||
| 330 | 4 | Test(test33, full_gcorv) | |
| 331 | { | ||
| 332 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 333 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 334 | |||
| 335 | 2 | fprintf(file, "exit\n"); | |
| 336 | 2 | fclose(file); | |
| 337 | 2 | freopen("test_input.txt", "r", stdin); | |
| 338 | 2 | shell(env); | |
| 339 | ✗ | } | |
| 340 | |||
| 341 | 4 | Test(test34, full_gcorv) | |
| 342 | { | ||
| 343 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 344 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 345 | |||
| 346 | 2 | fprintf(file, "\n"); | |
| 347 | 2 | fprintf(file, "exit\n"); | |
| 348 | 2 | fclose(file); | |
| 349 | 2 | freopen("test_input.txt", "r", stdin); | |
| 350 | 2 | shell(env); | |
| 351 | ✗ | } | |
| 352 | |||
| 353 | 4 | Test(test35, full_gcorv) | |
| 354 | { | ||
| 355 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 356 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 357 | |||
| 358 | 2 | fprintf(file, "id\n"); | |
| 359 | 2 | fprintf(file, "exit\n"); | |
| 360 | 2 | fclose(file); | |
| 361 | 2 | freopen("test_input.txt", "r", stdin); | |
| 362 | 2 | shell(env); | |
| 363 | ✗ | } | |
| 364 | |||
| 365 | 4 | Test(test36, full_gcorv) | |
| 366 | { | ||
| 367 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 368 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 369 | |||
| 370 | 2 | fprintf(file, "ls\n"); | |
| 371 | 2 | fprintf(file, "pwd\n"); | |
| 372 | 2 | fprintf(file, "ls -l\n"); | |
| 373 | 2 | fprintf(file, "exit\n"); | |
| 374 | 2 | fclose(file); | |
| 375 | 2 | freopen("test_input.txt", "r", stdin); | |
| 376 | 2 | shell(env); | |
| 377 | ✗ | } | |
| 378 | |||
| 379 | 4 | Test(test37, full_gcorv) | |
| 380 | { | ||
| 381 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 382 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 383 | |||
| 384 | 2 | fprintf(file, "Sahel est con\n"); | |
| 385 | 2 | fprintf(file, "exit\n"); | |
| 386 | 2 | fclose(file); | |
| 387 | 2 | freopen("test_input.txt", "r", stdin); | |
| 388 | 2 | shell(env); | |
| 389 | ✗ | } | |
| 390 | |||
| 391 | 4 | Test(test38, full_gcorv) | |
| 392 | { | ||
| 393 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 394 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 395 | |||
| 396 | 2 | fprintf(file, "/ls\n"); | |
| 397 | 2 | fprintf(file, "exit\n"); | |
| 398 | 2 | fclose(file); | |
| 399 | 2 | freopen("test_input.txt", "r", stdin); | |
| 400 | 2 | shell(env); | |
| 401 | ✗ | } | |
| 402 | |||
| 403 | 4 | Test(test39, full_gcorv) | |
| 404 | { | ||
| 405 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 406 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 407 | |||
| 408 | 2 | fprintf(file, "/usr/bin/ls\n"); | |
| 409 | 2 | fprintf(file, "exit\n"); | |
| 410 | 2 | fclose(file); | |
| 411 | 2 | freopen("test_input.txt", "r", stdin); | |
| 412 | 2 | shell(env); | |
| 413 | ✗ | } | |
| 414 | |||
| 415 | 4 | Test(test40, full_gcorv) | |
| 416 | { | ||
| 417 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 418 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 419 | |||
| 420 | 2 | fprintf(file, "setenv PATH caca\n"); | |
| 421 | 2 | fprintf(file, "ls\n"); | |
| 422 | 2 | fprintf(file, "exit\n"); | |
| 423 | 2 | fclose(file); | |
| 424 | 2 | freopen("test_input.txt", "r", stdin); | |
| 425 | 2 | shell(env); | |
| 426 | ✗ | } | |
| 427 | |||
| 428 | 4 | Test(test41, full_gcorv) | |
| 429 | { | ||
| 430 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 431 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 432 | |||
| 433 | 2 | fprintf(file, "setenv PATH /usr/bin:\n"); | |
| 434 | 2 | fprintf(file, "ls\n"); | |
| 435 | 2 | fprintf(file, "exit\n"); | |
| 436 | 2 | fclose(file); | |
| 437 | 2 | freopen("test_input.txt", "r", stdin); | |
| 438 | 2 | shell(env); | |
| 439 | ✗ | } | |
| 440 | |||
| 441 | 4 | Test(test42, full_gcorv) | |
| 442 | { | ||
| 443 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 444 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 445 | |||
| 446 | 2 | fprintf(file, "setenv PATH /usr/bi\n"); | |
| 447 | 2 | fprintf(file, "ls\n"); | |
| 448 | 2 | fprintf(file, "exit\n"); | |
| 449 | 2 | fclose(file); | |
| 450 | 2 | freopen("test_input.txt", "r", stdin); | |
| 451 | 2 | shell(env); | |
| 452 | ✗ | } | |
| 453 | |||
| 454 | 4 | Test(test43, full_gcorv) | |
| 455 | { | ||
| 456 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 457 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 458 | |||
| 459 | 2 | fprintf(file, "setenv ok ok ok\n"); | |
| 460 | 2 | fprintf(file, "exit\n"); | |
| 461 | 2 | fclose(file); | |
| 462 | 2 | freopen("test_input.txt", "r", stdin); | |
| 463 | 2 | shell(env); | |
| 464 | ✗ | } | |
| 465 | |||
| 466 | 4 | Test(test44, full_gcorv) | |
| 467 | { | ||
| 468 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 469 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 470 | |||
| 471 | 2 | fprintf(file, "cd ..\n"); | |
| 472 | 2 | fprintf(file, "ls\n"); | |
| 473 | 2 | fprintf(file, "exit\n"); | |
| 474 | 2 | fclose(file); | |
| 475 | 2 | freopen("test_input.txt", "r", stdin); | |
| 476 | 2 | shell(env); | |
| 477 | ✗ | } | |
| 478 | |||
| 479 | 4 | Test(test45, full_gcorv) | |
| 480 | { | ||
| 481 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 482 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 483 | |||
| 484 | 2 | fprintf(file, "cd ok ok ok\n"); | |
| 485 | 2 | fprintf(file, "exit\n"); | |
| 486 | 2 | fclose(file); | |
| 487 | 2 | freopen("test_input.txt", "r", stdin); | |
| 488 | 2 | shell(env); | |
| 489 | ✗ | } | |
| 490 | |||
| 491 | 4 | Test(test46, full_gcorv) | |
| 492 | { | ||
| 493 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 494 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 495 | |||
| 496 | 2 | fprintf(file, "cd /root\n"); | |
| 497 | 2 | fprintf(file, "exit\n"); | |
| 498 | 2 | fclose(file); | |
| 499 | 2 | freopen("test_input.txt", "r", stdin); | |
| 500 | 2 | shell(env); | |
| 501 | ✗ | } | |
| 502 | |||
| 503 | 4 | Test(test47, full_gcorv) | |
| 504 | { | ||
| 505 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 506 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 507 | |||
| 508 | 2 | fprintf(file, "cd ..\n"); | |
| 509 | 2 | fprintf(file, "ls\n"); | |
| 510 | 2 | fprintf(file, "cd -\n"); | |
| 511 | 2 | fprintf(file, "ls\n"); | |
| 512 | 2 | fprintf(file, "exit\n"); | |
| 513 | 2 | fclose(file); | |
| 514 | 2 | freopen("test_input.txt", "r", stdin); | |
| 515 | 2 | shell(env); | |
| 516 | ✗ | } | |
| 517 | |||
| 518 | 4 | Test(test48, full_gcorv) | |
| 519 | { | ||
| 520 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 521 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 522 | |||
| 523 | 2 | fprintf(file, "env | grep XDG\n"); | |
| 524 | 2 | fprintf(file, "exit\n"); | |
| 525 | 2 | fclose(file); | |
| 526 | 2 | freopen("test_input.txt", "r", stdin); | |
| 527 | 2 | shell(env); | |
| 528 | ✗ | } | |
| 529 | |||
| 530 | 4 | Test(test49, full_gcorv) | |
| 531 | { | ||
| 532 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 533 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 534 | |||
| 535 | 2 | fprintf(file, "ls | cat -e | grep Ma\n"); | |
| 536 | 2 | fprintf(file, "exit\n"); | |
| 537 | 2 | fclose(file); | |
| 538 | 2 | freopen("test_input.txt", "r", stdin); | |
| 539 | 2 | shell(env); | |
| 540 | ✗ | } | |
| 541 | |||
| 542 | 4 | Test(test50, full_gcorv) | |
| 543 | { | ||
| 544 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 545 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 546 | |||
| 547 | 2 | fprintf(file, "ls >\n"); | |
| 548 | 2 | fprintf(file, "exit\n"); | |
| 549 | 2 | fclose(file); | |
| 550 | 2 | freopen("test_input.txt", "r", stdin); | |
| 551 | 2 | shell(env); | |
| 552 | ✗ | } | |
| 553 | |||
| 554 | 4 | Test(test51, full_gcorv) | |
| 555 | { | ||
| 556 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 557 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 558 | |||
| 559 | 2 | fprintf(file, "ls >> out; ls | ls |ls | ls ; ls\n"); | |
| 560 | 2 | fprintf(file, "rm out\n"); | |
| 561 | 2 | fprintf(file, "exit\n"); | |
| 562 | 2 | fclose(file); | |
| 563 | 2 | freopen("test_input.txt", "r", stdin); | |
| 564 | 2 | shell(env); | |
| 565 | ✗ | } | |
| 566 | |||
| 567 | 4 | Test(test52, full_gcorv) | |
| 568 | { | ||
| 569 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 570 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 571 | |||
| 572 | 2 | fprintf(file, "unsetenv OLDPWD\n"); | |
| 573 | 2 | fprintf(file, "cd\n"); | |
| 574 | 2 | fprintf(file, "cd -\n"); | |
| 575 | 2 | fprintf(file, "ls\n"); | |
| 576 | 2 | fprintf(file, "exit\n"); | |
| 577 | 2 | fclose(file); | |
| 578 | 2 | freopen("test_input.txt", "r", stdin); | |
| 579 | 2 | shell(env); | |
| 580 | ✗ | } | |
| 581 | |||
| 582 | 4 | Test(test53, full_gcorv) | |
| 583 | { | ||
| 584 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 585 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 586 | |||
| 587 | 2 | fprintf(file, "ls | ;\n"); | |
| 588 | 2 | fprintf(file, "exit\n"); | |
| 589 | 2 | fclose(file); | |
| 590 | 2 | freopen("test_input.txt", "r", stdin); | |
| 591 | 2 | shell(env); | |
| 592 | ✗ | } | |
| 593 | |||
| 594 | 4 | Test(test54, full_gcorv) | |
| 595 | { | ||
| 596 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 597 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 598 | |||
| 599 | 2 | fprintf(file, "ls | ls > ;\n"); | |
| 600 | 2 | fprintf(file, "exit\n"); | |
| 601 | 2 | fclose(file); | |
| 602 | 2 | freopen("test_input.txt", "r", stdin); | |
| 603 | 2 | shell(env); | |
| 604 | ✗ | } | |
| 605 | |||
| 606 | 4 | Test(test55, full_gcorv) | |
| 607 | { | ||
| 608 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 609 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 610 | |||
| 611 | 2 | fprintf(file, "ls ; ls > out\n"); | |
| 612 | 2 | fprintf(file, "rm out\n"); | |
| 613 | 2 | fprintf(file, "exit\n"); | |
| 614 | 2 | fclose(file); | |
| 615 | 2 | freopen("test_input.txt", "r", stdin); | |
| 616 | 2 | shell(env); | |
| 617 | ✗ | } | |
| 618 | |||
| 619 | 4 | Test(test56, full_gcorv) | |
| 620 | { | ||
| 621 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 622 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 623 | |||
| 624 | 2 | fprintf(file, ";ls>out\n"); | |
| 625 | 2 | fprintf(file, "rm out\n"); | |
| 626 | 2 | fprintf(file, "exit\n"); | |
| 627 | 2 | fclose(file); | |
| 628 | 2 | freopen("test_input.txt", "r", stdin); | |
| 629 | 2 | shell(env); | |
| 630 | ✗ | } | |
| 631 | |||
| 632 | 4 | Test(test59, full_gcorv) | |
| 633 | { | ||
| 634 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 635 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 636 | |||
| 637 | 2 | fprintf(file, "ls ; ; ; \n"); | |
| 638 | 2 | fprintf(file, "exit\n"); | |
| 639 | 2 | fclose(file); | |
| 640 | 2 | freopen("test_input.txt", "r", stdin); | |
| 641 | 2 | shell(env); | |
| 642 | ✗ | } | |
| 643 | |||
| 644 | 4 | Test(test60, full_gcorv) | |
| 645 | { | ||
| 646 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 647 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 648 | |||
| 649 | 2 | fprintf(file, "ls ; ; ; | ls\n"); | |
| 650 | 2 | fprintf(file, "exit\n"); | |
| 651 | 2 | fclose(file); | |
| 652 | 2 | freopen("test_input.txt", "r", stdin); | |
| 653 | 2 | shell(env); | |
| 654 | ✗ | } | |
| 655 | |||
| 656 | 4 | Test(test61, full_gcorv) | |
| 657 | { | ||
| 658 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 659 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 660 | |||
| 661 | 2 | fprintf(file, "ls | > z\n"); | |
| 662 | 2 | fprintf(file, "exit\n"); | |
| 663 | 2 | fclose(file); | |
| 664 | 2 | freopen("test_input.txt", "r", stdin); | |
| 665 | 2 | shell(env); | |
| 666 | ✗ | } | |
| 667 | |||
| 668 | 4 | Test(test62, full_gcorv) | |
| 669 | { | ||
| 670 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 671 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 672 | |||
| 673 | 2 | fprintf(file, "sdf > a\n"); | |
| 674 | 2 | fprintf(file, "ls\n"); | |
| 675 | 2 | fprintf(file, "rm a\n"); | |
| 676 | 2 | fprintf(file, "exit\n"); | |
| 677 | 2 | fclose(file); | |
| 678 | 2 | freopen("test_input.txt", "r", stdin); | |
| 679 | 2 | shell(env); | |
| 680 | ✗ | } | |
| 681 | |||
| 682 | 4 | Test(test63, full_gcorv) | |
| 683 | { | ||
| 684 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 685 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 686 | |||
| 687 | 2 | fprintf(file, "cat -e << a | grep b\n"); | |
| 688 | 2 | fprintf(file, "zert\n"); | |
| 689 | 2 | fprintf(file, "zea\n"); | |
| 690 | 2 | fprintf(file, "b\n"); | |
| 691 | 2 | fprintf(file, "a\n"); | |
| 692 | 2 | fprintf(file, "exit\n"); | |
| 693 | 2 | fclose(file); | |
| 694 | 2 | freopen("test_input.txt", "r", stdin); | |
| 695 | 2 | shell(env); | |
| 696 | ✗ | } | |
| 697 | |||
| 698 | 4 | Test(test64, full_gcorv) | |
| 699 | { | ||
| 700 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 701 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 702 | |||
| 703 | 2 | fprintf(file, " \n"); | |
| 704 | 2 | fprintf(file, "exit\n"); | |
| 705 | 2 | fclose(file); | |
| 706 | 2 | freopen("test_input.txt", "r", stdin); | |
| 707 | 2 | shell(env); | |
| 708 | ✗ | } | |
| 709 | |||
| 710 | 4 | Test(test65, full_gcorv) | |
| 711 | { | ||
| 712 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 713 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 714 | |||
| 715 | 2 | fprintf(file, "exit\n"); | |
| 716 | 2 | fclose(file); | |
| 717 | 2 | freopen("test_input.txt", "r", stdin); | |
| 718 | 2 | shell(env); | |
| 719 | ✗ | } | |
| 720 | |||
| 721 | 4 | Test(test66, full_gcorv) | |
| 722 | { | ||
| 723 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 724 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 725 | |||
| 726 | 2 | fprintf(file, "exit\n"); | |
| 727 | 2 | fclose(file); | |
| 728 | 2 | freopen("test_input.txt", "r", stdin); | |
| 729 | 2 | shell(env); | |
| 730 | ✗ | } | |
| 731 | |||
| 732 | 4 | Test(test67, full_gcorv) | |
| 733 | { | ||
| 734 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 735 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 736 | |||
| 737 | 2 | fprintf(file, "exit\n"); | |
| 738 | 2 | fclose(file); | |
| 739 | 2 | freopen("test_input.txt", "r", stdin); | |
| 740 | 2 | shell(env); | |
| 741 | ✗ | } | |
| 742 | |||
| 743 | 4 | Test(test68, full_gcorv) | |
| 744 | { | ||
| 745 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 746 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 747 | |||
| 748 | 2 | fprintf(file, ";;;;\n"); | |
| 749 | 2 | fprintf(file, "exit\n"); | |
| 750 | 2 | fclose(file); | |
| 751 | 2 | freopen("test_input.txt", "r", stdin); | |
| 752 | 2 | shell(env); | |
| 753 | ✗ | } | |
| 754 | |||
| 755 | 4 | Test(test69, full_gcorv) | |
| 756 | { | ||
| 757 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 758 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 759 | |||
| 760 | 2 | fprintf(file, "||||\n"); | |
| 761 | 2 | fprintf(file, "exit\n"); | |
| 762 | 2 | fclose(file); | |
| 763 | 2 | freopen("test_input.txt", "r", stdin); | |
| 764 | 2 | shell(env); | |
| 765 | ✗ | } | |
| 766 | |||
| 767 | 4 | Test(test70, full_gcorv) | |
| 768 | { | ||
| 769 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 770 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 771 | |||
| 772 | 2 | fprintf(file, "exit\n"); | |
| 773 | 2 | fclose(file); | |
| 774 | 2 | freopen("test_input.txt", "r", stdin); | |
| 775 | 2 | shell(env); | |
| 776 | ✗ | } | |
| 777 | |||
| 778 | 4 | Test(test71, full_gcorv) | |
| 779 | { | ||
| 780 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 781 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 782 | |||
| 783 | 2 | fprintf(file, "exit\n"); | |
| 784 | 2 | fclose(file); | |
| 785 | 2 | freopen("test_input.txt", "r", stdin); | |
| 786 | 2 | shell(env); | |
| 787 | ✗ | } | |
| 788 | |||
| 789 | 4 | Test(test72, full_gcorv) | |
| 790 | { | ||
| 791 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 792 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 793 | |||
| 794 | 2 | fprintf(file, "id\n"); | |
| 795 | 2 | fprintf(file, "exit\n"); | |
| 796 | 2 | fclose(file); | |
| 797 | 2 | freopen("test_input.txt", "r", stdin); | |
| 798 | 2 | shell(env); | |
| 799 | ✗ | } | |
| 800 | |||
| 801 | 4 | Test(test73, full_gcorv) | |
| 802 | { | ||
| 803 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 804 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 805 | |||
| 806 | 2 | fprintf(file, "cat Makefile > .toto\n"); | |
| 807 | 2 | fprintf(file, "cat -e << a >> .toto\n"); | |
| 808 | 2 | fprintf(file, "OLALA\n"); | |
| 809 | 2 | fprintf(file, "Really\n"); | |
| 810 | 2 | fprintf(file, "a\n"); | |
| 811 | 2 | fprintf(file, "cat .toto\n"); | |
| 812 | 2 | fprintf(file, "exit\n"); | |
| 813 | 2 | fclose(file); | |
| 814 | 2 | freopen("test_input.txt", "r", stdin); | |
| 815 | 2 | shell(env); | |
| 816 | ✗ | } | |
| 817 | |||
| 818 | 4 | Test(test74, full_gcorv) | |
| 819 | { | ||
| 820 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 821 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 822 | |||
| 823 | 2 | fprintf(file, " ; ; ; ; \n"); | |
| 824 | 2 | fprintf(file, "exit\n"); | |
| 825 | 2 | fclose(file); | |
| 826 | 2 | freopen("test_input.txt", "r", stdin); | |
| 827 | 2 | shell(env); | |
| 828 | ✗ | } | |
| 829 | |||
| 830 | 4 | Test(test75, full_gcorv) | |
| 831 | { | ||
| 832 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 833 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 834 | |||
| 835 | 2 | fprintf(file, " | | | | \n"); | |
| 836 | 2 | fprintf(file, "exit\n"); | |
| 837 | 2 | fclose(file); | |
| 838 | 2 | freopen("test_input.txt", "r", stdin); | |
| 839 | 2 | shell(env); | |
| 840 | ✗ | } | |
| 841 | |||
| 842 | 4 | Test(test76, full_gcorv) | |
| 843 | { | ||
| 844 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 845 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 846 | |||
| 847 | 2 | fprintf(file, "exit\n"); | |
| 848 | 2 | fclose(file); | |
| 849 | 2 | freopen("test_input.txt", "r", stdin); | |
| 850 | 2 | shell(env); | |
| 851 | ✗ | } | |
| 852 | |||
| 853 | 4 | Test(test77, full_gcorv) | |
| 854 | { | ||
| 855 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 856 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 857 | |||
| 858 | 2 | fprintf(file, "exit\n"); | |
| 859 | 2 | fclose(file); | |
| 860 | 2 | freopen("test_input.txt", "r", stdin); | |
| 861 | 2 | shell(env); | |
| 862 | ✗ | } | |
| 863 | |||
| 864 | 4 | Test(test78, full_gcorv) | |
| 865 | { | ||
| 866 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 867 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 868 | |||
| 869 | 2 | fprintf(file, "ls | cat -e < Makefile\n"); | |
| 870 | 2 | fprintf(file, "exit\n"); | |
| 871 | 2 | fclose(file); | |
| 872 | 2 | freopen("test_input.txt", "r", stdin); | |
| 873 | 2 | shell(env); | |
| 874 | ✗ | } | |
| 875 | |||
| 876 | 4 | Test(test79, full_gcorv) | |
| 877 | { | ||
| 878 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 879 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 880 | |||
| 881 | 2 | fprintf(file, "unsetenv SHLVL\n"); | |
| 882 | 2 | fprintf(file, "unsetenv HOST\n"); | |
| 883 | 2 | fprintf(file, "unsetenv _\n"); | |
| 884 | 2 | fprintf(file, "unsetenv HOSTTYPE\n"); | |
| 885 | 2 | fprintf(file, "unsetenv VENDOR\n"); | |
| 886 | 2 | fprintf(file, "unsetenv OSTYPE\n"); | |
| 887 | 2 | fprintf(file, "unsetenv MACHTYPE\n"); | |
| 888 | 2 | fprintf(file, "unsetenv GROUP\n"); | |
| 889 | 2 | fprintf(file, "setenv\n"); | |
| 890 | 2 | fprintf(file, "exit\n"); | |
| 891 | 2 | fclose(file); | |
| 892 | 2 | freopen("test_input.txt", "r", stdin); | |
| 893 | 2 | shell(env); | |
| 894 | ✗ | } | |
| 895 | |||
| 896 | 4 | Test(test80, full_gcorv) | |
| 897 | { | ||
| 898 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 899 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 900 | |||
| 901 | 2 | fprintf(file, "unsetenv SHLVL\n"); | |
| 902 | 2 | fprintf(file, "unsetenv HOST\n"); | |
| 903 | 2 | fprintf(file, "unsetenv _\n"); | |
| 904 | 2 | fprintf(file, "unsetenv HOSTTYPE\n"); | |
| 905 | 2 | fprintf(file, "unsetenv VENDOR\n"); | |
| 906 | 2 | fprintf(file, "unsetenv OSTYPE\n"); | |
| 907 | 2 | fprintf(file, "unsetenv MACHTYPE\n"); | |
| 908 | 2 | fprintf(file, "unsetenv GROUP\n"); | |
| 909 | 2 | fprintf(file, "setenv PATH\n"); | |
| 910 | 2 | fprintf(file, "setenv PATH lol\n"); | |
| 911 | 2 | fprintf(file, "setenv PATH caca\n"); | |
| 912 | 2 | fprintf(file, "setenv PATH ls\n"); | |
| 913 | 2 | fprintf(file, "setenv\n"); | |
| 914 | 2 | fprintf(file, "ls\n"); | |
| 915 | 2 | fprintf(file, "exit\n"); | |
| 916 | 2 | fclose(file); | |
| 917 | 2 | freopen("test_input.txt", "r", stdin); | |
| 918 | 2 | shell(env); | |
| 919 | ✗ | } | |
| 920 | |||
| 921 | 4 | Test(test81, full_gcorv) | |
| 922 | { | ||
| 923 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 924 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 925 | |||
| 926 | 2 | fprintf(file, "./42sh\n"); | |
| 927 | 2 | fprintf(file, "ls\n"); | |
| 928 | 2 | fprintf(file, "ls\n"); | |
| 929 | 2 | fprintf(file, "exit\n"); | |
| 930 | 2 | fclose(file); | |
| 931 | 2 | freopen("test_input.txt", "r", stdin); | |
| 932 | 2 | shell(env); | |
| 933 | ✗ | } | |
| 934 | |||
| 935 | 4 | Test(test82, full_gcorv) | |
| 936 | { | ||
| 937 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 938 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 939 | |||
| 940 | 2 | fprintf(file, "sdf sdf sdf\n"); | |
| 941 | 2 | fprintf(file, "exit\n"); | |
| 942 | 2 | fclose(file); | |
| 943 | 2 | freopen("test_input.txt", "r", stdin); | |
| 944 | 2 | shell(env); | |
| 945 | ✗ | } | |
| 946 | |||
| 947 | 4 | Test(test83, full_gcorv) | |
| 948 | { | ||
| 949 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 950 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 951 | |||
| 952 | 2 | fprintf(file, "cat Makefile > ..\n"); | |
| 953 | 2 | fprintf(file, "exit\n"); | |
| 954 | 2 | fclose(file); | |
| 955 | 2 | freopen("test_input.txt", "r", stdin); | |
| 956 | 2 | shell(env); | |
| 957 | ✗ | } | |
| 958 | |||
| 959 | 4 | Test(test84, full_gcorv) | |
| 960 | { | ||
| 961 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 962 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 963 | |||
| 964 | 2 | fprintf(file, "rm -rf .sdfsdf\n"); | |
| 965 | 2 | fprintf(file, "cat < .sdfsdf\n"); | |
| 966 | 2 | fprintf(file, "exit\n"); | |
| 967 | 2 | fclose(file); | |
| 968 | 2 | freopen("test_input.txt", "r", stdin); | |
| 969 | 2 | shell(env); | |
| 970 | ✗ | } | |
| 971 | |||
| 972 | 4 | Test(test85, full_gcorv) | |
| 973 | { | ||
| 974 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 975 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 976 | |||
| 977 | 2 | fprintf(file, "cat Makefile | grep b | grep i\n"); | |
| 978 | 2 | fprintf(file, "exit\n"); | |
| 979 | 2 | fclose(file); | |
| 980 | 2 | freopen("test_input.txt", "r", stdin); | |
| 981 | 2 | shell(env); | |
| 982 | ✗ | } | |
| 983 | |||
| 984 | 4 | Test(test86, full_gcorv) | |
| 985 | { | ||
| 986 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 987 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 988 | |||
| 989 | 2 | fprintf(file, "setenv =\n"); | |
| 990 | 2 | fprintf(file, "exit\n"); | |
| 991 | 2 | fclose(file); | |
| 992 | 2 | freopen("test_input.txt", "r", stdin); | |
| 993 | 2 | shell(env); | |
| 994 | ✗ | } | |
| 995 | |||
| 996 | 4 | Test(test87, full_gcorv) | |
| 997 | { | ||
| 998 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 999 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1000 | |||
| 1001 | 2 | fprintf(file, "setenv ae%9\n"); | |
| 1002 | 2 | fprintf(file, "exit\n"); | |
| 1003 | 2 | fclose(file); | |
| 1004 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1005 | 2 | shell(env); | |
| 1006 | ✗ | } | |
| 1007 | |||
| 1008 | 4 | Test(test88, full_gcorv) | |
| 1009 | { | ||
| 1010 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1011 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1012 | |||
| 1013 | 2 | fprintf(file, "./Makefile\n"); | |
| 1014 | 2 | fprintf(file, "exit\n"); | |
| 1015 | 2 | fclose(file); | |
| 1016 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1017 | 2 | shell(env); | |
| 1018 | ✗ | } | |
| 1019 | |||
| 1020 | 4 | Test(test89, full_gcorv) | |
| 1021 | { | ||
| 1022 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1023 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1024 | |||
| 1025 | 2 | fprintf(file, "./include\n"); | |
| 1026 | 2 | fprintf(file, "exit\n"); | |
| 1027 | 2 | fclose(file); | |
| 1028 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1029 | 2 | shell(env); | |
| 1030 | ✗ | } | |
| 1031 | |||
| 1032 | 4 | Test(test90, full_gcorv) | |
| 1033 | { | ||
| 1034 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1035 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1036 | |||
| 1037 | 2 | fprintf(file, "enve\n"); | |
| 1038 | 2 | fprintf(file, "exit\n"); | |
| 1039 | 2 | fclose(file); | |
| 1040 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1041 | 2 | shell(env); | |
| 1042 | ✗ | } | |
| 1043 | |||
| 1044 | 4 | Test(test91, full_gcorv) | |
| 1045 | { | ||
| 1046 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1047 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1048 | |||
| 1049 | 2 | fprintf(file, "cdenve -\n"); | |
| 1050 | 2 | fprintf(file, "exit\n"); | |
| 1051 | 2 | fclose(file); | |
| 1052 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1053 | 2 | shell(env); | |
| 1054 | ✗ | } | |
| 1055 | |||
| 1056 | 4 | Test(test92, full_gcorv) | |
| 1057 | { | ||
| 1058 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1059 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1060 | |||
| 1061 | 2 | fprintf(file, " ls \n"); | |
| 1062 | 2 | fprintf(file, "exit\n"); | |
| 1063 | 2 | fclose(file); | |
| 1064 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1065 | 2 | shell(env); | |
| 1066 | ✗ | } | |
| 1067 | |||
| 1068 | 4 | Test(test93, full_gcorv) | |
| 1069 | { | ||
| 1070 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1071 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1072 | |||
| 1073 | 2 | fprintf(file, "/ls\n"); | |
| 1074 | 2 | fprintf(file, "exit\n"); | |
| 1075 | 2 | fclose(file); | |
| 1076 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1077 | 2 | shell(env); | |
| 1078 | ✗ | } | |
| 1079 | |||
| 1080 | 4 | Test(test94, full_gcorv) | |
| 1081 | { | ||
| 1082 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1083 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1084 | |||
| 1085 | 2 | fprintf(file, "cat -e < olala | grep b\n"); | |
| 1086 | 2 | fprintf(file, "exit\n"); | |
| 1087 | 2 | fclose(file); | |
| 1088 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1089 | 2 | shell(env); | |
| 1090 | ✗ | } | |
| 1091 | |||
| 1092 | 4 | Test(test95, full_gcorv) | |
| 1093 | { | ||
| 1094 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1095 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1096 | |||
| 1097 | 2 | fprintf(file, "cd .. | ls\n"); | |
| 1098 | 2 | fprintf(file, "exit\n"); | |
| 1099 | 2 | fclose(file); | |
| 1100 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1101 | 2 | shell(env); | |
| 1102 | ✗ | } | |
| 1103 | |||
| 1104 | 4 | Test(test96, full_gcorv) | |
| 1105 | { | ||
| 1106 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1107 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1108 | |||
| 1109 | 2 | fprintf(file, "env | grep PATH\n"); | |
| 1110 | 2 | fprintf(file, "exit\n"); | |
| 1111 | 2 | fclose(file); | |
| 1112 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1113 | 2 | shell(env); | |
| 1114 | ✗ | } | |
| 1115 | |||
| 1116 | 4 | Test(test97, full_gcorv) | |
| 1117 | { | ||
| 1118 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1119 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1120 | |||
| 1121 | 2 | fprintf(file, "< zert cat\n"); | |
| 1122 | 2 | fprintf(file, "exit\n"); | |
| 1123 | 2 | fclose(file); | |
| 1124 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1125 | 2 | shell(env); | |
| 1126 | ✗ | } | |
| 1127 | |||
| 1128 | 4 | Test(test98, full_gcorv) | |
| 1129 | { | ||
| 1130 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1131 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1132 | |||
| 1133 | 2 | fprintf(file, "< Makefile cat -e\n"); | |
| 1134 | 2 | fprintf(file, "exit\n"); | |
| 1135 | 2 | fclose(file); | |
| 1136 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1137 | 2 | shell(env); | |
| 1138 | ✗ | } | |
| 1139 | |||
| 1140 | 4 | Test(test99, full_gcorv) | |
| 1141 | { | ||
| 1142 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1143 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1144 | |||
| 1145 | 2 | fprintf(file, "< Makefile cat >> .lol -e\n"); | |
| 1146 | 2 | fprintf(file, "exit\n"); | |
| 1147 | 2 | fclose(file); | |
| 1148 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1149 | 2 | shell(env); | |
| 1150 | ✗ | } | |
| 1151 | |||
| 1152 | 4 | Test(test100, full_gcorv) | |
| 1153 | { | ||
| 1154 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1155 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1156 | |||
| 1157 | 2 | fprintf(file, "THE END | GG\n"); | |
| 1158 | 2 | fprintf(file, "exit\n"); | |
| 1159 | 2 | fclose(file); | |
| 1160 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1161 | 2 | shell(env); | |
| 1162 | ✗ | } | |
| 1163 | |||
| 1164 | 4 | Test(test101, full_gcorv) | |
| 1165 | { | ||
| 1166 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1167 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1168 | |||
| 1169 | 2 | fprintf(file, "42sh\n"); | |
| 1170 | 2 | fprintf(file, "ls\n"); | |
| 1171 | 2 | fprintf(file, "exit\n"); | |
| 1172 | 2 | fclose(file); | |
| 1173 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1174 | 2 | shell(env); | |
| 1175 | ✗ | } | |
| 1176 | |||
| 1177 | 4 | Test(test102, full_gcorv) | |
| 1178 | { | ||
| 1179 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1180 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1181 | |||
| 1182 | 2 | fprintf(file, "ls\n"); | |
| 1183 | 2 | fprintf(file, "exit\n"); | |
| 1184 | 2 | fclose(file); | |
| 1185 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1186 | 2 | shell(env); | |
| 1187 | ✗ | } | |
| 1188 | |||
| 1189 | 4 | Test(test103, full_gcorv) | |
| 1190 | { | ||
| 1191 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1192 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1193 | |||
| 1194 | 2 | fprintf(file, "where ls\n"); | |
| 1195 | 2 | fprintf(file, "exit\n"); | |
| 1196 | 2 | fclose(file); | |
| 1197 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1198 | 2 | shell(env); | |
| 1199 | ✗ | } | |
| 1200 | |||
| 1201 | 4 | Test(test104, full_gcorv) | |
| 1202 | { | ||
| 1203 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1204 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1205 | |||
| 1206 | 2 | fprintf(file, "where ls grep ls\n"); | |
| 1207 | 2 | fprintf(file, "exit\n"); | |
| 1208 | 2 | fclose(file); | |
| 1209 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1210 | 2 | shell(env); | |
| 1211 | ✗ | } | |
| 1212 | |||
| 1213 | 4 | Test(test105, full_gcorv) | |
| 1214 | { | ||
| 1215 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1216 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1217 | |||
| 1218 | 2 | fprintf(file, "where sdf ls grep sdf\n"); | |
| 1219 | 2 | fprintf(file, "exit\n"); | |
| 1220 | 2 | fclose(file); | |
| 1221 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1222 | 2 | shell(env); | |
| 1223 | ✗ | } | |
| 1224 | |||
| 1225 | 4 | Test(test106, full_gcorv) | |
| 1226 | { | ||
| 1227 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1228 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1229 | |||
| 1230 | 2 | fprintf(file, "where sdf\n"); | |
| 1231 | 2 | fprintf(file, "exit\n"); | |
| 1232 | 2 | fclose(file); | |
| 1233 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1234 | 2 | shell(env); | |
| 1235 | ✗ | } | |
| 1236 | |||
| 1237 | 4 | Test(test107, full_gcorv) | |
| 1238 | { | ||
| 1239 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1240 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1241 | |||
| 1242 | 2 | fprintf(file, "alias ls ls -l\n"); | |
| 1243 | 2 | fprintf(file, "ls\n"); | |
| 1244 | 2 | fprintf(file, "exit\n"); | |
| 1245 | 2 | fclose(file); | |
| 1246 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1247 | 2 | shell(env); | |
| 1248 | ✗ | } | |
| 1249 | |||
| 1250 | 4 | Test(test108, full_gcorv) | |
| 1251 | { | ||
| 1252 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1253 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1254 | |||
| 1255 | 2 | fprintf(file, "alias a ls\n"); | |
| 1256 | 2 | fprintf(file, "a\n"); | |
| 1257 | 2 | fprintf(file, "exit\n"); | |
| 1258 | 2 | fclose(file); | |
| 1259 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1260 | 2 | shell(env); | |
| 1261 | ✗ | } | |
| 1262 | |||
| 1263 | 4 | Test(test109, full_gcorv) | |
| 1264 | { | ||
| 1265 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1266 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1267 | |||
| 1268 | 2 | fprintf(file, "alias ls ll\n"); | |
| 1269 | 2 | fprintf(file, "ls\n"); | |
| 1270 | 2 | fprintf(file, "exit\n"); | |
| 1271 | 2 | fclose(file); | |
| 1272 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1273 | 2 | shell(env); | |
| 1274 | ✗ | } | |
| 1275 | |||
| 1276 | 4 | Test(test110, full_gcorv) | |
| 1277 | { | ||
| 1278 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1279 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1280 | |||
| 1281 | 2 | fprintf(file, "repeat 4 ls\n"); | |
| 1282 | 2 | fprintf(file, "exit\n"); | |
| 1283 | 2 | fclose(file); | |
| 1284 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1285 | 2 | shell(env); | |
| 1286 | ✗ | } | |
| 1287 | |||
| 1288 | 4 | Test(test111, full_gcorv) | |
| 1289 | { | ||
| 1290 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1291 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1292 | |||
| 1293 | 2 | fprintf(file, "repeat 4e ls\n"); | |
| 1294 | 2 | fprintf(file, "exit\n"); | |
| 1295 | 2 | fclose(file); | |
| 1296 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1297 | 2 | shell(env); | |
| 1298 | ✗ | } | |
| 1299 | |||
| 1300 | 4 | Test(test112, full_gcorv) | |
| 1301 | { | ||
| 1302 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1303 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1304 | |||
| 1305 | 2 | fprintf(file, "repeat 2 sdf\n"); | |
| 1306 | 2 | fprintf(file, "exit\n"); | |
| 1307 | 2 | fclose(file); | |
| 1308 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1309 | 2 | shell(env); | |
| 1310 | ✗ | } | |
| 1311 | |||
| 1312 | 4 | Test(test113, full_gcorv) | |
| 1313 | { | ||
| 1314 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1315 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1316 | |||
| 1317 | 2 | fprintf(file, "exit\n"); | |
| 1318 | 2 | fclose(file); | |
| 1319 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1320 | 2 | shell(env); | |
| 1321 | ✗ | } | |
| 1322 | |||
| 1323 | 4 | Test(test114, full_gcorv) | |
| 1324 | { | ||
| 1325 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1326 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1327 | |||
| 1328 | 2 | fprintf(file, "exit\n"); | |
| 1329 | 2 | fclose(file); | |
| 1330 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1331 | 2 | shell(env); | |
| 1332 | ✗ | } | |
| 1333 | |||
| 1334 | 4 | Test(test115, full_gcorv) | |
| 1335 | { | ||
| 1336 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1337 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1338 | |||
| 1339 | 2 | fprintf(file, "exit\n"); | |
| 1340 | 2 | fclose(file); | |
| 1341 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1342 | 2 | shell(env); | |
| 1343 | ✗ | } | |
| 1344 | |||
| 1345 | 4 | Test(test116, full_gcorv) | |
| 1346 | { | ||
| 1347 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1348 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1349 | |||
| 1350 | 2 | fprintf(file, "exit\n"); | |
| 1351 | 2 | fclose(file); | |
| 1352 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1353 | 2 | shell(env); | |
| 1354 | ✗ | } | |
| 1355 | |||
| 1356 | 4 | Test(test117, full_gcorv) | |
| 1357 | { | ||
| 1358 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1359 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1360 | |||
| 1361 | 2 | fprintf(file, "exit\n"); | |
| 1362 | 2 | fclose(file); | |
| 1363 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1364 | 2 | shell(env); | |
| 1365 | ✗ | } | |
| 1366 | |||
| 1367 | 4 | Test(test118, full_gcorv) | |
| 1368 | { | ||
| 1369 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1370 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1371 | |||
| 1372 | 2 | fprintf(file, "exit\n"); | |
| 1373 | 2 | fclose(file); | |
| 1374 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1375 | 2 | shell(env); | |
| 1376 | ✗ | } | |
| 1377 | |||
| 1378 | 4 | Test(test119, full_gcorv) | |
| 1379 | { | ||
| 1380 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1381 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1382 | |||
| 1383 | 2 | fprintf(file, "exit\n"); | |
| 1384 | 2 | fclose(file); | |
| 1385 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1386 | 2 | shell(env); | |
| 1387 | ✗ | } | |
| 1388 | |||
| 1389 | 4 | Test(test120, full_gcorv) | |
| 1390 | { | ||
| 1391 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1392 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1393 | |||
| 1394 | 2 | fprintf(file, "exit\n"); | |
| 1395 | 2 | fclose(file); | |
| 1396 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1397 | 2 | shell(env); | |
| 1398 | ✗ | } | |
| 1399 | |||
| 1400 | 4 | Test(test122, full_gcorv) | |
| 1401 | { | ||
| 1402 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1403 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1404 | |||
| 1405 | 2 | fprintf(file, "exit\n"); | |
| 1406 | 2 | fclose(file); | |
| 1407 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1408 | 2 | shell(env); | |
| 1409 | ✗ | } | |
| 1410 | |||
| 1411 | 4 | Test(test123, full_gcorv) | |
| 1412 | { | ||
| 1413 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1414 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1415 | |||
| 1416 | 2 | fprintf(file, "exit\n"); | |
| 1417 | 2 | fclose(file); | |
| 1418 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1419 | 2 | shell(env); | |
| 1420 | ✗ | } | |
| 1421 | |||
| 1422 | 4 | Test(test124, full_gcorv) | |
| 1423 | { | ||
| 1424 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1425 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1426 | |||
| 1427 | 2 | fprintf(file, "exit\n"); | |
| 1428 | 2 | fclose(file); | |
| 1429 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1430 | 2 | shell(env); | |
| 1431 | ✗ | } | |
| 1432 | |||
| 1433 | 4 | Test(test125, full_gcorv) | |
| 1434 | { | ||
| 1435 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1436 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1437 | |||
| 1438 | 2 | fprintf(file, "exit\n"); | |
| 1439 | 2 | fclose(file); | |
| 1440 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1441 | 2 | shell(env); | |
| 1442 | ✗ | } | |
| 1443 | |||
| 1444 | 4 | Test(test126, full_gcorv) | |
| 1445 | { | ||
| 1446 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1447 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1448 | |||
| 1449 | 2 | fprintf(file, "exit\n"); | |
| 1450 | 2 | fclose(file); | |
| 1451 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1452 | 2 | shell(env); | |
| 1453 | ✗ | } | |
| 1454 | |||
| 1455 | 4 | Test(test130, full_gcorv) | |
| 1456 | { | ||
| 1457 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1458 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1459 | |||
| 1460 | 2 | fprintf(file, "exit\n"); | |
| 1461 | 2 | fclose(file); | |
| 1462 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1463 | 2 | shell(env); | |
| 1464 | ✗ | } | |
| 1465 | |||
| 1466 | 4 | Test(test131, full_gcorv) | |
| 1467 | { | ||
| 1468 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1469 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1470 | |||
| 1471 | 2 | fprintf(file, "exit\n"); | |
| 1472 | 2 | fclose(file); | |
| 1473 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1474 | 2 | shell(env); | |
| 1475 | ✗ | } | |
| 1476 | |||
| 1477 | 4 | Test(test134, full_gcorv) | |
| 1478 | { | ||
| 1479 | 2 | char **env = my_str_to_word_array_select("", " ;"); | |
| 1480 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1481 | |||
| 1482 | 2 | fprintf(file, "exit\n"); | |
| 1483 | 2 | fclose(file); | |
| 1484 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1485 | 2 | shell(env); | |
| 1486 | ✗ | } | |
| 1487 | |||
| 1488 | 4 | Test(test135, full_gcorv) | |
| 1489 | { | ||
| 1490 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1491 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1492 | |||
| 1493 | 2 | fprintf(file, "\n"); | |
| 1494 | 2 | fprintf(file, "exit\n"); | |
| 1495 | 2 | fclose(file); | |
| 1496 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1497 | 2 | shell(env); | |
| 1498 | ✗ | } | |
| 1499 | |||
| 1500 | 4 | Test(test136, full_gcorv) | |
| 1501 | { | ||
| 1502 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1503 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1504 | |||
| 1505 | 2 | fprintf(file, "ls /etc\n"); | |
| 1506 | 2 | fprintf(file, "cat /etc/resolv.conf\n"); | |
| 1507 | 2 | fprintf(file, "exit\n"); | |
| 1508 | 2 | fclose(file); | |
| 1509 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1510 | 2 | shell(env); | |
| 1511 | ✗ | } | |
| 1512 | |||
| 1513 | 4 | Test(test137, full_gcorv) | |
| 1514 | { | ||
| 1515 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/usr/bin", " ;"); | |
| 1516 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1517 | |||
| 1518 | 2 | fprintf(file, "pwd\n"); | |
| 1519 | 2 | fprintf(file, "exit\n"); | |
| 1520 | 2 | fclose(file); | |
| 1521 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1522 | 2 | shell(env); | |
| 1523 | ✗ | } | |
| 1524 | |||
| 1525 | 4 | Test(test138, full_gcorv) | |
| 1526 | { | ||
| 1527 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin", " ;"); | |
| 1528 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1529 | |||
| 1530 | 2 | fprintf(file, "pwd\n"); | |
| 1531 | 2 | fprintf(file, "exit\n"); | |
| 1532 | 2 | fclose(file); | |
| 1533 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1534 | 2 | shell(env); | |
| 1535 | ✗ | } | |
| 1536 | |||
| 1537 | 4 | Test(test139, full_gcorv) | |
| 1538 | { | ||
| 1539 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1540 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1541 | |||
| 1542 | 2 | fprintf(file, "cat /etc/resolv.conf\n"); | |
| 1543 | 2 | fprintf(file, "ls -l /etc\n"); | |
| 1544 | 2 | fprintf(file, "pwd\n"); | |
| 1545 | 2 | fprintf(file, "exit\n"); | |
| 1546 | 2 | fclose(file); | |
| 1547 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1548 | 2 | shell(env); | |
| 1549 | ✗ | } | |
| 1550 | |||
| 1551 | 4 | Test(test141, full_gcorv) | |
| 1552 | { | ||
| 1553 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1554 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1555 | |||
| 1556 | 2 | fprintf(file, "cd ..\n"); | |
| 1557 | 2 | fprintf(file, "ls -l\n"); | |
| 1558 | 2 | fprintf(file, "cd /usr\n"); | |
| 1559 | 2 | fprintf(file, "ls -l\n"); | |
| 1560 | 2 | fprintf(file, "exit\n"); | |
| 1561 | 2 | fclose(file); | |
| 1562 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1563 | 2 | shell(env); | |
| 1564 | ✗ | } | |
| 1565 | |||
| 1566 | 4 | Test(test142, full_gcorv) | |
| 1567 | { | ||
| 1568 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1569 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1570 | |||
| 1571 | 2 | fprintf(file, "exit\n"); | |
| 1572 | 2 | fclose(file); | |
| 1573 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1574 | 2 | shell(env); | |
| 1575 | ✗ | } | |
| 1576 | |||
| 1577 | 4 | Test(test143, full_gcorv) | |
| 1578 | { | ||
| 1579 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1580 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1581 | |||
| 1582 | 2 | fprintf(file, "exit\n"); | |
| 1583 | 2 | fclose(file); | |
| 1584 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1585 | 2 | shell(env); | |
| 1586 | ✗ | } | |
| 1587 | |||
| 1588 | 4 | Test(test144, full_gcorv) | |
| 1589 | { | ||
| 1590 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1591 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1592 | |||
| 1593 | 2 | fprintf(file, "pwd\n"); | |
| 1594 | 2 | fprintf(file, "cd -\n"); | |
| 1595 | 2 | fprintf(file, "exit\n"); | |
| 1596 | 2 | fclose(file); | |
| 1597 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1598 | 2 | shell(env); | |
| 1599 | ✗ | } | |
| 1600 | |||
| 1601 | 4 | Test(test145, full_gcorv) | |
| 1602 | { | ||
| 1603 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1604 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1605 | |||
| 1606 | 2 | fprintf(file, "cd ..\n"); | |
| 1607 | 2 | fprintf(file, "cd -\n"); | |
| 1608 | 2 | fprintf(file, "exit\n"); | |
| 1609 | 2 | fclose(file); | |
| 1610 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1611 | 2 | shell(env); | |
| 1612 | ✗ | } | |
| 1613 | |||
| 1614 | 4 | Test(test146, full_gcorv) | |
| 1615 | { | ||
| 1616 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1617 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1618 | |||
| 1619 | 2 | fprintf(file, "cd ..\n"); | |
| 1620 | 2 | fprintf(file, "cd -\n"); | |
| 1621 | 2 | fprintf(file, "ls\n"); | |
| 1622 | 2 | fprintf(file, "exit\n"); | |
| 1623 | 2 | fclose(file); | |
| 1624 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1625 | 2 | shell(env); | |
| 1626 | ✗ | } | |
| 1627 | |||
| 1628 | 4 | Test(test147, full_gcorv) | |
| 1629 | { | ||
| 1630 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1631 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1632 | |||
| 1633 | 2 | fprintf(file, "exit\n"); | |
| 1634 | 2 | fclose(file); | |
| 1635 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1636 | 2 | shell(env); | |
| 1637 | ✗ | } | |
| 1638 | |||
| 1639 | 4 | Test(test148, full_gcorv) | |
| 1640 | { | ||
| 1641 | 2 | char **env = my_str_to_word_array_select("VAR1=VALEUR1 ; OLDPATH=$PATH ; PATH=/random", " ;"); | |
| 1642 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1643 | |||
| 1644 | 2 | fprintf(file, "setenv | /bin/grep VAR1\n"); | |
| 1645 | 2 | fprintf(file, "/bin/ls | cd /usr\n"); | |
| 1646 | 2 | fprintf(file, "ls -l\n"); | |
| 1647 | 2 | fprintf(file, "exit 45|cat /etc/resolv.conf\n"); | |
| 1648 | 2 | fprintf(file, "exit\n"); | |
| 1649 | 2 | fclose(file); | |
| 1650 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1651 | 2 | shell(env); | |
| 1652 | ✗ | } | |
| 1653 | |||
| 1654 | 4 | Test(test149, full_gcorv) | |
| 1655 | { | ||
| 1656 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1657 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1658 | |||
| 1659 | 2 | fprintf(file, "ls -l ; pwd ; ls -l ; ls -l\n"); | |
| 1660 | 2 | fprintf(file, "exit\n"); | |
| 1661 | 2 | fclose(file); | |
| 1662 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1663 | 2 | shell(env); | |
| 1664 | ✗ | } | |
| 1665 | |||
| 1666 | 4 | Test(test150, full_gcorv) | |
| 1667 | { | ||
| 1668 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1669 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1670 | |||
| 1671 | 2 | fprintf(file, "ls -l && pwd && ls -l && ls -l\n"); | |
| 1672 | 2 | fprintf(file, "exit\n"); | |
| 1673 | 2 | fclose(file); | |
| 1674 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1675 | 2 | shell(env); | |
| 1676 | ✗ | } | |
| 1677 | |||
| 1678 | 4 | Test(test151, full_gcorv) | |
| 1679 | { | ||
| 1680 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1681 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1682 | |||
| 1683 | 2 | fprintf(file, "ls -l || pwd || ls -l || ls -l\n"); | |
| 1684 | 2 | fprintf(file, "exit\n"); | |
| 1685 | 2 | fclose(file); | |
| 1686 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1687 | 2 | shell(env); | |
| 1688 | ✗ | } | |
| 1689 | |||
| 1690 | 4 | Test(test152, full_gcorv) | |
| 1691 | { | ||
| 1692 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1693 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1694 | |||
| 1695 | 2 | fprintf(file, "ls -l && pwd || ls -l && ls -l\n"); | |
| 1696 | 2 | fprintf(file, "exit\n"); | |
| 1697 | 2 | fclose(file); | |
| 1698 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1699 | 2 | shell(env); | |
| 1700 | ✗ | } | |
| 1701 | |||
| 1702 | 4 | Test(test153, full_gcorv) | |
| 1703 | { | ||
| 1704 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1705 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1706 | |||
| 1707 | 2 | fprintf(file, "exit\n"); | |
| 1708 | 2 | fclose(file); | |
| 1709 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1710 | 2 | shell(env); | |
| 1711 | ✗ | } | |
| 1712 | |||
| 1713 | 4 | Test(test154, full_gcorv) | |
| 1714 | { | ||
| 1715 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1716 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1717 | |||
| 1718 | 2 | fprintf(file, "exit\n"); | |
| 1719 | 2 | fclose(file); | |
| 1720 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1721 | 2 | shell(env); | |
| 1722 | ✗ | } | |
| 1723 | |||
| 1724 | 4 | Test(test155, full_gcorv) | |
| 1725 | { | ||
| 1726 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1727 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1728 | |||
| 1729 | 2 | fprintf(file, "exit\n"); | |
| 1730 | 2 | fclose(file); | |
| 1731 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1732 | 2 | shell(env); | |
| 1733 | ✗ | } | |
| 1734 | |||
| 1735 | 4 | Test(test156, full_gcorv) | |
| 1736 | { | ||
| 1737 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1738 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1739 | |||
| 1740 | 2 | fprintf(file, "ls > a > \n"); | |
| 1741 | 2 | fprintf(file, "exit\n"); | |
| 1742 | 2 | fclose(file); | |
| 1743 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1744 | 2 | shell(env); | |
| 1745 | ✗ | } | |
| 1746 | |||
| 1747 | 4 | Test(test157, full_gcorv) | |
| 1748 | { | ||
| 1749 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1750 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1751 | |||
| 1752 | 2 | fprintf(file, "lala >> b << a > \n"); | |
| 1753 | 2 | fprintf(file, "exit\n"); | |
| 1754 | 2 | fclose(file); | |
| 1755 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1756 | 2 | shell(env); | |
| 1757 | ✗ | } | |
| 1758 | |||
| 1759 | 4 | Test(test158, full_gcorv) | |
| 1760 | { | ||
| 1761 | 2 | char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); | |
| 1762 | 2 | FILE *file = fopen("test_input.txt", "w"); | |
| 1763 | |||
| 1764 | 2 | fprintf(file, "lala >> << a > \n"); | |
| 1765 | 2 | fprintf(file, "exit\n"); | |
| 1766 | 2 | fclose(file); | |
| 1767 | 2 | freopen("test_input.txt", "r", stdin); | |
| 1768 | 2 | shell(env); | |
| 1769 | ✗ | } | |
| 1770 |