projects/aports·blob master · refs

295 lines · 9.5 KiB

1diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
2index 21a25fc..dcdb65e 100644
3--- a/test/CMakeLists.txt
4+++ b/test/CMakeLists.txt
5@@ -1,5 +1,3 @@
6-add_subdirectory(googletest)
7-
8 add_executable(psl-native-test
9 test-getfileowner.cpp
10 test-getuserfrompid.cpp
11diff --git a/test/test-getcommonlstat.cpp b/test/test-getcommonlstat.cpp
12index d7206c1..b087a2c 100644
13--- a/test/test-getcommonlstat.cpp
14+++ b/test/test-getcommonlstat.cpp
15@@ -40,9 +40,9 @@ TEST(GetCommonLStat, GetOwnerIdOfRoot)
16 FILE *p;
17 CommonStat cs;
18 #if defined (__APPLE__) || defined(__FreeBSD__)
19- p = popen("/usr/bin/stat -f %u /", "r");
20+ p = popen("/bin/stat -f %u /", "r");
21 #else
22- p = popen("/usr/bin/stat -c %u /", "r");
23+ p = popen("/bin/stat -c %u /", "r");
24 #endif
25 int uid = -1;
26 int result = fscanf(p, "%d", &uid);
27@@ -57,9 +57,9 @@ TEST(GetCommonLStat, GetGroupId)
28 FILE *p;
29 CommonStat cs;
30 #if defined (__APPLE__) || defined(__FreeBSD__)
31- p = popen("/usr/bin/stat -f %g /", "r");
32+ p = popen("/bin/stat -f %g /", "r");
33 #else
34- p = popen("/usr/bin/stat -c %g /", "r");
35+ p = popen("/bin/stat -c %g /", "r");
36 #endif
37 int gid = -1;
38 int result = fscanf(p, "%d", &gid);
39@@ -74,9 +74,9 @@ TEST(GetCommonLStat, GetInodeNumber)
40 FILE *p;
41 CommonStat cs;
42 #if defined (__APPLE__) || defined(__FreeBSD__)
43- p = popen("/usr/bin/stat -f %i /", "r");
44+ p = popen("/bin/stat -f %i /", "r");
45 #else
46- p = popen("/usr/bin/stat -c %i /", "r");
47+ p = popen("/bin/stat -c %i /", "r");
48 #endif
49 long inode = -1;
50 int result = fscanf(p, "%ld", &inode);
51@@ -91,9 +91,9 @@ TEST(GetCommonLStat, GetSize)
52 FILE *p;
53 CommonStat cs;
54 #if defined (__APPLE__) || defined(__FreeBSD__)
55- p = popen("/usr/bin/stat -f %z /", "r");
56+ p = popen("/bin/stat -f %z /", "r");
57 #else
58- p = popen("/usr/bin/stat -c %s /", "r");
59+ p = popen("/bin/stat -c %s /", "r");
60 #endif
61 long size = -1;
62 int result = fscanf(p, "%ld", &size);
63@@ -108,9 +108,9 @@ TEST(GetCommonLStat, GetBlockSize)
64 FILE *p;
65 CommonStat cs;
66 #if defined (__APPLE__) || defined(__FreeBSD__)
67- p = popen("/usr/bin/stat -f %k /", "r");
68+ p = popen("/bin/stat -f %k /", "r");
69 #else
70- p = popen("/usr/bin/stat -c %o /", "r");
71+ p = popen("/bin/stat -c %o /", "r");
72 #endif
73 long bSize = -1;
74 int result = fscanf(p, "%ld", &bSize);
75@@ -125,9 +125,9 @@ TEST(GetCommonLStat, GetBlockCount)
76 FILE *p;
77 CommonStat cs;
78 #if defined (__APPLE__) || defined(__FreeBSD__)
79- p = popen("/usr/bin/stat -f %b /", "r");
80+ p = popen("/bin/stat -f %b /", "r");
81 #else
82- p = popen("/usr/bin/stat -c %b /", "r");
83+ p = popen("/bin/stat -c %b /", "r");
84 #endif
85 int bSize = -1;
86 int result = fscanf(p, "%d", &bSize);
87@@ -142,9 +142,9 @@ TEST(GetCommonLStat, GetLinkCount)
88 FILE *p;
89 CommonStat cs;
90 #if defined (__APPLE__) || defined(__FreeBSD__)
91- p = popen("/usr/bin/stat -f %l /", "r");
92+ p = popen("/bin/stat -f %l /", "r");
93 #else
94- p = popen("/usr/bin/stat -c %h /", "r");
95+ p = popen("/bin/stat -c %h /", "r");
96 #endif
97 int linkcount = -1;
98 int result = fscanf(p, "%d", &linkcount);
99@@ -159,9 +159,9 @@ TEST(GetCommonLStat, GetDeviceId)
100 FILE *p;
101 CommonStat cs;
102 #if defined (__APPLE__) || defined(__FreeBSD__)
103- p = popen("/usr/bin/stat -f %d /", "r");
104+ p = popen("/bin/stat -f %d /", "r");
105 #else
106- p = popen("/usr/bin/stat -c %d /", "r");
107+ p = popen("/bin/stat -c %d /", "r");
108 #endif
109 int deviceId = -1;
110 int result = fscanf(p, "%d", &deviceId);
111@@ -176,9 +176,9 @@ TEST(GetCommonLStat, GetATime)
112 FILE *p;
113 CommonStat cs;
114 #if defined (__APPLE__) || defined(__FreeBSD__)
115- p = popen("/usr/bin/stat -f %a /", "r");
116+ p = popen("/bin/stat -f %a /", "r");
117 #else
118- p = popen("/usr/bin/stat -c %X /", "r");
119+ p = popen("/bin/stat -c %X /", "r");
120 #endif
121 long aTime = -1;
122 int result = fscanf(p, "%ld", &aTime);
123@@ -193,9 +193,9 @@ TEST(GetCommonLStat, GetMTime)
124 FILE *p;
125 CommonStat cs;
126 #if defined (__APPLE__) || defined(__FreeBSD__)
127- p = popen("/usr/bin/stat -f %m /", "r");
128+ p = popen("/bin/stat -f %m /", "r");
129 #else
130- p = popen("/usr/bin/stat -c %Y /", "r");
131+ p = popen("/bin/stat -c %Y /", "r");
132 #endif
133 long mTime = -1;
134 int result = fscanf(p, "%ld", &mTime);
135@@ -210,9 +210,9 @@ TEST(GetCommonLStat, GetCTime)
136 FILE *p;
137 CommonStat cs;
138 #if defined (__APPLE__) || defined(__FreeBSD__)
139- p = popen("/usr/bin/stat -f %c /", "r");
140+ p = popen("/bin/stat -f %c /", "r");
141 #else
142- p = popen("/usr/bin/stat -c %Z /", "r");
143+ p = popen("/bin/stat -c %Z /", "r");
144 #endif
145 long cTime = -1;
146 int result = fscanf(p, "%ld", &cTime);
147diff --git a/test/test-getcommonstat.cpp b/test/test-getcommonstat.cpp
148index 70279c9..ca196df 100644
149--- a/test/test-getcommonstat.cpp
150+++ b/test/test-getcommonstat.cpp
151@@ -42,9 +42,9 @@ TEST(GetCommonStat, GetOwnerIdOfRoot)
152 FILE *p;
153 CommonStat cs;
154 #if defined (__APPLE__) || defined(__FreeBSD__)
155- p = popen("/usr/bin/stat -f %u /", "r");
156+ p = popen("/bin/stat -f %u /", "r");
157 #else
158- p = popen("/usr/bin/stat -c %u /", "r");
159+ p = popen("/bin/stat -c %u /", "r");
160 #endif
161 int uid = -1;
162 int result = fscanf(p, "%d", &uid);
163@@ -59,9 +59,9 @@ TEST(GetCommonStat, GetGroupId)
164 FILE *p;
165 CommonStat cs;
166 #if defined (__APPLE__) || defined(__FreeBSD__)
167- p = popen("/usr/bin/stat -f %g /", "r");
168+ p = popen("/bin/stat -f %g /", "r");
169 #else
170- p = popen("/usr/bin/stat -c %g /", "r");
171+ p = popen("/bin/stat -c %g /", "r");
172 #endif
173 int gid = -1;
174 int result = fscanf(p, "%d", &gid);
175@@ -76,9 +76,9 @@ TEST(GetCommonStat, GetInodeNumber)
176 FILE *p;
177 CommonStat cs;
178 #if defined (__APPLE__) || defined(__FreeBSD__)
179- p = popen("/usr/bin/stat -f %i /", "r");
180+ p = popen("/bin/stat -f %i /", "r");
181 #else
182- p = popen("/usr/bin/stat -c %i /", "r");
183+ p = popen("/bin/stat -c %i /", "r");
184 #endif
185 long inode = -1;
186 int result = fscanf(p, "%ld", &inode);
187@@ -94,10 +94,10 @@ TEST(GetCommonStat, GetMode)
188 CommonStat cs;
189 unsigned int mode = -1;
190 #if defined (__APPLE__) || defined(__FreeBSD__)
191- p = popen("/usr/bin/stat -f %p /", "r");
192+ p = popen("/bin/stat -f %p /", "r");
193 int result = fscanf(p, "%o", &mode);
194 #else
195- p = popen("/usr/bin/stat -c %f /", "r");
196+ p = popen("/bin/stat -c %f /", "r");
197 int result = fscanf(p, "%x", &mode);
198 #endif
199 pclose(p);
200@@ -111,9 +111,9 @@ TEST(GetCommonStat, GetSize)
201 FILE *p;
202 CommonStat cs;
203 #if defined (__APPLE__) || defined(__FreeBSD__)
204- p = popen("/usr/bin/stat -f %z /", "r");
205+ p = popen("/bin/stat -f %z /", "r");
206 #else
207- p = popen("/usr/bin/stat -c %s /", "r");
208+ p = popen("/bin/stat -c %s /", "r");
209 #endif
210 long size = -1;
211 int result = fscanf(p, "%ld", &size);
212@@ -128,9 +128,9 @@ TEST(GetCommonStat, GetBlockSize)
213 FILE *p;
214 CommonStat cs;
215 #if defined (__APPLE__) || defined(__FreeBSD__)
216- p = popen("/usr/bin/stat -f %k /", "r");
217+ p = popen("/bin/stat -f %k /", "r");
218 #else
219- p = popen("/usr/bin/stat -c %o /", "r");
220+ p = popen("/bin/stat -c %o /", "r");
221 #endif
222 long bSize = -1;
223 int result = fscanf(p, "%ld", &bSize);
224@@ -145,9 +145,9 @@ TEST(GetCommonStat, GetBlockCount)
225 FILE *p;
226 CommonStat cs;
227 #if defined (__APPLE__) || defined(__FreeBSD__)
228- p = popen("/usr/bin/stat -f %b /", "r");
229+ p = popen("/bin/stat -f %b /", "r");
230 #else
231- p = popen("/usr/bin/stat -c %b /", "r");
232+ p = popen("/bin/stat -c %b /", "r");
233 #endif
234 int bSize = -1;
235 int result = fscanf(p, "%d", &bSize);
236@@ -162,9 +162,9 @@ TEST(GetCommonStat, GetLinkCount)
237 FILE *p;
238 CommonStat cs;
239 #if defined (__APPLE__) || defined(__FreeBSD__)
240- p = popen("/usr/bin/stat -f %l /", "r");
241+ p = popen("/bin/stat -f %l /", "r");
242 #else
243- p = popen("/usr/bin/stat -c %h /", "r");
244+ p = popen("/bin/stat -c %h /", "r");
245 #endif
246 int linkcount = -1;
247 int result = fscanf(p, "%d", &linkcount);
248@@ -179,9 +179,9 @@ TEST(GetCommonStat, GetDeviceId)
249 FILE *p;
250 CommonStat cs;
251 #if defined (__APPLE__) || defined(__FreeBSD__)
252- p = popen("/usr/bin/stat -f %d /", "r");
253+ p = popen("/bin/stat -f %d /", "r");
254 #else
255- p = popen("/usr/bin/stat -c %d /", "r");
256+ p = popen("/bin/stat -c %d /", "r");
257 #endif
258 int deviceId = -1;
259 int result = fscanf(p, "%d", &deviceId);
260@@ -196,9 +196,9 @@ TEST(GetCommonStat, GetATime)
261 FILE *p;
262 CommonStat cs;
263 #if defined (__APPLE__) || defined(__FreeBSD__)
264- p = popen("/usr/bin/stat -f %a /", "r");
265+ p = popen("/bin/stat -f %a /", "r");
266 #else
267- p = popen("/usr/bin/stat -c %X /", "r");
268+ p = popen("/bin/stat -c %X /", "r");
269 #endif
270 long aTime = -1;
271 int result = fscanf(p, "%ld", &aTime);
272@@ -213,9 +213,9 @@ TEST(GetCommonStat, GetMTime)
273 FILE *p;
274 CommonStat cs;
275 #if defined (__APPLE__) || defined(__FreeBSD__)
276- p = popen("/usr/bin/stat -f %m /", "r");
277+ p = popen("/bin/stat -f %m /", "r");
278 #else
279- p = popen("/usr/bin/stat -c %Y /", "r");
280+ p = popen("/bin/stat -c %Y /", "r");
281 #endif
282 long mTime = -1;
283 int result = fscanf(p, "%ld", &mTime);
284@@ -230,9 +230,9 @@ TEST(GetCommonStat, GetCTime)
285 FILE *p;
286 CommonStat cs;
287 #if defined (__APPLE__) || defined(__FreeBSD__)
288- p = popen("/usr/bin/stat -f %c /", "r");
289+ p = popen("/bin/stat -f %c /", "r");
290 #else
291- p = popen("/usr/bin/stat -c %Z /", "r");
292+ p = popen("/bin/stat -c %Z /", "r");
293 #endif
294 long cTime = -1;
295 int result = fscanf(p, "%ld", &cTime);