summaryrefslogtreecommitdiff
path: root/tests/Makefile
blob: 9170e79de4fefd67fd43d0b7107114468a4882f5 (plain)
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
include ../inc.mak

PG_CONNINFO = ""

BLOCKSIZE = 4096

CFLAGS += -I..

test: testfsync testpgsql testtypes testbigfile testopen
	psql < clean.sql
	psql < ../schema.sql
	test -d mnt || mkdir mnt
	../pgfuse -o blocksize=$(BLOCKSIZE) -s -v "$(PG_CONNINFO)" mnt
	mount | grep pgfuse
	# expect success for making directories
	-mkdir mnt/dir
	-mkdir mnt/dir/dir2
	-mkdir mnt/dir/dir3
	# expect success on open and file write
	-echo "hello" > mnt/dir/dir2/afile
	-cp Makefile mnt/dir/dir2/bfile
	# expect success on open and file read
	-cat mnt/dir/dir2/afile
	-ls -al mnt
	-ls -al mnt/dir/dir2
	# expect success on rmdir
	-rmdir mnt/dir/dir3
	# expect success on chmod
	-chmod 777 mnt/dir/dir2/bfile
	-ls -al mnt/dir/dir2/bfile
	# expect success on symlink creation
	-ln -s bfile mnt/dir/dir2/clink
	-ls -al mnt/dir/dir2/clink
	# expect success on file removal
	-rm mnt/dir/dir2/bfile
	# expect success on rename 
	-mkdir mnt/dir/dir3
	-mv mnt/dir/dir3 mnt/dir/dir4
	-mv mnt/dir/dir2/afile mnt/dir/dir4/bfile
	-mv mnt/dir/dir2/clink mnt/dir/dir4/dlink
	# expect fail (directory not empty)
	-rmdir mnt/dir
	# expect fail (not a directory)
	-rmdir mnt/dir/dir2/bfile
	# test fdatasync and fsync
	./testfsync
	# show times of dirs, files and symlinks
	-stat mnt/dir/dir4/bfile
	-stat mnt/dir/dir4
	-stat mnt/dir/dir4/dlink
	# expect success, truncate a file (grow and shrink)
	-touch mnt/trunc
	-ls -al mnt/trunc
	-truncate --size 2049 mnt/trunc
	-ls -al mnt/trunc
	-dd if=/dev/zero of=mnt/trunc bs=512 count=10
	-truncate --size 513 mnt/trunc
	-ls -al mnt/trunc
	# expect success, write a sparse big file
	-./testbigfile
	-ls -al mnt/testbigfile.data
	# show filesystem stats (statvfs)
	-stat -f mnt
	# the more human readable output of statvfs
	-df -h mnt
	-df -i mnt
	# test open/creat and flags
	-./testopen
	# END: unmount FUSE file system
	fusermount -u mnt

clean:
	rm -f testfsync testfsync.o
	rm -f testpgsql testpgsql.o
	rm -f testtypes testtypes.o
	rm -f testbigfile testbigfile.o
	rm -f testopen testopen.o
	
testfsync: testfsync.o
	$(CC) -o testfsync testfsync.o

testfsync.o: testfsync.c
	$(CC) -c $(CFLAGS) -o testfsync.o testfsync.c
	
testpgsql: testpgsql.o
	$(CC) -o testpgsql testpgsql.o $(LDFLAGS)

testpgsql.o: testpgsql.c
	$(CC) -c $(CFLAGS) -o testpgsql.o testpgsql.c

testtypes: testtypes.o
	$(CC) -o testtypes testtypes.o

testtypes.o: testtypes.c
	$(CC) -c $(CFLAGS) -o testtypes.o testtypes.c

testbigfile: testbigfile.o
	$(CC) -o testbigfile testbigfile.o

testbigfile.o: testbigfile.c
	$(CC) -c $(CFLAGS) -o testbigfile.o testbigfile.c

testopen: testopen.o
	$(CC) -o testopen testopen.o

testopen.o: testopen.c
	$(CC) -c $(CFLAGS) -o testopen.o testopen.c