3 // Copyright (C) 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; version 2 of the License.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 #include <sys/types.h>
28 #include <sys/socket.h>
30 #define ENSC_WRAPPERS_UNISTD 1
31 #define ENSC_WRAPPERS_SOCKET 1
34 int wrapper_exit_code = 1;
36 #define TEST_BLOCKSIZE 0x20000
37 static bool is_gremlin = false;
43 if (!is_gremlin) return;
47 Esend(sync_p[1], ".", 1, 0);
48 Erecv(sync_p[1], &c, 1, 0);
51 #define TESTSUITE_COPY_CODE testit()
54 #include "../unify-copy.c"
55 #include "../unify-settime.c"
58 checkTrunc(char const *src,
60 struct stat const *st,
68 Erecv(sync_p[0], &c, 1, 0);
70 Esend(sync_p[0], &c, 1, 0);
75 return !copyReg(src, st, dst);
80 char f_name0[] = "/tmp/sigbus.XXXXXX";
81 char f_name1[] = "/tmp/sigbus.XXXXXX";
82 int fd_src = mkstemp(f_name0);
83 int fd_dst = mkstemp(f_name1);
84 char buf[TEST_BLOCKSIZE] = { [0] = '\0' };
90 write(fd_src, buf, sizeof(buf));
96 if (!copyReg(f_name0, &st, f_name1))
102 Esocketpair(AF_LOCAL, SOCK_STREAM, 0, sync_p);
103 signal(SIGCHLD, SIG_IGN);
105 res = (checkTrunc(f_name0, f_name1, &st, TEST_BLOCKSIZE/2) &&
106 checkTrunc(f_name0, f_name1, &st, 0x2345));
110 return res ? EXIT_SUCCESS : EXIT_FAILURE;