-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.h
More file actions
111 lines (98 loc) · 4.56 KB
/
tests.h
File metadata and controls
111 lines (98 loc) · 4.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#include "filesystem.h"
//Tests for f_open
/*
1) test fopen on a file that does not exist with a valid path and writing/appending as the value
- expected behavior is that the file is created and the file is added to the directory as well as opened in the file table
2) test fopen on a file that exists
- expected behavior is that the file is opened with the certian access and permissions values and inserted in the file table
3) test fopen on a file that does not exist and that has an invalid path name
- expected behavior is returning an invalid file descriptor and an error
4) test fopen on a file that does not exist and trying to read it
- expected behavior is that the file is not created and an error value is returned
5) test fopen on a file that does not exist and trying to READANDWRITE
6)test fopen on a file that does not exist and trying to WRITE
*/
void test_fopen_create(char* disk_to_mount, char *filepath, int access, permission_value *permissions); //1)
void test_fopen_validfile(char* disk_to_mount, char* filepath, int access, permission_value *permission); //2
//Tests for f_read
/*
1) Read from a file's direct blocks
2) Read from a file's indirect blocks
3) Read from a file's doubly indirect blocks
4) Read from a file's triply indirect blocks
5) Read from the start of the blocks
6) Read from the start of the file
7) Read from the middle of a block in the file to the end of the block in the file
8) Read from the middle of a block in the file to the middle of the next block in the file
9) Try to read more than a file size
10) Try to read past the end of the file...
11) Try to read a file that isn't opened for reading
12) Try negative size or number of times or invalid file descriptor
*/
//Tests for f_write
/*
***compare inodes and superblock and data region***
1)when access == WRITE || READANDWRITE, write small data to the dblocks
2)when access == WRITE || READANDWRITE, write large data to the dblocks (go into idblocks)
3)when access == WRITE || READANDWRITE, write small data to the idblocks
4)when access == WRITE || READANDWRITE, write large data to the idblocks
5)when access == WRITE || READANDWRITE, write small data to the i2blocks
6)when access == WRITE || READANDWRITE, write large data to the i2blocks
7)when access == WRITE || READANDWRITE, write small data to the i3blocks
8)when access == WRITE || READANDWRITE, write large data to the i3blocks
9)when access == WRITE || READANDWRITE, write large enough data to exceed the disk size
10)when access == APPEND, append small data to the dblocks
11)when access == APPEND, append large data to the dblocks
12)when access == APPEND, append small data to the idblocks
13)when access == APPEND, append large data to the idblocks
14)when access == APPEND, append small data to the i2blocks
15)when access == APPEND, append large data to the i2blocks
16)when access == APPEND, append small data to the i3blocks
17)when access == APPEND, append large data to the i3blocks
18)when access == APPEND, append large enough data to exceed the disk size
*/
//Tests for f_close
/*
1) Check that the
*/
//Tests for f_opendir
/*
1)Test a valid path
2)Test an invalid path
3)Test opening root dir only
4)Test opening a directory that is already opened
*/
void test_fopendir_valid(char *disk_to_mount, char* filepath); //1)
void test_fopendir_invalid(char *disk_to_mount, char* filepath); //2)
void test_fopendir_root(char *disk_to_mount, char* filepath); //3)
void test_fopendir_alread_open(char *disk_to_mount, char* filepath); //4)
//Tests for f_readdir
/*
1) Open root and check the root inode's values (should be . and .. at beginning)
2) Open a valid filepath for a directory and check the entries in the directory...use mkdir and an array to confirm (single, double, triple, and direct)
3) Test reading past the end of a file
*/
void test_freaddir_root(char *disk_to_mount); //1)
//TODO: 2) test!
void test_freaddir_past_end(char *disk_to_mount, char *filepath); //3)
//Tests for f_mkdir
/*
1) create a new directory under an existing directory
2) create a new directory under a non-existing directory
3) create a new directory under root
*/
//...
//Tests for f_mount (as of right now, without mounting multiple disks)
/*
1) Check that the values mounted are as expected for the given disk
*/
void test_fmount(char *disk_to_mount);
//Tests for f_unmount (as of right now, without mounting multiple disks)
/*
1) First mount a disk and then check that the spot in the mounted disks array is marked as free and that there are no memory leaks
*/
void test_funmount(char *disk_to_mount);
//Helper Methods
void help();
void run_tests(char *disk_to_test);
void check_freehead();