1 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 
3 #ifdef HAVE_CONFIG_H
4 #  include <config.h>
5 #endif
6 
7 #include <errno.h>
8 #ifdef HAVE_UNISTD_H
9 #  include <unistd.h>
10 #endif
11 
12 #include <cutter.h>
13 #include <cutter/cut-process.h>
14 
15 void test_fork (void);
16 
17 static CutProcess *process;
18 
19 void
cut_setup(void)20 cut_setup (void)
21 {
22     process = cut_process_new();
23 }
24 
25 void
cut_teardown(void)26 cut_teardown (void)
27 {
28     g_object_unref(process);
29 }
30 
31 void
test_fork(void)32 test_fork (void)
33 {
34     int pid;
35 
36     pid = cut_process_fork(process);
37     if (pid == -1 && errno == ENOSYS)
38         cut_omit("cut_process_fork() can't be used on the environment.");
39 
40     if (pid == 0) {
41         _exit(EXIT_SUCCESS);
42     }
43 
44     cut_assert_equal_int (EXIT_SUCCESS, cut_process_wait(process, 0));
45 }
46 
47 /*
48 vi:ts=4:nowrap:ai:expandtab:sw=4
49 */
50