1 /*
2 * Copyright(C) Bull S.A. 2001
3 * Copyright(c) International Business Machines Corp., 2001
4 *
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; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13 * the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 /******************************************************************************/
21 /* */
22 /* Dec-03-2001 Created: Jacky Malcles & Jean Noel Cordenner */
23 /* These tests are adapted from AIX float PVT tests. */
24 /* */
25 /******************************************************************************/
26 #include <sys/types.h>
27 #include <sys/wait.h>
28 #include <err.h>
29 #include <errno.h>
30 #include <fcntl.h>
31 #include <float.h>
32 #include <limits.h>
33 #include <math.h>
34 #include <signal.h>
35 #include <stdio.h>
36 #include <stdlib.h>
37 #include <string.h>
38 #include <unistd.h>
39
40 #define MAX_FNAME_LEN 16
41
42 /*****************************************************************
43 * create file:
44 *
45 * func_name is the name of the function
46 *
47 * code can take 2 values: DATA_CREATE to create a input data file
48 * RESULT_CREATE for output result file
49 */
50
create_file(char * func_name,int NbVal)51 int create_file(char *func_name, int NbVal)
52 {
53 pid_t myproc;
54
55 switch (myproc = fork()) {
56 case -1:
57 err(1, "fork failed");
58 case 0:{
59 char *arglist[] = { func_name, NULL };
60 execvp(arglist[0], arglist);
61
62 err(1, "execvp failed");
63 }
64 default:
65 ;
66 }
67 return (myproc);
68 }
69
main(int argc,char * argv[])70 int main(int argc, char *argv[])
71 {
72 char *funct, *bin_path;
73 pid_t child;
74
75 if (argc != 2)
76 errx(1, "need the path to generation binaries");
77
78 bin_path = argv[1];
79 funct = malloc(strlen(bin_path) + MAX_FNAME_LEN);
80 if (funct == NULL)
81 err(1, "malloc failed");
82 sprintf(funct, "%s/genj0", bin_path);
83 child = create_file(funct, 0);
84 waitpid(child, NULL, 0);
85
86 sprintf(funct, "%s/genj1", bin_path);
87 child = create_file(funct, 0);
88 waitpid(child, NULL, 0);
89
90 sprintf(funct, "%s/geny0", bin_path);
91 child = create_file(funct, 0);
92 waitpid(child, NULL, 0);
93
94 sprintf(funct, "%s/geny1", bin_path);
95 child = create_file(funct, 0);
96 waitpid(child, NULL, 0);
97
98 sprintf(funct, "%s/genlgamma", bin_path);
99 child = create_file(funct, 0);
100 waitpid(child, NULL, 0);
101
102 return 0;
103 }
104