Advertisement
Guest User

customTests.c

a guest
May 28th, 2015
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.79 KB | None | 0 0
  1. #include "syscall.h"
  2. #include "stdio.h"
  3. #include "stdlib.h"
  4.  
  5. int main(int argc, char** argv)
  6. {
  7.     char *args1[3];
  8.     char *args2[1];
  9.     char *args3[2];
  10.     int fileDescr;
  11.     int status;
  12.     args1[0] = "cp.coff";
  13.     args1[1] = "test1.txt";
  14.     args1[2] = "test2.txt";
  15.  
  16.     args2[0] = "part1_tests.coff";
  17.  
  18.     args3[0] = "simpleWrite.coff";
  19.     args3[1] = "simpleWriteTest.txt";
  20.  
  21.     int pid2 = exec("cp.coff", 3, args1);
  22.     // join(pid2, &status);
  23.  
  24.     int pid1 = exec("part1_tests.coff", 1, args2);
  25.     // join(pid1, &status);
  26.  
  27.     int pid3 = exec("simpleWrite.coff", 2, args3);
  28.     // join(pid3, &status);
  29.  
  30.     fileDescr = open("test2.txt");
  31.     if (fileDescr == -1) {
  32.         printf("FAIL: Could not re-open test2.txt. exec(\"cp.coff\", 3, args1) did not work correctly.\n");
  33.         return 0;
  34.     }
  35.  
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement