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

PG_CONNINFO = ""

test: testfsync testpgsql
	psql < clean.sql
	psql < ../schema.sql
	test -d mnt || mkdir mnt
	../pgfuse -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
	# show filesystem stats (statvfs)
	-stat -f mnt
	# 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
	# END: unmount FUSE file system
	fusermount -u mnt

clean:
	rm -f testfsync testfsync.o
	rm -f testpgsql testpgsql.o
	rm -f testtypes testtypes.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