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 <float.h>
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
32 #include <errno.h>
33 #include <limits.h>
34 #include <unistd.h>
35 #include <fcntl.h>
36 #include <errno.h>
37 #include <sys/signal.h>
38 #include <math.h>
39
40 #define M_PIl 3.1415926535897932384626433832795029L L
41 #define MAX_FNAME_LEN 16
42
43 /*****************************************************************
44 * create file:
45 *
46 * func_name is the name of the trigo function (sin, cos, tan...)
47 *
48 * code can take 2 values: DATA_CREATE to create a input data file
49 * RESULT_CREATE for output result file
50 */
51
create_file(char * func_name,int NbVal)52 int create_file(char *func_name, int NbVal)
53 {
54 pid_t myproc;
55
56 if ((myproc = fork()) != 0)
57 return myproc;
58 else {
59 char *arglist[] = { func_name, NULL };
60 execvp(arglist[0], arglist);
61
62 fprintf(stderr, "ERROR %s\n", strerror(errno));
63 abort();
64 }
65 }
66
main(int argc,char * argv[])67 int main(int argc, char *argv[])
68 {
69 char *funct, *bin_path;
70 pid_t child;
71
72 if (argc != 2) {
73 printf("ERROR: need the path to generation binaries\n");
74 abort();
75 }
76
77 bin_path = argv[1];
78
79 funct = malloc(strlen(bin_path) + MAX_FNAME_LEN);
80 sprintf(funct, "%s/gencos", bin_path);
81 child = create_file(funct, 0);
82 waitpid(child, NULL, 0);
83
84 sprintf(funct, "%s/gensin", bin_path);
85 child = create_file(funct, 0);
86 waitpid(child, NULL, 0);
87
88 sprintf(funct, "%s/gentan", bin_path);
89 child = create_file(funct, 0);
90 waitpid(child, NULL, 0);
91
92 sprintf(funct, "%s/genatan", bin_path);
93 child = create_file(funct, 0);
94 waitpid(child, NULL, 0);
95
96 sprintf(funct, "%s/genatan2", bin_path);
97 child = create_file(funct, 0);
98 waitpid(child, NULL, 0);
99
100 sprintf(funct, "%s/genacos", bin_path);
101 child = create_file(funct, 0);
102 waitpid(child, NULL, 0);
103
104 sprintf(funct, "%s/genasin", bin_path);
105 child = create_file(funct, 0);
106 waitpid(child, NULL, 0);
107
108 return 0;
109 }
110