File: symlink.sh

package info (click to toggle)
pkgconf 2.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,820 kB
  • sloc: ansic: 8,111; sh: 6,689; makefile: 247; python: 157
file content (122 lines) | stat: -rwxr-xr-x 3,403 bytes parent folder | download
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
112
113
114
115
116
117
118
119
120
121
122
#!/usr/bin/env atf-sh

. $(atf_get_srcdir)/test_env.sh

tests_init \
	pcfiledir_symlink_absolute \
	pcfiledir_symlink_relative

# - We need to create a temporary subtree, since symlinks are not preserved
#   in "make dist".
# - ${srcdir} is relative and since we need to compare paths, we would have
#   to portably canonicalize it again, which is hard. Instead, just keep
#   the whole thing nested.
pcfiledir_symlink_absolute_body()
{
	mkdir -p tmp/child
	cp -f "${selfdir}/lib1/pcfiledir.pc" tmp/child/
	ln -f -s "${PWD}/tmp/child/pcfiledir.pc" tmp/pcfiledir.pc  # absolute
	ln -f -s tmp/pcfiledir.pc pcfiledir.pc

	atf_check \
		-o inline:"${PWD}/tmp/child\n" \
		pkgconf --variable=prefix pcfiledir.pc
	atf_check \
		-o inline:"${PWD}/tmp/child\n" \
		pkgconf --variable=prefix tmp/pcfiledir.pc
	atf_check \
		-o inline:"tmp/child\n" \
		pkgconf --variable=prefix tmp/child/pcfiledir.pc

	atf_check \
		-o inline:"${PWD}/tmp/child\n" \
		pkgconf --variable=prefix "${PWD}/pcfiledir.pc"
	atf_check \
		-o inline:"${PWD}/tmp/child\n" \
		pkgconf --variable=prefix "${PWD}/tmp/pcfiledir.pc"
	atf_check \
		-o inline:"${PWD}/tmp/child\n" \
		pkgconf --variable=prefix "${PWD}/tmp/child/pcfiledir.pc"

	export PKG_CONFIG_PATH="."
	atf_check \
		-o inline:"${PWD}/tmp/child\n" \
		pkgconf --variable=prefix pcfiledir
	export PKG_CONFIG_PATH="${PWD}"
	atf_check \
		-o inline:"${PWD}/tmp/child\n" \
		pkgconf --variable=prefix pcfiledir

	export PKG_CONFIG_PATH="tmp"
	atf_check \
		-o inline:"${PWD}/tmp/child\n" \
		pkgconf --variable=prefix pcfiledir
	export PKG_CONFIG_PATH="${PWD}/tmp"
	atf_check \
		-o inline:"${PWD}/tmp/child\n" \
		pkgconf --variable=prefix pcfiledir

	export PKG_CONFIG_PATH="tmp/child"
	atf_check \
		-o inline:"tmp/child\n" \
		pkgconf --variable=prefix pcfiledir
	export PKG_CONFIG_PATH="${PWD}/tmp/child"
	atf_check \
		-o inline:"${PWD}/tmp/child\n" \
		pkgconf --variable=prefix pcfiledir
}

pcfiledir_symlink_relative_body()
{
	mkdir -p tmp/child
	cp -f "${selfdir}/lib1/pcfiledir.pc" tmp/child/
	ln -f -s child/pcfiledir.pc tmp/pcfiledir.pc  # relative
	ln -f -s tmp/pcfiledir.pc pcfiledir.pc

	atf_check \
		-o inline:"tmp/child\n" \
		pkgconf --variable=prefix pcfiledir.pc
	atf_check \
		-o inline:"tmp/child\n" \
		pkgconf --variable=prefix tmp/pcfiledir.pc
	atf_check \
		-o inline:"tmp/child\n" \
		pkgconf --variable=prefix tmp/child/pcfiledir.pc

	atf_check \
		-o inline:"${PWD}/tmp/child\n" \
		pkgconf --variable=prefix "${PWD}/pcfiledir.pc"
	atf_check \
		-o inline:"${PWD}/tmp/child\n" \
		pkgconf --variable=prefix "${PWD}/tmp/pcfiledir.pc"
	atf_check \
		-o inline:"${PWD}/tmp/child\n" \
		pkgconf --variable=prefix "${PWD}/tmp/child/pcfiledir.pc"

	export PKG_CONFIG_PATH="."
	atf_check \
		-o inline:"tmp/child\n" \
		pkgconf --variable=prefix pcfiledir
	export PKG_CONFIG_PATH="${PWD}"
	atf_check \
		-o inline:"${PWD}/tmp/child\n" \
		pkgconf --variable=prefix pcfiledir

	export PKG_CONFIG_PATH="tmp"
	atf_check \
		-o inline:"tmp/child\n" \
		pkgconf --variable=prefix pcfiledir
	export PKG_CONFIG_PATH="${PWD}/tmp"
	atf_check \
		-o inline:"${PWD}/tmp/child\n" \
		pkgconf --variable=prefix pcfiledir

	export PKG_CONFIG_PATH="tmp/child"
	atf_check \
		-o inline:"tmp/child\n" \
		pkgconf --variable=prefix pcfiledir
	export PKG_CONFIG_PATH="${PWD}/tmp/child"
	atf_check \
		-o inline:"${PWD}/tmp/child\n" \
		pkgconf --variable=prefix pcfiledir
}