aboutsummaryrefslogtreecommitdiff
path: root/tests/ln_tests.mk
blob: 5925edd4f8da88dd05f8f42c49f487ff1e227a4a (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
# GNU `ln'
GLN = /bin/ln
# BusyBox `ln'
BLN = $(shell pwd)/ln

.PHONY: ln_clean
ln_clean:
	rm -rf ln_tests ln_*.{gnu,bb} ln

.PHONY: ln_tests
ln_tests: ln_clean ln
	@echo;
	@echo "No output from diff means busybox ln is functioning properly.";

	@echo;
	${BLN} || true;

	@echo;
	mkdir ln_tests;

	@echo;
	cd ln_tests;				\
	 echo A file > afile;			\
	 ls -l afile > ../ln_afile_newname.gnu;	\
	 ${GLN} afile newname;			\
	 ls -l afile newname >> ../ln_afile_newname.gnu;

	@echo;
	rm -f ln_tests/{afile,newname};

	@echo;
	cd ln_tests;				\
	 echo A file > afile;			\
	 ls -l afile > ../ln_afile_newname.bb;	\
	 ${BLN} afile newname;			\
	 ls -l afile newname >> ../ln_afile_newname.bb;

	@echo;
	diff -u ln_afile_newname.gnu ln_afile_newname.bb

	@echo;
	rm -f ln_tests/{afile,newname};

	@echo;
	cd ln_tests;				\
	 echo A file > afile;			\
	 ls -l afile > ../ln_s_afile_newname.gnu;	\
	 ${GLN} -s afile newname;		\
	 ls -l afile newname >> ../ln_s_afile_newname.gnu;

	@echo;
	rm -f ln_tests/{afile,newname};

	@echo;
	cd ln_tests;				\
	 echo A file > afile;			\
	 ls -l afile > ../ln_s_afile_newname.bb;	\
	 ${BLN} -s afile newname;		\
	 ls -l afile newname >> ../ln_s_afile_newname.bb;

	@echo;
	diff -u ln_s_afile_newname.gnu ln_s_afile_newname.bb

	@echo;
	rm -f ln_tests/{afile,newname};