Adding more time tests
[yaffs2.git] / direct / test-framework / unit_tests / 64_and_32_bit_time / 64_bit / create_64_bit.c
1 //#include <stdio.h>
2 #include <stdlib.h>
3 #include "yaffsfs.h"
4
5 #define TEST_PASS 0
6 #define TEST_FAIL 1
7
8 #define YAFFS_MOUNT_POINT "/yflash2/"
9 #define FILE_PATH "/yflash2/foo.txt"
10
11 int random_seed;
12 int simulate_power_failure = 0;
13
14
15 int setup_yaffs() {
16         yaffs_start_up();
17         yaffs_set_trace(0);
18         if (yaffs_mount(YAFFS_MOUNT_POINT) < 0) {
19                 printf("failed to mount %s/n", YAFFS_MOUNT_POINT);
20                 return TEST_FAIL;
21         }       
22         
23         return TEST_PASS;
24 }
25 int shared_create(int argc, char *argv[]){
26         
27         if (argc != 3) {
28                 printf("wrong number of arguments\n");
29                 printf("requires $ create file_name time\n");
30                 return TEST_FAIL;
31         }
32         
33         setup_yaffs();  
34         uint time = atoi(argv[2]);
35         char *file_path = argv[1];
36         if (yaffs_open(FILE_PATH, O_CREAT | O_RDWR, S_IREAD |S_IWRITE)) {
37                 printf("failed to open the file %s/n", FILE_PATH);
38                 return TEST_FAIL;
39         }
40         printf("created file: %s,  with  time: %d\n", file_path, time);
41         return TEST_PASS;
42 }
43 int main(int argc, char *argv[] ){
44         return shared_create(argc, argv);
45 }