1*11be35a1SLionel Sambuc /* $NetBSD: t_pidfile.c,v 1.3 2011/03/29 13:55:37 jmmv Exp $ */
2*11be35a1SLionel Sambuc
3*11be35a1SLionel Sambuc /*
4*11be35a1SLionel Sambuc * Copyright (c) 2011 The NetBSD Foundation, Inc.
5*11be35a1SLionel Sambuc * All rights reserved.
6*11be35a1SLionel Sambuc *
7*11be35a1SLionel Sambuc * Redistribution and use in source and binary forms, with or without
8*11be35a1SLionel Sambuc * modification, are permitted provided that the following conditions
9*11be35a1SLionel Sambuc * are met:
10*11be35a1SLionel Sambuc * 1. Redistributions of source code must retain the above copyright
11*11be35a1SLionel Sambuc * notice, this list of conditions and the following disclaimer.
12*11be35a1SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright
13*11be35a1SLionel Sambuc * notice, this list of conditions and the following disclaimer in the
14*11be35a1SLionel Sambuc * documentation and/or other materials provided with the distribution.
15*11be35a1SLionel Sambuc *
16*11be35a1SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17*11be35a1SLionel Sambuc * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18*11be35a1SLionel Sambuc * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19*11be35a1SLionel Sambuc * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20*11be35a1SLionel Sambuc * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21*11be35a1SLionel Sambuc * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22*11be35a1SLionel Sambuc * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23*11be35a1SLionel Sambuc * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24*11be35a1SLionel Sambuc * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25*11be35a1SLionel Sambuc * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26*11be35a1SLionel Sambuc * POSSIBILITY OF SUCH DAMAGE.
27*11be35a1SLionel Sambuc */
28*11be35a1SLionel Sambuc
29*11be35a1SLionel Sambuc /*
30*11be35a1SLionel Sambuc * This file implements tests for the pidfile(3) functions.
31*11be35a1SLionel Sambuc *
32*11be35a1SLionel Sambuc * The tests here are tricky because we need to validate that the atexit(3)
33*11be35a1SLionel Sambuc * handler registered by pidfile(3) correctly deletes the generated pidfile.
34*11be35a1SLionel Sambuc * To do so:
35*11be35a1SLionel Sambuc * 1) We spawn a subprocess in every test case,
36*11be35a1SLionel Sambuc * 2) Run our test code in such subprocesses. We cannot call any of the ATF
37*11be35a1SLionel Sambuc * primitives from inside these.
38*11be35a1SLionel Sambuc * 3) Wait for the subprocess to terminate and ensure it exited successfully.
39*11be35a1SLionel Sambuc * 4) Check that the pidfile(s) created in the subprocess are gone.
40*11be35a1SLionel Sambuc *
41*11be35a1SLionel Sambuc * Additionally, pidfile(3) hardcodes a path to a directory writable only by
42*11be35a1SLionel Sambuc * root (/var/run). This makes us require root privileges to execute these
43*11be35a1SLionel Sambuc * tests.
44*11be35a1SLionel Sambuc */
45*11be35a1SLionel Sambuc
46*11be35a1SLionel Sambuc #include <sys/cdefs.h>
47*11be35a1SLionel Sambuc __COPYRIGHT("@(#) Copyright (c) 2011\
48*11be35a1SLionel Sambuc The NetBSD Foundation, inc. All rights reserved.");
49*11be35a1SLionel Sambuc __RCSID("$NetBSD: t_pidfile.c,v 1.3 2011/03/29 13:55:37 jmmv Exp $");
50*11be35a1SLionel Sambuc
51*11be35a1SLionel Sambuc #include <sys/stat.h>
52*11be35a1SLionel Sambuc #include <sys/wait.h>
53*11be35a1SLionel Sambuc
54*11be35a1SLionel Sambuc #include <assert.h>
55*11be35a1SLionel Sambuc #include <err.h>
56*11be35a1SLionel Sambuc #include <stdbool.h>
57*11be35a1SLionel Sambuc #include <stdio.h>
58*11be35a1SLionel Sambuc #include <stdlib.h>
59*11be35a1SLionel Sambuc #include <paths.h>
60*11be35a1SLionel Sambuc #include <unistd.h>
61*11be35a1SLionel Sambuc #include <util.h>
62*11be35a1SLionel Sambuc
63*11be35a1SLionel Sambuc #include <atf-c.h>
64*11be35a1SLionel Sambuc
65*11be35a1SLionel Sambuc /* Used by routines that can be called both from the parent and the child
66*11be35a1SLionel Sambuc * code to implement proper error reporting. */
67*11be35a1SLionel Sambuc static bool in_child = false;
68*11be35a1SLionel Sambuc
69*11be35a1SLionel Sambuc /* Callable from the test case child code. */
70*11be35a1SLionel Sambuc static void
check_pidfile(const char * path)71*11be35a1SLionel Sambuc check_pidfile(const char *path)
72*11be35a1SLionel Sambuc {
73*11be35a1SLionel Sambuc FILE *file;
74*11be35a1SLionel Sambuc int pid;
75*11be35a1SLionel Sambuc
76*11be35a1SLionel Sambuc printf("Validating contents of pidfile '%s'\n", path);
77*11be35a1SLionel Sambuc
78*11be35a1SLionel Sambuc if ((file = fopen(path, "r")) == NULL)
79*11be35a1SLionel Sambuc errx(EXIT_FAILURE, "Cannot open expected pidfile '%s'", path);
80*11be35a1SLionel Sambuc
81*11be35a1SLionel Sambuc if (fscanf(file, "%d", &pid) == -1)
82*11be35a1SLionel Sambuc errx(EXIT_FAILURE, "Failed to read pid from pidfile '%s'",
83*11be35a1SLionel Sambuc path);
84*11be35a1SLionel Sambuc
85*11be35a1SLionel Sambuc printf("Read pid %d, current pid %d\n", pid, getpid());
86*11be35a1SLionel Sambuc if (pid != getpid())
87*11be35a1SLionel Sambuc errx(EXIT_FAILURE, "Pid in pidfile (%d) does not match "
88*11be35a1SLionel Sambuc "current pid (%d)", pid, getpid());
89*11be35a1SLionel Sambuc }
90*11be35a1SLionel Sambuc
91*11be35a1SLionel Sambuc /* Callable from the test case parent/child code. */
92*11be35a1SLionel Sambuc static void
ensure_deleted(const char * path)93*11be35a1SLionel Sambuc ensure_deleted(const char *path)
94*11be35a1SLionel Sambuc {
95*11be35a1SLionel Sambuc printf("Ensuring pidfile %s does not exist any more\n", path);
96*11be35a1SLionel Sambuc if (access(path, R_OK) != -1) {
97*11be35a1SLionel Sambuc unlink(path);
98*11be35a1SLionel Sambuc if (in_child)
99*11be35a1SLionel Sambuc errx(EXIT_FAILURE, "The pidfile %s was not deleted",
100*11be35a1SLionel Sambuc path);
101*11be35a1SLionel Sambuc else
102*11be35a1SLionel Sambuc atf_tc_fail("The pidfile %s was not deleted", path);
103*11be35a1SLionel Sambuc }
104*11be35a1SLionel Sambuc }
105*11be35a1SLionel Sambuc
106*11be35a1SLionel Sambuc /* Callable from the test case parent code. */
107*11be35a1SLionel Sambuc static void
run_child(void (* child)(const char *),const char * cookie)108*11be35a1SLionel Sambuc run_child(void (*child)(const char *), const char *cookie)
109*11be35a1SLionel Sambuc {
110*11be35a1SLionel Sambuc pid_t pid;
111*11be35a1SLionel Sambuc
112*11be35a1SLionel Sambuc pid = fork();
113*11be35a1SLionel Sambuc ATF_REQUIRE(pid != -1);
114*11be35a1SLionel Sambuc if (pid == 0) {
115*11be35a1SLionel Sambuc in_child = true;
116*11be35a1SLionel Sambuc child(cookie);
117*11be35a1SLionel Sambuc assert(false);
118*11be35a1SLionel Sambuc /* UNREACHABLE */
119*11be35a1SLionel Sambuc } else {
120*11be35a1SLionel Sambuc int status;
121*11be35a1SLionel Sambuc
122*11be35a1SLionel Sambuc ATF_REQUIRE(waitpid(pid, &status, 0) != -1);
123*11be35a1SLionel Sambuc if (!WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS)
124*11be35a1SLionel Sambuc atf_tc_fail("See stderr for details");
125*11be35a1SLionel Sambuc }
126*11be35a1SLionel Sambuc }
127*11be35a1SLionel Sambuc
128*11be35a1SLionel Sambuc /* Callable from the test case parent/child code. */
129*11be35a1SLionel Sambuc static char *
generate_varrun_pidfile(const char * basename)130*11be35a1SLionel Sambuc generate_varrun_pidfile(const char *basename)
131*11be35a1SLionel Sambuc {
132*11be35a1SLionel Sambuc char *path;
133*11be35a1SLionel Sambuc
134*11be35a1SLionel Sambuc if (asprintf(&path, "%s%s.pid", _PATH_VARRUN,
135*11be35a1SLionel Sambuc basename == NULL ? getprogname() : basename) == -1) {
136*11be35a1SLionel Sambuc if (in_child)
137*11be35a1SLionel Sambuc errx(EXIT_FAILURE, "Cannot allocate memory for path");
138*11be35a1SLionel Sambuc else
139*11be35a1SLionel Sambuc atf_tc_fail("Cannot allocate memory for path");
140*11be35a1SLionel Sambuc }
141*11be35a1SLionel Sambuc
142*11be35a1SLionel Sambuc return path;
143*11be35a1SLionel Sambuc }
144*11be35a1SLionel Sambuc
145*11be35a1SLionel Sambuc static void
helper_default_path(const char * path)146*11be35a1SLionel Sambuc helper_default_path(const char *path)
147*11be35a1SLionel Sambuc {
148*11be35a1SLionel Sambuc
149*11be35a1SLionel Sambuc if (pidfile(NULL) == -1)
150*11be35a1SLionel Sambuc errx(EXIT_FAILURE, "Failed to create pidfile with default "
151*11be35a1SLionel Sambuc "basename");
152*11be35a1SLionel Sambuc
153*11be35a1SLionel Sambuc check_pidfile(path);
154*11be35a1SLionel Sambuc exit(EXIT_SUCCESS);
155*11be35a1SLionel Sambuc }
156*11be35a1SLionel Sambuc
157*11be35a1SLionel Sambuc ATF_TC(default_path);
ATF_TC_HEAD(default_path,tc)158*11be35a1SLionel Sambuc ATF_TC_HEAD(default_path, tc)
159*11be35a1SLionel Sambuc {
160*11be35a1SLionel Sambuc atf_tc_set_md_var(tc, "require.user", "root");
161*11be35a1SLionel Sambuc }
ATF_TC_BODY(default_path,tc)162*11be35a1SLionel Sambuc ATF_TC_BODY(default_path, tc)
163*11be35a1SLionel Sambuc {
164*11be35a1SLionel Sambuc char *path;
165*11be35a1SLionel Sambuc
166*11be35a1SLionel Sambuc path = generate_varrun_pidfile(NULL);
167*11be35a1SLionel Sambuc run_child(helper_default_path, path);
168*11be35a1SLionel Sambuc ensure_deleted(path);
169*11be35a1SLionel Sambuc free(path);
170*11be35a1SLionel Sambuc }
171*11be35a1SLionel Sambuc
172*11be35a1SLionel Sambuc static void
helper_custom_basename(const char * path)173*11be35a1SLionel Sambuc helper_custom_basename(const char *path)
174*11be35a1SLionel Sambuc {
175*11be35a1SLionel Sambuc
176*11be35a1SLionel Sambuc if (pidfile("custom-basename") == -1)
177*11be35a1SLionel Sambuc errx(EXIT_FAILURE, "Failed to create pidfile with custom "
178*11be35a1SLionel Sambuc "basename");
179*11be35a1SLionel Sambuc
180*11be35a1SLionel Sambuc check_pidfile(path);
181*11be35a1SLionel Sambuc exit(EXIT_SUCCESS);
182*11be35a1SLionel Sambuc }
183*11be35a1SLionel Sambuc
184*11be35a1SLionel Sambuc ATF_TC(custom_basename);
ATF_TC_HEAD(custom_basename,tc)185*11be35a1SLionel Sambuc ATF_TC_HEAD(custom_basename, tc)
186*11be35a1SLionel Sambuc {
187*11be35a1SLionel Sambuc atf_tc_set_md_var(tc, "require.user", "root");
188*11be35a1SLionel Sambuc }
ATF_TC_BODY(custom_basename,tc)189*11be35a1SLionel Sambuc ATF_TC_BODY(custom_basename, tc)
190*11be35a1SLionel Sambuc {
191*11be35a1SLionel Sambuc char *path;
192*11be35a1SLionel Sambuc
193*11be35a1SLionel Sambuc path = generate_varrun_pidfile("custom-basename");
194*11be35a1SLionel Sambuc run_child(helper_custom_basename, path);
195*11be35a1SLionel Sambuc ensure_deleted(path);
196*11be35a1SLionel Sambuc free(path);
197*11be35a1SLionel Sambuc }
198*11be35a1SLionel Sambuc
199*11be35a1SLionel Sambuc static void
helper_custom_path(const char * path)200*11be35a1SLionel Sambuc helper_custom_path(const char *path)
201*11be35a1SLionel Sambuc {
202*11be35a1SLionel Sambuc
203*11be35a1SLionel Sambuc if (pidfile(path) == -1)
204*11be35a1SLionel Sambuc errx(EXIT_FAILURE, "Failed to create pidfile '%s'", path);
205*11be35a1SLionel Sambuc check_pidfile(path);
206*11be35a1SLionel Sambuc exit(EXIT_SUCCESS);
207*11be35a1SLionel Sambuc }
208*11be35a1SLionel Sambuc
209*11be35a1SLionel Sambuc ATF_TC_WITHOUT_HEAD(custom_path);
ATF_TC_BODY(custom_path,tc)210*11be35a1SLionel Sambuc ATF_TC_BODY(custom_path, tc)
211*11be35a1SLionel Sambuc {
212*11be35a1SLionel Sambuc
213*11be35a1SLionel Sambuc ATF_REQUIRE(mkdir("var", 0777) != -1);
214*11be35a1SLionel Sambuc ATF_REQUIRE(mkdir("var/run", 0777) != -1);
215*11be35a1SLionel Sambuc
216*11be35a1SLionel Sambuc run_child(helper_custom_path, "./var/run/my-pidfile.pid");
217*11be35a1SLionel Sambuc
218*11be35a1SLionel Sambuc ensure_deleted("./var/run/my-pidfile.pid");
219*11be35a1SLionel Sambuc }
220*11be35a1SLionel Sambuc
221*11be35a1SLionel Sambuc static void
helper_change_basenames(const char * unused_cookie)222*11be35a1SLionel Sambuc helper_change_basenames(const char *unused_cookie)
223*11be35a1SLionel Sambuc {
224*11be35a1SLionel Sambuc char *default_path;
225*11be35a1SLionel Sambuc char *custom_path;
226*11be35a1SLionel Sambuc
227*11be35a1SLionel Sambuc default_path = generate_varrun_pidfile(NULL);
228*11be35a1SLionel Sambuc if (pidfile(NULL) == -1)
229*11be35a1SLionel Sambuc errx(EXIT_FAILURE, "Failed to create pidfile with default "
230*11be35a1SLionel Sambuc "basename");
231*11be35a1SLionel Sambuc check_pidfile(default_path);
232*11be35a1SLionel Sambuc if (pidfile(NULL) == -1)
233*11be35a1SLionel Sambuc errx(EXIT_FAILURE, "Failed to recreate pidfile with default "
234*11be35a1SLionel Sambuc "basename");
235*11be35a1SLionel Sambuc check_pidfile(default_path);
236*11be35a1SLionel Sambuc
237*11be35a1SLionel Sambuc custom_path = generate_varrun_pidfile("custom-basename");
238*11be35a1SLionel Sambuc if (pidfile("custom-basename") == -1)
239*11be35a1SLionel Sambuc errx(EXIT_FAILURE, "Failed to create pidfile with custom "
240*11be35a1SLionel Sambuc "basename");
241*11be35a1SLionel Sambuc ensure_deleted(default_path);
242*11be35a1SLionel Sambuc check_pidfile(custom_path);
243*11be35a1SLionel Sambuc if (pidfile("custom-basename") == -1)
244*11be35a1SLionel Sambuc errx(EXIT_FAILURE, "Failed to recreate pidfile with custom "
245*11be35a1SLionel Sambuc "basename");
246*11be35a1SLionel Sambuc check_pidfile(custom_path);
247*11be35a1SLionel Sambuc
248*11be35a1SLionel Sambuc free(custom_path);
249*11be35a1SLionel Sambuc free(default_path);
250*11be35a1SLionel Sambuc exit(EXIT_SUCCESS);
251*11be35a1SLionel Sambuc }
252*11be35a1SLionel Sambuc
253*11be35a1SLionel Sambuc ATF_TC(change_basenames);
ATF_TC_HEAD(change_basenames,tc)254*11be35a1SLionel Sambuc ATF_TC_HEAD(change_basenames, tc)
255*11be35a1SLionel Sambuc {
256*11be35a1SLionel Sambuc atf_tc_set_md_var(tc, "require.user", "root");
257*11be35a1SLionel Sambuc }
ATF_TC_BODY(change_basenames,tc)258*11be35a1SLionel Sambuc ATF_TC_BODY(change_basenames, tc)
259*11be35a1SLionel Sambuc {
260*11be35a1SLionel Sambuc char *default_path;
261*11be35a1SLionel Sambuc char *custom_path;
262*11be35a1SLionel Sambuc
263*11be35a1SLionel Sambuc run_child(helper_change_basenames, NULL);
264*11be35a1SLionel Sambuc
265*11be35a1SLionel Sambuc default_path = generate_varrun_pidfile(NULL);
266*11be35a1SLionel Sambuc custom_path = generate_varrun_pidfile("custom-basename");
267*11be35a1SLionel Sambuc
268*11be35a1SLionel Sambuc ensure_deleted(default_path);
269*11be35a1SLionel Sambuc ensure_deleted(custom_path);
270*11be35a1SLionel Sambuc
271*11be35a1SLionel Sambuc free(custom_path);
272*11be35a1SLionel Sambuc free(default_path);
273*11be35a1SLionel Sambuc }
274*11be35a1SLionel Sambuc
275*11be35a1SLionel Sambuc static void
helper_change_paths(const char * unused_cookie)276*11be35a1SLionel Sambuc helper_change_paths(const char *unused_cookie)
277*11be35a1SLionel Sambuc {
278*11be35a1SLionel Sambuc
279*11be35a1SLionel Sambuc if (pidfile("./var/run/first.pid") == -1)
280*11be35a1SLionel Sambuc errx(EXIT_FAILURE, "Failed to create pidfile "
281*11be35a1SLionel Sambuc "'./var/run/first.pid'");
282*11be35a1SLionel Sambuc check_pidfile("./var/run/first.pid");
283*11be35a1SLionel Sambuc
284*11be35a1SLionel Sambuc if (pidfile("./second.pid") == -1)
285*11be35a1SLionel Sambuc errx(EXIT_FAILURE, "Failed to create pidfile 'second.pid'");
286*11be35a1SLionel Sambuc ensure_deleted("./var/run/first.pid");
287*11be35a1SLionel Sambuc check_pidfile("./second.pid");
288*11be35a1SLionel Sambuc
289*11be35a1SLionel Sambuc exit(EXIT_SUCCESS);
290*11be35a1SLionel Sambuc }
291*11be35a1SLionel Sambuc
292*11be35a1SLionel Sambuc ATF_TC_WITHOUT_HEAD(change_paths);
ATF_TC_BODY(change_paths,tc)293*11be35a1SLionel Sambuc ATF_TC_BODY(change_paths, tc)
294*11be35a1SLionel Sambuc {
295*11be35a1SLionel Sambuc
296*11be35a1SLionel Sambuc ATF_REQUIRE(mkdir("var", 0777) != -1);
297*11be35a1SLionel Sambuc ATF_REQUIRE(mkdir("var/run", 0777) != -1);
298*11be35a1SLionel Sambuc
299*11be35a1SLionel Sambuc run_child(helper_change_paths, NULL);
300*11be35a1SLionel Sambuc
301*11be35a1SLionel Sambuc ensure_deleted("./var/run/my-pidfile.pid");
302*11be35a1SLionel Sambuc ensure_deleted("second.pid");
303*11be35a1SLionel Sambuc }
304*11be35a1SLionel Sambuc
305*11be35a1SLionel Sambuc static void
helper_mix(const char * unused_cookie)306*11be35a1SLionel Sambuc helper_mix(const char *unused_cookie)
307*11be35a1SLionel Sambuc {
308*11be35a1SLionel Sambuc char *default_path;
309*11be35a1SLionel Sambuc char *custom_path;
310*11be35a1SLionel Sambuc
311*11be35a1SLionel Sambuc default_path = generate_varrun_pidfile(NULL);
312*11be35a1SLionel Sambuc custom_path = generate_varrun_pidfile("custom-basename");
313*11be35a1SLionel Sambuc
314*11be35a1SLionel Sambuc if (pidfile(NULL) == -1)
315*11be35a1SLionel Sambuc errx(EXIT_FAILURE, "Failed to create default pidfile");
316*11be35a1SLionel Sambuc check_pidfile(default_path);
317*11be35a1SLionel Sambuc
318*11be35a1SLionel Sambuc if (pidfile("./second.pid") == -1)
319*11be35a1SLionel Sambuc errx(EXIT_FAILURE, "Failed to create pidfile 'second.pid'");
320*11be35a1SLionel Sambuc ensure_deleted(default_path);
321*11be35a1SLionel Sambuc check_pidfile("./second.pid");
322*11be35a1SLionel Sambuc
323*11be35a1SLionel Sambuc if (pidfile("custom-basename") == -1)
324*11be35a1SLionel Sambuc errx(EXIT_FAILURE, "Failed to create pidfile 'second.pid'");
325*11be35a1SLionel Sambuc ensure_deleted(default_path);
326*11be35a1SLionel Sambuc ensure_deleted("./second.pid");
327*11be35a1SLionel Sambuc ensure_deleted("./custom-basename");
328*11be35a1SLionel Sambuc check_pidfile(custom_path);
329*11be35a1SLionel Sambuc
330*11be35a1SLionel Sambuc free(custom_path);
331*11be35a1SLionel Sambuc free(default_path);
332*11be35a1SLionel Sambuc exit(EXIT_SUCCESS);
333*11be35a1SLionel Sambuc }
334*11be35a1SLionel Sambuc
335*11be35a1SLionel Sambuc ATF_TC(change_mix);
ATF_TC_HEAD(change_mix,tc)336*11be35a1SLionel Sambuc ATF_TC_HEAD(change_mix, tc)
337*11be35a1SLionel Sambuc {
338*11be35a1SLionel Sambuc atf_tc_set_md_var(tc, "require.user", "root");
339*11be35a1SLionel Sambuc }
ATF_TC_BODY(change_mix,tc)340*11be35a1SLionel Sambuc ATF_TC_BODY(change_mix, tc)
341*11be35a1SLionel Sambuc {
342*11be35a1SLionel Sambuc char *default_path;
343*11be35a1SLionel Sambuc
344*11be35a1SLionel Sambuc run_child(helper_mix, NULL);
345*11be35a1SLionel Sambuc
346*11be35a1SLionel Sambuc default_path = generate_varrun_pidfile(NULL);
347*11be35a1SLionel Sambuc ensure_deleted(default_path);
348*11be35a1SLionel Sambuc ensure_deleted("second.pid");
349*11be35a1SLionel Sambuc free(default_path);
350*11be35a1SLionel Sambuc }
351*11be35a1SLionel Sambuc
ATF_TP_ADD_TCS(tp)352*11be35a1SLionel Sambuc ATF_TP_ADD_TCS(tp)
353*11be35a1SLionel Sambuc {
354*11be35a1SLionel Sambuc
355*11be35a1SLionel Sambuc ATF_TP_ADD_TC(tp, default_path);
356*11be35a1SLionel Sambuc ATF_TP_ADD_TC(tp, custom_basename);
357*11be35a1SLionel Sambuc ATF_TP_ADD_TC(tp, custom_path);
358*11be35a1SLionel Sambuc ATF_TP_ADD_TC(tp, change_basenames);
359*11be35a1SLionel Sambuc ATF_TP_ADD_TC(tp, change_paths);
360*11be35a1SLionel Sambuc ATF_TP_ADD_TC(tp, change_mix);
361*11be35a1SLionel Sambuc
362*11be35a1SLionel Sambuc return atf_no_error();
363*11be35a1SLionel Sambuc }
364